/* ─── SAR Lightbox (geteilt: Slider, Core-Bild, Core-Galerie) ───────────
   Markup baut assets/js/sar-lightbox.js. Vorher lag das hier in
   blocks/travel-slider/style.css (bis 16.08.2026). */

/* Scroll-Lock: sar-lightbox.js setzt zusaetzlich body.style.top auf die
   negative Scroll-Position, damit die Seite unter dem Overlay nicht
   springt (iOS Safari ignoriert overflow:hidden am body). */
body.sar-lightbox-open {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
	overflow: hidden;
}

/* Schwebende Fremd-Elemente (Borlabs-Cookie-Icon, Theme-Buttons) waehrend
   die Lightbox offen ist ausblenden; deren z-index liegt teils ueber dem
   des Overlays. Borlabs v2 + v3 Selektoren. */
body.sar-lightbox-open #BorlabsCookieBox,
body.sar-lightbox-open .brlbs-cmpnt-widget,
body.sar-lightbox-open #brlbs-cmpnt-widget,
body.sar-lightbox-open .brlbs-cmpnt-container,
body.sar-lightbox-open .BorlabsCookie,
body.sar-lightbox-open .scroll-to-top,
body.sar-lightbox-open .sar-fb-launch {
	visibility: hidden !important;
}

/* Bilder, die die Lightbox oeffnen (Core-Bloecke, Klasse setzt das JS). */
.sar-has-lightbox img {
	cursor: zoom-in;
}

.sar-lightbox {
	position: fixed;
	inset: 0;
	/* Ueber allem, auch ueber Cookie-Bannern/-Icons (Borlabs nutzt sehr
	   hohe Werte). */
	z-index: 2147483600;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.80);
	/* Kein Seiten-Zoom/-Scroll unter dem Overlay; das Wischen erledigt
	   das JS ueber Pointer-Events. */
	touch-action: none;
	-webkit-tap-highlight-color: transparent;
}

.sar-lightbox.is-open {
	display: flex;
}

.sar-lightbox__figure {
	margin: 0;
	max-width: calc(100vw - 48px);
	max-height: calc(100vh - 64px);
	max-height: calc(100dvh - 64px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

/* Media-Wrapper: Bezugsrahmen fuer Close + Pfeile (absolute), damit die
   Buttons am Bild kleben, waehrend die Caption darunter im Fluss steht. */
.sar-lightbox__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
}

.sar-lightbox__img {
	max-width: 100%;
	/* Luft fuer Zaehler oben und Caption unten. */
	max-height: calc(100vh - 190px);
	max-height: calc(100dvh - 190px);
	object-fit: contain;
	display: block;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
	box-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
}

/* Titel-Leiste: steht als Fluss-Element UNTER dem Foto als weisser Balken
   in Bildbreite; der Overlay-Hintergrund ist nur halbtransparent, deshalb
   braucht der Text eigenen Grund. */
.sar-lightbox__caption {
	width: 100%;
	max-width: 100%;
	background: #fff;
	color: #111;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	padding: 10px 16px 12px;
}

.sar-lightbox__caption.is-hidden {
	display: none;
}

.sar-lightbox__desc {
	display: block;
}

.sar-lightbox__copyright {
	display: block;
	opacity: 0.65;
	font-size: 12px;
}

.sar-lightbox__copyright:empty {
	display: none;
}

.sar-lightbox__counter {
	position: absolute;
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(0, 0, 0, 0.7);
	font-size: 14px;
	pointer-events: none;
}

.sar-lightbox__counter.is-hidden {
	display: none;
}

/* Close + Pfeile liegen AUF dem Bild (absolute zum Media-Wrapper): weisse,
   halbtransparente Kreise mit Schatten. Bewusst klein und durchscheinend,
   damit sie das Foto nicht dominieren. */
.sar-lightbox__close,
.sar-lightbox__arrow {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.6);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	color: #1a1a1a;
	cursor: pointer;
	transition: background 0.15s ease;
}

.sar-lightbox__close svg,
.sar-lightbox__arrow svg {
	display: block;
	width: 20px;
	height: 20px;
}

