/* =========================================================
   Lightbox (template/js/jquery.lightbox.js) im Seiten-Design:
   dunkles Milchglas, animierter Farbverlauf hinter dem Bild,
   runde Knöpfe, Zähler. Wischen/Tastatur: lightbox-swipe.js
   ========================================================= */

#lightbox {
	position: fixed !important;
	inset: 0 !important;
	z-index: 1000 !important;
	background: rgba(0, 0, 0, .9) !important;
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	overflow: hidden;
	touch-action: pan-y;
	-webkit-tap-highlight-color: transparent;
}

/* Bunter, langsam drehender Lichtschein hinter dem Bild */
#lightbox::before {
	content: "";
	grid-area: 1 / 1;
	width: min(78vw, 760px);
	height: min(78vw, 760px);
	border-radius: 42% 58% 55% 45% / 50% 44% 56% 50%;
	background: conic-gradient(from 0deg, #22a6de, #7c4dff, #ff3d7f, #ffc928, #22a6de);
	filter: blur(70px);
	opacity: .38;
	animation: cmLbSchein 18s linear infinite;
	pointer-events: none;
	z-index: 0;
}

@keyframes cmLbSchein {
	from { transform: rotate(0deg) scale(1); }
	50%  { transform: rotate(180deg) scale(1.08); }
	to   { transform: rotate(360deg) scale(1); }
}

#lightbox > img {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 1400px) !important;
	max-height: 82vh !important;
	width: auto !important;
	height: auto !important;
	border-radius: 18px;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 30px 90px rgba(0, 0, 0, .75);
	background: #111;
	user-select: none;
	-webkit-user-drag: none;
	will-change: transform;
}

#lightbox > img.cm-lb-ziehen { transition: none !important; }
#lightbox > img.cm-lb-zurueck { transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s ease; }

#lightbox > img.cm-lb-von-rechts { animation: cmLbVonRechts .45s cubic-bezier(.2, .8, .2, 1); }
#lightbox > img.cm-lb-von-links  { animation: cmLbVonLinks .45s cubic-bezier(.2, .8, .2, 1); }

@keyframes cmLbVonRechts { from { opacity: 0; transform: translateX(60px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cmLbVonLinks  { from { opacity: 0; transform: translateX(-60px) scale(.97); } to { opacity: 1; transform: none; } }

/* Schließen */
#lightbox .lightbox-close {
	position: fixed !important;
	top: 22px !important;
	right: 22px !important;
	left: auto !important;
	z-index: 3;
	width: 48px !important;
	height: 48px !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	margin: 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: 1.5px solid rgba(255, 255, 255, .8) !important;
	background: rgba(0, 0, 0, .55) !important;
	color: #fff !important;
	font-size: 26px !important;
	line-height: 1 !important;
	text-decoration: none !important;
	transition: background .25s, color .25s, transform .35s cubic-bezier(.3, 1.6, .5, 1);
}

#lightbox .lightbox-close:hover,
#lightbox .lightbox-close:focus-visible {
	background: #fff !important;
	color: #000 !important;
	transform: rotate(90deg);
	outline: none;
}

/* Vor / Zurück: runde Knöpfe mit Pfeil */
#lightbox .controls {
	position: static !important;
	display: contents !important;
}

#lightbox #prev,
#lightbox #next {
	position: fixed !important;
	top: 50% !important;
	z-index: 3;
	width: 56px !important;
	height: 56px !important;
	margin: -28px 0 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: 1.5px solid rgba(255, 255, 255, .8) !important;
	background: rgba(0, 0, 0, .55) !important;
	color: transparent !important;
	font-size: 0 !important;
	text-decoration: none !important;
	transition: background .25s, transform .25s;
}

#lightbox #prev { left: 22px !important; right: auto !important; }
#lightbox #next { right: 22px !important; left: auto !important; }

#lightbox #prev::before,
#lightbox #next::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 13px;
	height: 13px;
	border-left: 2.5px solid #fff;
	border-top: 2.5px solid #fff;
	transition: border-color .25s;
}

#lightbox #prev::before { transform: translate(-30%, -50%) rotate(-45deg); }
#lightbox #next::before { transform: translate(-70%, -50%) rotate(135deg); }

#lightbox #prev:hover,
#lightbox #next:hover {
	background: #fff !important;
}

#lightbox #prev:hover { transform: translateX(-3px); }
#lightbox #next:hover { transform: translateX(3px); }

#lightbox #prev:hover::before,
#lightbox #next:hover::before { border-color: #000; }

/* Zähler „3 / 12“ */
#lightbox .cm-lb-zaehler {
	position: fixed;
	top: 30px;
	left: 50%;
	z-index: 3;
	transform: translateX(-50%);
	padding: 7px 16px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, .35);
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .12em;
	pointer-events: none;
}

/* Wisch-Hinweis auf dem Handy (nur kurz beim ersten Öffnen) */
#lightbox .cm-lb-hinweis {
	position: fixed;
	bottom: 104px;
	left: 50%;
	z-index: 3;
	transform: translateX(-50%);
	padding: 8px 16px;
	border-radius: 999px;
	background: #fff;
	color: #000;
	font-size: 13px;
	font-weight: 800;
	white-space: nowrap;
	pointer-events: none;
	animation: cmLbHinweis 3.2s ease forwards;
}

@keyframes cmLbHinweis {
	0%   { opacity: 0; transform: translate(-50%, 10px); }
	12%  { opacity: 1; transform: translate(-50%, 0); }
	80%  { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -6px); }
}

/* Handy: Bild größer, Pfeile unten nebeneinander für den Daumen */
@media (max-width: 700px) {
	#lightbox > img {
		max-width: 94vw !important;
		max-height: 70vh !important;
		border-radius: 14px;
	}

	#lightbox .lightbox-close { top: 16px !important; right: 16px !important; width: 44px !important; height: 44px !important; }
	#lightbox .cm-lb-zaehler { top: 24px; }

	#lightbox #prev,
	#lightbox #next {
		top: auto !important;
		bottom: 34px !important;
		margin: 0 !important;
		width: 52px !important;
		height: 52px !important;
	}

	#lightbox #prev { left: calc(50% - 64px) !important; }
	#lightbox #next { right: calc(50% - 64px) !important; }
}

@media (prefers-reduced-motion: reduce) {
	#lightbox::before,
	#lightbox > img,
	#lightbox .cm-lb-hinweis { animation: none !important; }
}

html.cm-lb-offen,
html.cm-lb-offen body { overflow: hidden !important; }
