/*! Lichtbild Gallery 1.0.2 | Copyright (c) 2026 DieMilchgebendeKuh – https://diemilchgebendekuh.de | GPL-2.0-or-later */

/* ==========================================================================
   Galerie
   ========================================================================== */

.lbg-gallery {
	--lbg-c: var(--lbg-cols, 4);
	--lbg-rh: var(--lbg-row-h, 240px);
	box-sizing: border-box;
	margin-block: 1.5em;
	padding: 0;
}

.lbg-gallery *,
.lbg-gallery *::before,
.lbg-gallery *::after {
	box-sizing: border-box;
}

@media (max-width: 1024px) {
	.lbg-gallery {
		--lbg-c: var(--lbg-cols-t, 3);
		--lbg-rh: calc(var(--lbg-row-h, 240px) * 0.8);
	}
}

@media (max-width: 600px) {
	.lbg-gallery {
		--lbg-c: var(--lbg-cols-m, 2);
		--lbg-rh: calc(var(--lbg-row-h, 240px) * 0.55);
	}
}

.lbg-gallery .lbg-item {
	position: relative;
	min-width: 0;
	margin: 0;
	padding: 0;
}

.lbg-gallery .lbg-link {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--lbg-radius, 0);
	background: rgba(128, 128, 128, 0.14);
	color: inherit;
	text-decoration: none;
	cursor: zoom-in;
	-webkit-tap-highlight-color: transparent;
}

.lbg-gallery .lbg-link:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

.lbg-gallery .lbg-item .lbg-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
}

/* Raster ------------------------------------------------------------------ */

.lbg-layout-grid {
	display: grid;
	grid-template-columns: repeat(var(--lbg-c), minmax(0, 1fr));
	gap: var(--lbg-gap, 8px);
}

.lbg-layout-grid .lbg-link {
	aspect-ratio: var(--lbg-aspect, 1 / 1);
}

/* „Original“: kein Zuschnitt, jede Kachel im Format ihres Bildes; in der Zeile mittig ausgerichtet. */
.lbg-layout-grid.lbg-aspect-original {
	align-items: center;
}

.lbg-layout-grid.lbg-aspect-original .lbg-link {
	aspect-ratio: var(--lbg-ar, auto);
}

/* Masonry ----------------------------------------------------------------- */

.lbg-layout-masonry {
	column-count: var(--lbg-c);
	column-gap: var(--lbg-gap, 8px);
	margin-bottom: calc(1.5em - var(--lbg-gap, 8px));
}

.lbg-layout-masonry .lbg-item {
	display: block;
	width: 100%;
	margin-bottom: var(--lbg-gap, 8px);
	break-inside: avoid;
	page-break-inside: avoid;
}

.lbg-layout-masonry .lbg-link {
	aspect-ratio: var(--lbg-ar, auto);
}

/* Justified --------------------------------------------------------------- */

.lbg-layout-justified {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: var(--lbg-gap, 8px);
}

.lbg-layout-justified .lbg-item {
	flex: var(--lbg-ar, 1.5) 1 calc(var(--lbg-rh) * var(--lbg-ar, 1.5));
	max-width: 100%;
}

.lbg-layout-justified .lbg-link {
	aspect-ratio: var(--lbg-ar, 1.5);
}

/* Die letzte Zeile soll nicht auf volle Breite gezogen werden. */
.lbg-layout-justified::after {
	content: "";
	flex: 1000000 1 0;
	height: 0;
}

/* Sobald das Skript die Zeilen exakt berechnet hat, gelten dessen Breiten. */
.lbg-layout-justified.is-js .lbg-item {
	flex: 0 0 auto;
}

.lbg-layout-justified.is-js::after {
	display: none;
}

/* Ohne Skript: einzelne Bilder nicht übermäßig aufziehen. */
.lbg-layout-justified:not(.is-js) .lbg-item {
	max-width: min(100%, calc(var(--lbg-rh) * var(--lbg-ar, 1.5) * 1.8));
}

/* Bildunterschriften ------------------------------------------------------ */