.sar-lightbox__close:hover,
.sar-lightbox__arrow:hover {
	background: rgba(255, 255, 255, 1);
	/* Farbe explizit halten: Theme-Button-Hover setzt color auf Weiss,
	   das Icon (stroke: currentColor) verschwand sonst auf dem weissen
	   Kreis. */
	color: #1a1a1a;
}

.sar-lightbox__close:focus-visible,
.sar-lightbox__arrow:focus-visible {
	outline: 2px solid #1a1a1a;
	outline-offset: 2px;
}

.sar-lightbox__close {
	top: 10px;
	right: 10px;
}

.sar-lightbox__arrow {
	top: 50%;
	transform: translateY(-50%);
}

.sar-lightbox__arrow--prev { left: 10px; }
.sar-lightbox__arrow--next { right: 10px; }

.sar-lightbox__arrow.is-hidden {
	display: none;
}

/* ─── Touch-Geraete: gewischt statt geklickt ───
   Die Pfeile bleiben fuer Tablets mit Maus/Trackpad erhalten, auf reinen
   Touch-Geraeten wird gewischt; kleinere, dezentere Buttons. */
@media (hover: none) and (pointer: coarse) {
	.sar-lightbox__arrow {
		display: none;
	}
}

@media (max-width: 767px) {
	.sar-lightbox__figure {
		max-width: 100vw;
		padding: 0 8px;
	}

	.sar-lightbox__img {
		max-height: calc(100vh - 210px);
		max-height: calc(100dvh - 210px);
	}

	.sar-lightbox__close,
	.sar-lightbox__arrow {
		width: 30px;
		height: 30px;
		background: rgba(255, 255, 255, 0.5);
	}

	.sar-lightbox__close svg,
	.sar-lightbox__arrow svg {
		width: 18px;
		height: 18px;
	}

	.sar-lightbox__arrow--prev { left: 8px; }
	.sar-lightbox__arrow--next { right: 8px; }
}

/* ─── Handy-Querformat: Vollbild-Viewer ───
   Im Querformat ist kaum Hoehe da (iPhone: 320-430 CSS-px). Das Bild
   fuellt dann die ganze Hoehe, die Caption liegt als halbtransparentes
   Overlay unten AUF dem Bild, Zaehler klein oben links. Erkennung ueber
   die geringe Hoehe, nicht ueber die Breite: im Querformat sind Handys
   breiter als der 768px-Mobil-Breakpoint. */
@media (orientation: landscape) and (max-height: 520px) {
	.sar-lightbox {
		background: rgba(255, 255, 255, 0.96);
	}

	.sar-lightbox__figure {
		position: relative;
		max-width: 100vw;
		max-height: 100vh;
		max-height: 100dvh;
		width: 100%;
		height: 100vh;
		height: 100dvh;
		padding: 0;
	}

	.sar-lightbox__media {
		width: 100%;
		height: 100%;
	}

	.sar-lightbox__img {
		max-width: 100%;
		max-height: 100vh;
		max-height: 100dvh;
		height: 100vh;
		height: 100dvh;
		width: auto;
		box-shadow: none;
	}

	/* Caption als helles Overlay unten auf dem Bild. Unten zusaetzlich
	   Luft fuer die iPhone-Home-Leiste (env() greift nur mit
	   viewport-fit=cover, deshalb ein fester Mindestabstand). */
	.sar-lightbox__caption {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(255, 255, 255, 0.82);
		color: #111;
		font-size: 13px;
		line-height: 1.4;
		padding: 6px 48px 24px;
		padding-bottom: calc(8px + max(16px, env(safe-area-inset-bottom)));
		padding-left: calc(48px + env(safe-area-inset-left));
		padding-right: calc(48px + env(safe-area-inset-right));
		text-align: center;
	}

	.sar-lightbox__desc {
		display: inline;
	}

	.sar-lightbox__copyright {
		display: inline;
		margin-left: 8px;
		font-size: 11px;
		opacity: 0.6;
	}

	.sar-lightbox__counter {
		top: 8px;
		left: calc(12px + env(safe-area-inset-left));
		transform: none;
		color: rgba(0, 0, 0, 0.7);
		font-size: 12px;
	}

	.sar-lightbox__close {
		top: 8px;
		right: calc(8px + env(safe-area-inset-right));
	}
}
