/**
 * Blätterkatalog-Viewer: Grundlayout.
 *
 * Bewusst zurückhaltend gehalten — Feinstyling übernimmt das Theme
 * (Yootheme). Die StPageFlip-Basis-Styles liegen in vendor/st-page-flip.css.
 *
 * @package Sinnhaltig\PdfHexer
 */

.sphexer-viewer {
	margin: 0 auto;
	max-width: 100%;
	outline: none;
}

.sphexer-viewer:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 4px;
}

.sphexer-stage {
	position: relative;
}

.sphexer-book {
	margin: 0 auto;
	touch-action: pan-y;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
}

.sphexer-page {
	background: #fff;
	overflow: hidden;
}

.sphexer-page-image {
	display: block;
	height: 100%;
	object-fit: contain;
	width: 100%;
}

/* Richtungs-Overlays an den äußeren Seitenrändern (nach Referenz-Vorbild):
   ganzhohe, dezente Zonen zeigen an, in welche Richtung geblättert werden
   kann — auf der ersten Doppelseite nur rechts, auf der letzten nur links.
   Bei Hover/Fokus deutlicher; Klick blättert. */

.sphexer-nav {
	align-items: center;
	/* UA-Button-Styles vollständig neutralisieren — Safari/Chrome/Firefox
	   zeichnen sonst Rahmen/Hintergrund der nativen Button-Optik (weiße
	   Kante, die die Seite optisch durchtrennt). */
	appearance: none;
	-moz-appearance: none;
	-webkit-appearance: none;
	background-color: transparent;
	border: 0;
	border-radius: 0;
	bottom: 0;
	box-shadow: none;
	margin: 0;
	outline: 0;
	-webkit-tap-highlight-color: transparent;
	color: #fff;
	cursor: pointer;
	display: flex;
	font-size: 2.5rem;
	justify-content: center;
	line-height: 1;
	opacity: 0.55;
	padding: 0;
	position: absolute;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	top: 0;
	transition: opacity 0.25s ease, background 0.15s ease;
	width: clamp(2.5rem, 7%, 4rem);
	z-index: 5;
}

.sphexer-nav-prev {
	background: linear-gradient(to right, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
	left: 0;
}

.sphexer-nav-next {
	background: linear-gradient(to left, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
	right: 0;
}

/* Firefox: inneren Fokus-Rand der Buttons entfernen (erscheint sonst
   bei Klick/Aktiv-Status als Rahmen). */
.sphexer-nav::-moz-focus-inner {
	border: 0;
	padding: 0;
}

/* Klick-/Aktiv-/Fokus-Status: kein UA-Rahmen, kein Outline. */
.sphexer-nav:focus,
.sphexer-nav:active {
	border: 0;
	box-shadow: none;
	outline: 0;
}

.sphexer-nav:hover,
.sphexer-nav:focus-visible {
	opacity: 1;
}

/* Tastatur-Fokus bleibt sichtbar: bewusster, innenliegender Ring statt
   des UA-Rahmens. */
.sphexer-nav:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.8);
	outline-offset: -4px;
}

.sphexer-nav-prev:hover,
.sphexer-nav-prev:focus-visible {
	background: linear-gradient(to right, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0));
}

.sphexer-nav-next:hover,
.sphexer-nav-next:focus-visible {
	background: linear-gradient(to left, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0));
}

.sphexer-nav.sphexer-nav-hidden {
	opacity: 0;
	pointer-events: none;
}

@media (pointer: coarse) {
	.sphexer-nav {
		opacity: 0.85;
	}

	.sphexer-nav.sphexer-nav-hidden {
		opacity: 0;
	}
}

.sphexer-controls {
	align-items: center;
	display: flex;
	gap: 1rem;
	justify-content: center;
	margin-top: 0.75rem;
}

.sphexer-controls button {
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1.25rem;
	height: 2.25rem;
	line-height: 1;
	width: 2.25rem;
}

.sphexer-controls button:hover,
.sphexer-controls button:focus-visible {
	background: rgba(0, 0, 0, 0.06);
}

.sphexer-indicator {
	font-variant-numeric: tabular-nums;
	min-width: 8em;
	text-align: center;
}

@media (pointer: coarse) {
	.sphexer-controls {
		gap: 1.25rem;
	}

	.sphexer-controls button {
		font-size: 1.5rem;
		height: 2.75rem;
		width: 2.75rem;
	}
}

/* Zoom-Ansicht */

.sphexer-zoom-overlay {
	animation: sphexer-zoom-fade-in 0.25s ease-out;
	background: rgba(20, 20, 20, 0.92);
	inset: 0;
	position: fixed;
	z-index: 99999;
}

.sphexer-zoom-overlay.sphexer-zoom-closing {
	opacity: 0;
	transition: opacity 0.2s ease-in;
}

@keyframes sphexer-zoom-fade-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes sphexer-zoom-scale-in {
	from {
		opacity: 0.4;
		transform: scale(0.92);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

.sphexer-zoom-scroller {
	cursor: grab;
	height: 100%;
	overflow: auto;
	/* Ein Finger scrollt nativ, Zwei-Finger-Pinch geht an das eigene
	   Skalieren (statt an den Browser-Seitenzoom). */
	touch-action: pan-x pan-y;
	-webkit-overflow-scrolling: touch;
	width: 100%;
}

.sphexer-zoom-scroller.sphexer-zoom-dragging {
	cursor: grabbing;
	user-select: none;
}

.sphexer-zoom-spread {
	animation: sphexer-zoom-scale-in 0.3s ease-out;
	display: flex;
	justify-content: safe center;
	min-height: 100%;
	padding: 2rem;
	transform-origin: center center;
	width: max-content;
	margin: 0 auto;
}

.sphexer-zoom-image {
	background: #fff;
	box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
	display: block;
	filter: none;
	height: auto;
	max-width: none;
	transition: filter 0.25s ease;
}

.sphexer-zoom-image.sphexer-zoom-sharp {
	filter: none;
}

.sphexer-zoom-close {
	background: rgba(0, 0, 0, 0.55);
	border: none;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	font-size: 1.5rem;
	height: 2.75rem;
	line-height: 1;
	position: fixed;
	right: 1rem;
	top: 1rem;
	width: 2.75rem;
}

.sphexer-zoom-close:hover,
.sphexer-zoom-close:focus-visible {
	background: rgba(0, 0, 0, 0.8);
}

.sphexer-zoom-hint {
	background: rgba(0, 0, 0, 0.55);
	border-radius: 4px;
	bottom: 1rem;
	color: #fff;
	font-size: 0.85rem;
	left: 50%;
	padding: 0.4em 1em;
	position: fixed;
	transform: translateX(-50%);
	transition: opacity 0.6s ease;
}

.sphexer-zoom-hint-fade {
	opacity: 0;
}
