/*
 * NetRhyme WP Flipbook: viewer and block styles.
 * Works without any theme. Colours of the overlay can be changed with the
 * custom properties on .nrfb-dialog.
 */

/* ---------- triggers made by the block ---------- */

.nrfb--cover {
	display: flex;
}

.nrfb-cover {
	display: inline-grid;
	gap: 0.75rem;
	max-width: 16rem;
	color: inherit;
	text-decoration: none;
}

.nrfb-cover img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 2px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 12px 28px -8px rgba(0, 0, 0, 0.35);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.nrfb-cover:hover img,
.nrfb-cover:focus-visible img {
	transform: translateY(-4px);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 20px 36px -10px rgba(0, 0, 0, 0.4);
}

.nrfb-cover__label {
	font-weight: 600;
	line-height: 1.3;
}

/* ---------- overlay ---------- */

html.nrfb-lock {
	overflow: hidden;
}

.nrfb-dialog {
	--nrfb-bg: #17171c;
	--nrfb-fg: #f4f4f6;
	--nrfb-line: rgba(255, 255, 255, 0.12);
	--nrfb-hover: rgba(255, 255, 255, 0.12);

	position: fixed;
	inset: 0;
	box-sizing: border-box;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: hidden;
	background: var(--nrfb-bg);
	color: var(--nrfb-fg);
}

.nrfb-dialog::backdrop {
	background: rgba(10, 10, 14, 0.7);
}

/* ---------- viewer frame ---------- */

.nrfb-viewer {
	box-sizing: border-box;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
}

.nrfb-viewer *,
.nrfb-viewer *::before,
.nrfb-viewer *::after {
	box-sizing: border-box;
}

.nrfb-viewer--overlay {
	height: 100%;
}

.nrfb-viewer--inline {
	--nrfb-fg: currentColor;
	--nrfb-line: color-mix(in srgb, currentColor 14%, transparent);
	--nrfb-hover: color-mix(in srgb, currentColor 10%, transparent);

	border: 1px solid var(--nrfb-line);
	border-radius: 8px;
	overflow: hidden;
	background: color-mix(in srgb, currentColor 4%, transparent);
}

.nrfb-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 56px;
	padding: 6px 8px 6px 20px;
	border-bottom: 1px solid var(--nrfb-line);
}

.nrfb-title {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.nrfb-tools {
	display: flex;
	flex: none;
	align-items: center;
	gap: 2px;
}

.nrfb-btn {
	appearance: none;
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.nrfb-btn:hover {
	background: var(--nrfb-hover);
	color: inherit;
}

.nrfb-btn:focus-visible,
.nrfb-edge:focus-visible,
.nrfb-status__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.nrfb-btn[disabled] {
	opacity: 0.35;
	cursor: default;
	background: transparent;
}

.nrfb-count {
	min-width: 5.5em;
	padding: 0 4px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ---------- stage ---------- */

.nrfb-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 0;
	padding: 28px 72px;
	overflow: hidden;
}

.nrfb-viewer--inline .nrfb-stage {
	min-height: 14rem;
	padding: 24px;
}

.nrfb-stage.is-zoomed {
	align-items: flex-start;
	justify-content: flex-start;
	overflow: auto;
	cursor: grab;
}

.nrfb-stage.is-zoomed.is-panning {
	cursor: grabbing;
	user-select: none;
}

/* While zoomed the pages do not turn by drag; the stage scrolls instead. */
.nrfb-stage.is-zoomed .nrfb-mount {
	pointer-events: none;
}

.nrfb-stage.is-zoomed .nrfb-sizer {
	margin: 0 auto;
}

.nrfb-sizer {
	flex: none;
	max-width: none;
	opacity: 0;
	transition: transform 0.6s cubic-bezier(0.3, 0.1, 0.2, 1), opacity 0.3s ease;
}

.nrfb-viewer.is-open .nrfb-sizer {
	opacity: 1;
}

/* A closed book sits in the middle, not on the right half. */
.nrfb-sizer.is-cover {
	transform: translateX(-25%);
}

.nrfb-sizer.is-back {
	transform: translateX(25%);
}

/* page-flip sets a minimum width inline; the sizer decides the width here. */
.nrfb-mount {
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
}

.nrfb-page {
	overflow: hidden;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 14px 40px -12px rgba(0, 0, 0, 0.55);
}

.nrfb-page img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	opacity: 0;
	pointer-events: none;
	user-select: none;
	-webkit-user-drag: none;
	transition: opacity 0.25s ease;
}

.nrfb-page.is-ready img {
	opacity: 1;
}

.nrfb-page:not(.is-ready)::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: rgba(0, 0, 0, 0.55);
	border-radius: 50%;
	animation: nrfb-spin 0.8s linear infinite;
}

/* The fold between two facing pages. */
.nrfb-page.\--left::before,
.nrfb-page.\--right::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 1;
	width: 7%;
	pointer-events: none;
}

.nrfb-page.\--left::before {
	right: 0;
	background: linear-gradient(to left, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.04) 45%, transparent);
}

.nrfb-page.\--right::before {
	left: 0;
	background: linear-gradient(to right, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.04) 45%, transparent);
}

.nrfb-link {
	position: absolute;
	z-index: 2;
	display: block;
	border-radius: 2px;
}

.nrfb-link:hover,
.nrfb-link:focus-visible {
	background: rgba(40, 110, 255, 0.14);
	outline: 1px solid rgba(40, 110, 255, 0.5);
}

/* ---------- side arrows (overlay, wide screens) ---------- */

.nrfb-edge {
	appearance: none;
	position: absolute;
	top: 50%;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin: -24px 0 0;
	padding: 0;
	border: 1px solid var(--nrfb-line);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.06);
	color: inherit;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.nrfb-edge:hover {
	background: rgba(255, 255, 255, 0.16);
}

.nrfb-edge--prev {
	left: 12px;
}

.nrfb-edge--next {
	right: 12px;
}

.nrfb-edge[hidden],
.nrfb-stage.is-zoomed .nrfb-edge {
	display: none;
}

/* ---------- loading and error ---------- */

.nrfb-status {
	position: absolute;
	inset: 0;
	z-index: 4;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 14px;
	padding: 24px;
	text-align: center;
}

.nrfb-status[hidden] {
	display: none;
}

.nrfb-status p {
	margin: 0;
	max-width: 30em;
	font-size: 15px;
}

.nrfb-status__link {
	display: inline-block;
	padding: 10px 18px;
	border: 1px solid currentColor;
	border-radius: 6px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.nrfb-spinner {
	width: 32px;
	height: 32px;
	border: 2px solid var(--nrfb-line);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: nrfb-spin 0.8s linear infinite;
}

@keyframes nrfb-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---------- small screens ---------- */

@media (max-width: 720px) {
	.nrfb-bar {
		flex-wrap: wrap;
		gap: 0 8px;
		padding: 6px 4px 6px 14px;
	}

	.nrfb-title {
		flex-basis: 100%;
		padding: 6px 0 0;
		font-size: 14px;
	}

	.nrfb-tools {
		flex: 1 1 auto;
		justify-content: space-between;
	}

	.nrfb-stage {
		padding: 14px 10px;
	}

	.nrfb-viewer--inline .nrfb-stage {
		padding: 12px;
	}

	.nrfb-edge {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nrfb-sizer,
	.nrfb-cover img,
	.nrfb-page img,
	.nrfb-btn,
	.nrfb-edge {
		transition: none;
	}

	.nrfb-spinner,
	.nrfb-page:not(.is-ready)::after {
		animation-duration: 2.4s;
	}
}

@media print {
	.nrfb-dialog {
		display: none;
	}
}