.lbg-gallery .lbg-overlay {
	position: absolute;
	inset: auto 0 0;
	padding: 2.4em 0.85em 0.7em;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
	color: #fff;
	font-size: 0.8125rem;
	line-height: 1.35;
	text-align: left;
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

.lbg-gallery .lbg-overlay-text {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.lbg-gallery .lbg-link:hover .lbg-overlay,
.lbg-gallery .lbg-link:focus-visible .lbg-overlay {
	opacity: 1;
}

/* Ohne Maus gibt es kein Überfahren – Unterschrift dann dauerhaft zeigen. */
@media (hover: none) {
	.lbg-gallery .lbg-overlay {
		opacity: 1;
	}
}

.lbg-gallery .lbg-caption {
	margin: 0;
	padding: 0.5em 0.1em 0.3em;
	font-size: 0.8125rem;
	line-height: 1.4;
	text-align: left;
	opacity: 0.8;
}

/* Hover-Effekte ----------------------------------------------------------- */

@media (hover: hover) {
	.lbg-hover-zoom .lbg-item .lbg-img {
		transition: transform 0.45s cubic-bezier(0.2, 0.6, 0.2, 1);
	}

	.lbg-hover-zoom .lbg-link:hover .lbg-img {
		transform: scale(1.045);
	}

	.lbg-hover-dim .lbg-item .lbg-img {
		transition: filter 0.2s ease;
	}

	.lbg-hover-dim .lbg-link:hover .lbg-img {
		filter: brightness(0.78);
	}
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

html.lbg-lb-open,
html.lbg-lb-open body {
	overflow: hidden !important;
}

.lbg-lb {
	--lbg-bg: #0e0e10;
	--lbg-fg: #f5f5f4;
	--lbg-muted: rgba(245, 245, 244, 0.64);
	--lbg-ui: rgba(255, 255, 255, 0.12);
	--lbg-ui-strong: rgba(255, 255, 255, 0.2);
	--lbg-nav-bg: rgba(24, 24, 27, 0.6);
	--lbg-nav-fg: #fff;
	--lbg-pad: 0px;
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	margin: 0;
	padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
	color: var(--lbg-fg);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: 0;
	text-align: left;
	opacity: 0;
	outline: 0;
	transition: opacity 0.22s ease;
	touch-action: none;
	overscroll-behavior: contain;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	-webkit-text-size-adjust: 100%;
}

.lbg-lb[hidden] {
	display: none;
}

.lbg-lb.is-open {
	opacity: 1;
}

.lbg-lb *,
.lbg-lb *::before,
.lbg-lb *::after {
	box-sizing: border-box;
}

.lbg-lb--light {
	--lbg-bg: #f7f7f5;
	--lbg-fg: #1c1c1f;
	--lbg-muted: rgba(28, 28, 31, 0.66);
	--lbg-ui: rgba(0, 0, 0, 0.08);
	--lbg-ui-strong: rgba(0, 0, 0, 0.16);
	--lbg-nav-bg: rgba(255, 255, 255, 0.78);
	--lbg-nav-fg: #1c1c1f;
}

.lbg-lb .lbg-lb__bg {
	position: absolute;
	inset: 0;
	background: var(--lbg-bg);
	opacity: var(--lbg-fade, 1);
	transition: opacity 0.25s ease;
}

.lbg-lb.is-dragging .lbg-lb__bg {
	transition: none;
}

/* Kopfzeile --------------------------------------------------------------- */

.lbg-lb .lbg-lb__bar {
	position: relative;
	z-index: 3;
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 8px;
	min-height: 52px;
	padding: 4px 6px 4px 18px;
	transition: opacity 0.2s ease;
}

.lbg-lb .lbg-lb__counter {
	color: var(--lbg-muted);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.lbg-lb .lbg-lb__actions {
	display: flex;
	align-items: center;
	gap: 2px;
	margin-left: auto;
}

/* Themes gestalten <button> oft mit hoher Spezifität; deshalb hier bewusst !important. */
.lbg-lb .lbg-lb__btn {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 44px !important;
	height: 44px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--lbg-fg) !important;
	font: inherit;
	line-height: 1 !important;
	text-decoration: none !important;
	text-shadow: none;
	text-transform: none;
	outline: 0 !important;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.lbg-lb .lbg-lb__btn svg {
	display: block;
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	pointer-events: none;
}

@media (hover: hover) {
	.lbg-lb .lbg-lb__btn:hover {
		background: var(--lbg-ui) !important;
	}
}

.lbg-lb .lbg-lb__btn:active {
	background: var(--lbg-ui-strong) !important;
}

.lbg-lb .lbg-lb__btn:focus-visible,
.lbg-lb .lbg-lb__thumb:focus-visible {
	outline: 2px solid var(--lbg-fg) !important;
	outline-offset: -2px;
}

.lbg-lb .lbg-lb__btn[hidden] {
	display: none;
}

.lbg-lb .lbg-lb__btn[aria-disabled="true"] {
	opacity: 0.35;
	cursor: default;
}

/* Bühne ------------------------------------------------------------------- */

.lbg-lb .lbg-lb__main {
	position: relative;
	z-index: 1;
	flex: 1 1 0;
	min-height: 0;
	transform: scale(0.975);
	transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lbg-lb.is-open .lbg-lb__main {
	transform: none;
}

.lbg-lb .lbg-lb__stage {
	position: absolute;
	inset: 0;
	overflow: hidden;
	touch-action: none;
}

.lbg-lb .lbg-lb__track {
	position: absolute;
	inset: 0;
	will-change: transform;
}

.lbg-lb .lbg-lb__track.is-anim {
	transition: transform 0.34s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.lbg-lb .lbg-lb__slide {
	position: absolute;
	inset: 0;
}

.lbg-lb .lbg-lb__slide.is-jump {
	animation: lbg-appear 0.22s ease both;
}

.lbg-lb .lbg-lb__inner {
	position: absolute;
	inset: var(--lbg-pad);
}

.lbg-lb .lbg-lb__inner.is-anim {
	transition: transform 0.25s ease;
}

.lbg-lb .lbg-lb__img {
	position: absolute;
	inset: 0;
	display: block;
	max-width: none;
	max-height: none;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	object-fit: contain;
	transform-origin: center;
	transition: opacity 0.2s ease;
	cursor: default;
	-webkit-user-drag: none;
	-webkit-touch-callout: default;
}

.lbg-lb .lbg-lb__img.is-anim {
	transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.2s ease;
}

.lbg-lb .lbg-lb__slide:not(.is-loaded):not(.has-ph) .lbg-lb__img {
	opacity: 0;
}

.lbg-lb.can-zoom .lbg-lb__slide.is-current.is-loaded .lbg-lb__img {
	cursor: zoom-in;
}

.lbg-lb.is-zoomed .lbg-lb__slide.is-current.is-loaded .lbg-lb__img {
	cursor: grab;
}

.lbg-lb.is-zoomed.is-panning .lbg-lb__slide.is-current .lbg-lb__img {
	cursor: grabbing;
}

.lbg-lb .lbg-lb__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 2px solid var(--lbg-ui-strong);
	border-top-color: var(--lbg-fg);
	border-radius: 50%;
	animation: lbg-spin 0.8s linear infinite, lbg-appear 0.2s 0.35s both;
	pointer-events: none;
}

.lbg-lb .lbg-lb__slide.is-loaded .lbg-lb__spinner,
.lbg-lb .lbg-lb__slide.is-error .lbg-lb__spinner {
	display: none;
}

.lbg-lb .lbg-lb__error {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	color: var(--lbg-muted);
	text-align: center;
}

/* Pfeile ------------------------------------------------------------------ */

.lbg-lb .lbg-lb__nav,
.lbg-lb .lbg-lb__nav:hover,
.lbg-lb .lbg-lb__nav:active {
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 48px !important;
	height: 48px !important;
	margin-top: -24px !important;
	background: var(--lbg-nav-bg) !important;
	color: var(--lbg-nav-fg) !important;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.lbg-lb .lbg-lb__nav--prev {
	left: 14px;
}

.lbg-lb .lbg-lb__nav--next {
	right: 14px;
}

.lbg-lb .lbg-lb__nav[disabled] {
	opacity: 0;
	pointer-events: none;
}

.lbg-lb--single .lbg-lb__nav,
.lbg-lb--single .lbg-lb__counter,
.lbg-lb--single .lbg-lb__btn--play,
.lbg-lb--single .lbg-lb__btn--thumbs {
	display: none !important;
}

/* Auf kleinen Touch-Geräten wird gewischt; die Pfeile bleiben für Screenreader und Tastatur erreichbar. */
@media (max-width: 767px) and (pointer: coarse) {
	.lbg-lb .lbg-lb__nav:not(:focus-visible) {
		opacity: 0;
		pointer-events: none;
	}
}

/* Diashow-Fortschritt ----------------------------------------------------- */

.lbg-lb .lbg-lb__progress {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 3;
	width: 100%;
	height: 2px;
	background: var(--lbg-fg);
	opacity: 0;
	transform: scaleX(0);
	transform-origin: left center;
	pointer-events: none;
}

.lbg-lb.is-playing .lbg-lb__progress.is-run {
	opacity: 0.85;
	animation: lbg-progress var(--lbg-interval, 4s) linear forwards;
}

/* Bildunterschrift -------------------------------------------------------- */

.lbg-lb .lbg-lb__caption {
	position: relative;
	z-index: 3;
	flex: 0 0 auto;
	width: 100%;
	max-width: 860px;
	max-height: 22vh;
	margin: 0 auto;
	padding: 10px 20px 12px;
	overflow-x: hidden;
	overflow-y: auto;
	font-size: 14.5px;
	line-height: 1.45;
	text-align: center;
	text-wrap: balance;
	overflow-wrap: anywhere;
	touch-action: pan-y;
	transition: opacity 0.2s ease;
	-webkit-user-select: text;
	user-select: text;
}

.lbg-lb:not(.has-captions) .lbg-lb__caption {
	display: none;
}

/* Reserviert eine Zeile, damit das Bild beim Blättern nicht springt. */
.lbg-lb.has-captions .lbg-lb__caption {
	min-height: calc(1.45em + 22px);
}

/* Vorschauleiste ---------------------------------------------------------- */

.lbg-lb .lbg-lb__thumbs {
	position: relative;
	z-index: 3;
	display: flex;
	flex: 0 0 auto;
	gap: 6px;
	padding: 4px 12px 12px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
	touch-action: pan-x;
	overscroll-behavior: contain;
	transition: opacity 0.2s ease;
}

.lbg-lb .lbg-lb__thumbs::-webkit-scrollbar {
	display: none;
}

.lbg-lb.is-thumbs-off .lbg-lb__thumbs,
.lbg-lb--single .lbg-lb__thumbs,
.lbg-lb .lbg-lb__thumbs:empty {
	display: none;
}

.lbg-lb .lbg-lb__thumb {
	flex: 0 0 auto;
	width: 64px !important;
	height: 48px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0;
	padding: 0 !important;
	overflow: hidden;
	border: 0 !important;
	border-radius: 5px !important;
	background: var(--lbg-ui) !important;
	box-shadow: none !important;
	opacity: 0.45;
	outline: 0;
	cursor: pointer;
	transition: opacity 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.lbg-lb .lbg-lb__thumb:first-child {
	margin-left: auto;
}

.lbg-lb .lbg-lb__thumb:last-child {
	margin-right: auto;
}

.lbg-lb .lbg-lb__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	pointer-events: none;
}

@media (hover: hover) {
	.lbg-lb .lbg-lb__thumb:hover {
		opacity: 0.8;
	}
}

.lbg-lb .lbg-lb__thumb.is-active {
	opacity: 1;
	outline: 2px solid var(--lbg-fg) !important;
	outline-offset: -2px;
}

/* Hinweis (z. B. „Link kopiert“) ------------------------------------------ */

.lbg-lb .lbg-lb__toast {
	position: absolute;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	left: 50%;
	z-index: 4;
	padding: 9px 16px;
	border-radius: 999px;
	background: var(--lbg-fg);
	color: var(--lbg-bg);
	font-size: 14px;
	white-space: nowrap;
	opacity: 0;
	transform: translate(-50%, 8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.lbg-lb .lbg-lb__toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* Bedienelemente ausgeblendet (Tipp aufs Bild am Touchscreen) ------------- */

.lbg-lb.is-chrome-hidden .lbg-lb__bar,
.lbg-lb.is-chrome-hidden .lbg-lb__caption,
.lbg-lb.is-chrome-hidden .lbg-lb__thumbs,
.lbg-lb.is-chrome-hidden .lbg-lb__nav {
	opacity: 0;
	pointer-events: none;
}

/* Kleine und flache Bildschirme ------------------------------------------- */

@media (max-width: 600px) {
	.lbg-lb .lbg-lb__bar {
		min-height: 48px;
		padding-left: 14px;
	}

	.lbg-lb .lbg-lb__btn:not(.lbg-lb__nav) {
		width: 42px !important;
		height: 42px !important;
	}

	.lbg-lb .lbg-lb__thumb {
		width: 52px !important;
		height: 40px !important;
	}

	.lbg-lb .lbg-lb__caption {
		padding: 8px 16px 10px;
		font-size: 14px;
	}

	.lbg-lb.has-captions .lbg-lb__caption {
		min-height: calc(1.45em + 18px);
	}
}

@media (max-height: 520px) {
	.lbg-lb .lbg-lb__thumbs {
		display: none;
	}

	.lbg-lb .lbg-lb__bar {
		min-height: 44px;
	}

	.lbg-lb .lbg-lb__caption {
		max-height: 3.2em;
		padding-block: 4px 6px;
	}

	.lbg-lb.has-captions .lbg-lb__caption {
		min-height: 0;
	}
}

/* Animationen ------------------------------------------------------------- */

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

@keyframes lbg-appear {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes lbg-progress {
	from {
		transform: scaleX(0);
	}

	to {
		transform: scaleX(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.lbg-gallery .lbg-item .lbg-img,
	.lbg-gallery .lbg-overlay,
	.lbg-lb,
	.lbg-lb .lbg-lb__bg,
	.lbg-lb .lbg-lb__main,
	.lbg-lb .lbg-lb__track.is-anim,
	.lbg-lb .lbg-lb__inner.is-anim,
	.lbg-lb .lbg-lb__img,
	.lbg-lb .lbg-lb__img.is-anim,
	.lbg-lb .lbg-lb__toast {
		transition-duration: 0.01ms !important;
	}

	.lbg-lb .lbg-lb__slide.is-jump {
		animation: none;
	}

	.lbg-hover-zoom .lbg-link:hover .lbg-img {
		transform: none;
	}
}
