/* PDF 3D Flipbook Viewer — front-end styles. Namespaced under .pdf3dfv- to avoid theme conflicts. */

.pdf3dfv-viewer {
	--pdf3dfv-bg: #e2e2e2;
	--pdf3dfv-w: 900px;
	--pdf3dfv-h: 600px;
	box-sizing: border-box;
	width: 100%;
	margin: 0 auto 1.5em;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	outline: none;
}
.pdf3dfv-viewer * {
	box-sizing: border-box;
}

.pdf3dfv-error {
	padding: 1em;
	background: #fdecea;
	color: #611a15;
	border: 1px solid #f5c6cb;
	border-radius: 4px;
}

.pdf3dfv-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px 10px;
	background: #2b2f36;
	border-radius: 6px 6px 0 0;
}

.pdf3dfv-toolbar-group {
	display: flex;
	align-items: center;
	gap: 4px;
}

.pdf3dfv-btn {
	appearance: none;
	border: 0;
	background: transparent;
	color: #fff;
	width: 36px;
	height: 36px;
	line-height: 36px;
	border-radius: 4px;
	font-size: 16px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease;
}
.pdf3dfv-btn:hover,
.pdf3dfv-btn:focus-visible {
	background: rgba(255, 255, 255, 0.15);
}
.pdf3dfv-btn.is-active {
	background: #4a90e2;
}

.pdf3dfv-page-indicator {
	color: #cfd3d8;
	font-size: 13px;
	min-width: 90px;
	text-align: center;
	white-space: nowrap;
}

.pdf3dfv-stage {
	position: relative;
	background: var(--pdf3dfv-bg);
	border-radius: 0 0 6px 6px;
	/* auto (not hidden): once zoomed in, the enlarged page overflows this
	   box, and this is what lets you scroll/drag to reach any part of it
	   instead of only ever seeing whatever fit before zooming. */
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	padding: 24px;
}

.pdf3dfv-zoom-wrap {
	width: 100%;
	max-width: var(--pdf3dfv-w);
	/* top left (not center): keeps the pan math in viewer.js simple — the
	   scaled box grows down-right from a fixed corner, so scrollLeft/Top
	   map directly onto it instead of shifting as the scale changes. */
	transform-origin: top left;
	transition: transform 0.2s ease;
	overflow: visible;
}
.pdf3dfv-zoom-wrap.is-zoomed {
	cursor: grab;
}
.pdf3dfv-zoom-wrap.is-panning {
	cursor: grabbing;
}

/* St.PageFlip's "stretch" size mode reads this element's own box (via
   offsetWidth/offsetHeight) and fits the book inside it while preserving the
   real PDF page's aspect ratio on its own — no letterboxing math needed on
   our side. It just needs a real, non-zero height to measure; a 0-height box
   (the previous bug here) makes it collapse to nothing. */
.pdf3dfv-flip-mount {
	width: 100%;
	height: var(--pdf3dfv-h);
	max-height: min(var(--pdf3dfv-h), 85vh);
	margin: 0 auto;
}
/* The page pixels themselves are pre-mirrored at render time (see
   viewer.js), so only the container needs mirroring here — that combination
   is what makes the book open from the right while text/photos stay
   readable, regardless of what markup St.PageFlip renders internally. */
.pdf3dfv-flip-mount.pdf3dfv-rtl {
	transform: scaleX(-1);
}

.pdf3dfv-viewer.pdf3dfv-fullscreen .pdf3dfv-stage {
	min-height: calc(100vh - 56px);
}
.pdf3dfv-viewer.pdf3dfv-fullscreen {
	background: #111;
}
/* The zoom-wrap/flip-mount are sized to the shortcode's configured
   width/height (--pdf3dfv-w / --pdf3dfv-h) so the book matches the size the
   page author picked. In fullscreen, raising just max-width/max-height does
   nothing on its own — flip-mount's *height* is a fixed, definite value
   (not "auto"), so it never grows past it regardless of how high the cap
   is. Fullscreen needs an actual bigger height, not just a bigger ceiling. */
.pdf3dfv-viewer.pdf3dfv-fullscreen .pdf3dfv-zoom-wrap {
	max-width: 96vw;
}
.pdf3dfv-viewer.pdf3dfv-fullscreen .pdf3dfv-flip-mount {
	height: calc(100vh - 56px - 48px);
	max-height: none;
}

/* Loading state */
.pdf3dfv-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: var(--pdf3dfv-bg);
	z-index: 2;
}
.pdf3dfv-spinner {
	width: 34px;
	height: 34px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: #4a90e2;
	border-radius: 50%;
	animation: pdf3dfv-spin 0.8s linear infinite;
}
@keyframes pdf3dfv-spin {
	to { transform: rotate(360deg); }
}
.pdf3dfv-loading-text {
	font-size: 13px;
	color: #555;
}
.pdf3dfv-progress-track {
	width: 200px;
	height: 6px;
	background: rgba(0, 0, 0, 0.12);
	border-radius: 3px;
	overflow: hidden;
}
.pdf3dfv-progress-bar {
	height: 100%;
	width: 0%;
	background: #4a90e2;
	transition: width 0.15s ease;
}

/* Magnifier lens */
.pdf3dfv-lens {
	position: absolute;
	display: none;
	border-radius: 50%;
	border: 3px solid #fff;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
	pointer-events: none;
	background-repeat: no-repeat;
	opacity: 0;
	transition: opacity 0.1s ease;
	z-index: 5;
}
.pdf3dfv-magnifier-active .pdf3dfv-flip-mount,
.pdf3dfv-magnifier-active .pdf3dfv-flip-mount * {
	cursor: crosshair !important;
}

/* page-flip.js injects its own .stf__parent / .stf__item structure inside
   .pdf3dfv-flip-mount — keep pages readable while loading images */
.pdf3dfv-flip-mount .stf__item img {
	max-width: 100%;
	height: auto;
	display: block;
}

@media (max-width: 600px) {
	.pdf3dfv-toolbar {
		justify-content: center;
	}
	.pdf3dfv-btn {
		width: 32px;
		height: 32px;
		font-size: 14px;
	}
}
