/*
 * Fluid Morph Gallery 62 - Frontend Styles
 * Beinhaltet: Layout, Lightbox, Progress-Indikator, Reduced-Motion-Fallback,
 * responsive Portrait/Landscape-Umschaltung und Fokus-Indikatoren.
 */

.fmg62-gallery {
	position: relative;
	width: 100%;
	height: 100vh;
	overflow: hidden;
	background: #05070a;
	outline: none;
	touch-action: pan-y;
}

.fmg62-gallery:focus-visible {
	outline: 3px solid #4dd0e1;
	outline-offset: -3px;
}

.fmg62-gallery__canvas-wrap {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.fmg62-gallery__canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

/* CSS-Fallback (kein WebGL / prefers-reduced-motion) */
.fmg62-gallery__css-fallback {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background-size: cover;
	background-position: center;
	transition: opacity 0.6s ease, filter 0.6s ease;
}

.fmg62-gallery__slides {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.fmg62-slide {
	margin: 0;
	position: absolute;
	inset: 0;
}

.fmg62-slide img,
.fmg62-slide video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Overlay-Texte */
.fmg62-overlay {
	position: absolute;
	left: 5%;
	bottom: 8%;
	max-width: 640px;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	color: #fff;
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.6s ease, transform 0.6s ease;
	z-index: 3;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.fmg62-gallery.fmg62-is-active .fmg62-overlay--current {
	opacity: 1;
	transform: translateY(0);
}

.fmg62-overlay__title {
	font-size: clamp(1.5rem, 3vw, 2.75rem);
	font-weight: 700;
	line-height: 1.15;
}

.fmg62-overlay__text {
	font-size: clamp(0.95rem, 1.4vw, 1.15rem);
	font-weight: 400;
	opacity: 0.9;
}

/* Progress-Indikator */
.fmg62-progress {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: rgba(255, 255, 255, 0.2);
	z-index: 5;
}

.fmg62-progress__bar {
	height: 100%;
	width: 0%;
	background: #ffffff;
	transition: width linear;
}

/* Steuerungselemente */
.fmg62-controls {
	position: absolute;
	right: 5%;
	bottom: 6%;
	display: flex;
	gap: 0.75rem;
	z-index: 6;
}

.fmg62-controls button {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.4);
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 1.1rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	backdrop-filter: blur(6px);
	transition: background 0.25s ease, transform 0.25s ease;
}

.fmg62-controls button:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: translateY(-2px);
}

.fmg62-controls button:focus-visible,
.fmg62-lightbox button:focus-visible {
	outline: 3px solid #4dd0e1;
	outline-offset: 2px;
}

.fmg62-icon-pause::before {
	content: "\275A\275A";
	font-size: 0.85rem;
	letter-spacing: 2px;
}

.fmg62-controls__playpause[aria-pressed="false"] .fmg62-icon-pause::before {
	content: "\25B6";
}

/* Lightbox */
.fmg62-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(3, 4, 6, 0.96);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fmg62-lightbox[hidden] {
	display: none;
}

.fmg62-lightbox__stage {
	max-width: 92vw;
	max-height: 88vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fmg62-lightbox__image,
.fmg62-lightbox__video {
	max-width: 92vw;
	max-height: 88vh;
	object-fit: contain;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.fmg62-lightbox__close,
.fmg62-lightbox__prev,
.fmg62-lightbox__next,
.fmg62-lightbox__share {
	position: absolute;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.3);
	color: #fff;
	cursor: pointer;
	border-radius: 999px;
}

.fmg62-lightbox__close {
	top: 20px;
	right: 20px;
	width: 44px;
	height: 44px;
	font-size: 1.5rem;
	line-height: 1;
}

.fmg62-lightbox__prev {
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
}

.fmg62-lightbox__next {
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
}

.fmg62-lightbox__share {
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	padding: 0.6rem 1.2rem;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.9rem;
}

/* Screenreader-only Hilfstext */
.fmg62-sr-instructions {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Vordergrund-Ebene (Multi-Layer-Morph, CSS-Fallback-Darstellung) */
.fmg62-gallery__foreground {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	z-index: 2;
}

/* Partikel-Ebene */
.fmg62-gallery__particles {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 4;
}

/* Split-Screen / Vergleichsmodus */
.fmg62-gallery--split {
	--fmg62-split-position: 50%;
}

.fmg62-gallery__canvas-wrap--split-b {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	clip-path: inset( 0 0 0 var( --fmg62-split-position ) );
	z-index: 1;
}

.fmg62-split-divider {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var( --fmg62-split-position );
	width: 4px;
	margin-left: -2px;
	background: rgba(255, 255, 255, 0.85);
	cursor: ew-resize;
	z-index: 7;
	touch-action: none;
}

.fmg62-split-divider:focus-visible {
	outline: 3px solid #4dd0e1;
	outline-offset: 2px;
}

.fmg62-split-divider__handle {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.fmg62-split-divider__handle::before,
.fmg62-split-divider__handle::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 0;
	height: 0;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
}

.fmg62-split-divider__handle::before {
	left: 10px;
	border-right: 8px solid #333;
	transform: translateY(-50%);
}

.fmg62-split-divider__handle::after {
	right: 10px;
	border-left: 8px solid #333;
	transform: translateY(-50%);
}

/* Poster-/LQIP-Platzhalter: initial unscharf, wird per JS beim Laden des
   Vollbilds sanft entfernt (Klasse/Attribut data-fmg62-poster). */
.fmg62-gallery__css-fallback[data-fmg62-poster] {
	transform: scale(1.04);
}


@media (max-width: 767px) {
	.fmg62-gallery {
		height: 70vh;
	}

	.fmg62-overlay {
		left: 6%;
		bottom: 12%;
		max-width: 88%;
	}

	.fmg62-controls {
		right: 6%;
		bottom: 4%;
	}
}

@media (orientation: portrait) and (max-width: 480px) {
	.fmg62-gallery {
		height: 100svh;
	}
}

@media (orientation: landscape) and (max-height: 480px) {
	.fmg62-gallery {
		height: 100vh;
	}

	.fmg62-controls {
		bottom: 10%;
	}
}

/* Reduced motion: WebGL/GSAP wird per JS deaktiviert, hier nur CSS-Crossfade */
@media (prefers-reduced-motion: reduce) {
	.fmg62-gallery__css-fallback,
	.fmg62-overlay {
		transition-duration: 0.15s !important;
	}

	.fmg62-gallery * {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

/* Editor-Preview (Elementor Backend) */
.fmg62-gallery--editor-preview {
	height: 480px;
}

/* Low-end Fallback Klasse (wird per JS gesetzt) */
.fmg62-gallery.fmg62-low-end .fmg62-gallery__canvas {
	display: none;
}

.fmg62-gallery.fmg62-low-end .fmg62-gallery__css-fallback {
	filter: saturate(1.05) contrast(1.02);
}
