/* MoSeven + · Video Stack Cards */

.msp-vsc {
	/* Werte kommen aus den Elementor-Controls, hier stehen die Standards. */
	--msp-count: 1;
	--msp-top: 0px;
	--msp-step: 100vh;
	--msp-start: 75;
	--msp-card-height: 80%;
	--msp-btn-size: 56px;
	--msp-btn-icon: 22px;
	--msp-btn-offset: 28px;
	--msp-btn-gap: 12px;
	--msp-panel-w: 34%;
	--msp-close-icon: 22px;
	--msp-scroll-thumb: rgba(255, 255, 255, 0.45);
	--msp-stage-h: calc(100vh - var(--msp-top));

	/* Buttons: Lage, Richtung und reservierter Platz im Text. Standard: unten rechts, nebeneinander.
	   Position und Anordnung setzen diese Variablen je Gerät. */
	--msp-act-top: auto;
	--msp-act-right: var(--msp-off-right, var(--msp-btn-offset));
	--msp-act-bottom: var(--msp-off-bottom, var(--msp-btn-offset));
	--msp-act-left: auto;
	--msp-act-row: row-reverse;
	--msp-act-col: column-reverse;
	--msp-act-x: var(--msp-off-right, var(--msp-btn-offset));
	--msp-act-y: var(--msp-off-bottom, var(--msp-btn-offset));
	--msp-res-l: 0;
	--msp-res-r: 1;
	--msp-res-t: 0;
	--msp-res-b: 1;
	--msp-act-dir: var(--msp-act-row);
	--msp-res-x: 0px;
	--msp-res-y: 0px;

	position: relative;
	width: 100%;
	/* Scrollstrecke: eine Bühnenhöhe plus eine Strecke je weiterer Karte. */
	height: calc(var(--msp-stage-h) + (var(--msp-count) - 1) * var(--msp-step));
}

@supports (height: 100dvh) {
	.msp-vsc {
		--msp-stage-h: calc(100dvh - var(--msp-top));
	}
}

/* Bühne: bleibt während der gesamten Scrollstrecke fixiert. */
.msp-vsc__stage {
	position: sticky;
	top: var(--msp-pin-top, var(--msp-top));
	height: var(--msp-stage-h);
	overflow: hidden;
	display: grid;
	grid-template: minmax(0, 1fr) / minmax(0, 1fr);
	place-items: center;
}

/* Ersatz, falls ein übergeordnetes Element position: sticky verhindert.
   Das Skript verschiebt die Bühne dann selbst. */
.msp-vsc.is-pin-fallback .msp-vsc__stage {
	position: relative;
	top: 0;
	will-change: transform;
}

/* Karten liegen deckungsgleich in derselben Rasterzelle, exakt mittig. */
.msp-vsc__card {
	grid-area: 1 / 1;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	height: var(--msp-card-height);
	max-height: 100%;
	overflow: hidden;
	border-radius: 12px;
	background-color: #111;
	transform-origin: 50% 50%;
	will-change: transform, opacity;
	backface-visibility: hidden;
	isolation: isolate;
}

/* Bis das Skript läuft, ist nur die erste Karte sichtbar. */
.msp-vsc__card:not(:first-child) {
	visibility: hidden;
}

/* Doppelte Klasse, damit globale Regeln wie „.elementor img { height: auto; }"
   das Bild ohne Video nicht auf seine natürliche Höhe zurücksetzen. */
.msp-vsc .msp-vsc__video {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center;
	border: 0;
}

/* Posterbild liegt über dem Video und füllt die Karte genauso wie das Video.
   Sobald das Video läuft, blendet es aus. */
.msp-vsc .msp-vsc__poster {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	object-fit: cover;
	object-position: center;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	pointer-events: none;
	opacity: 1;
	transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.msp-vsc__card.is-video-started .msp-vsc__poster {
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.msp-vsc__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

.msp-vsc__content {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	padding: clamp(20px, 4vw, 56px);
	/* Platz für die Buttons: durchsichtiger Rand auf der Seite, an der sie sitzen. So bricht der Text
	   vor den Buttons um, unabhängig vom eingestellten Innenabstand. */
	border: 0 solid transparent;
	border-width:
		calc(var(--msp-res-y) * var(--msp-res-t))
		calc(var(--msp-res-x) * var(--msp-res-r))
		calc(var(--msp-res-y) * var(--msp-res-b))
		calc(var(--msp-res-x) * var(--msp-res-l));
	color: #fff;
	text-align: left;
	pointer-events: none;
}

.msp-vsc .msp-vsc__content > * {
	max-width: 100%;
	margin-top: 0;
	/* Ein einzelnes Wort, das breiter ist als der Platz, bricht um, statt abgeschnitten zu werden. */
	overflow-wrap: break-word;
}

.msp-vsc .msp-vsc__pretext {
	margin: 0 0 0.6em;
	font-size: clamp(0.875rem, 1.1vw, 1.125rem);
	line-height: 1.3;
}

.msp-vsc .msp-vsc__title {
	margin: 0 0 0.25em;
	color: inherit;
	font-size: clamp(2rem, 7vw, 6.5rem);
	font-weight: 800;
	line-height: 1;
}

.msp-vsc .msp-vsc__subtext {
	margin: 0;
	font-size: clamp(1rem, 1.4vw, 1.375rem);
	line-height: 1.4;
}

.msp-vsc .msp-vsc__content > :last-child {
	margin-bottom: 0;
}

/* Inhalt boxed: Text und Buttons in zentrierter Box, das Video bleibt voll breit. */
.msp-boxed-yes .msp-vsc__content {
	left: 50%;
	right: auto;
	box-sizing: border-box;
	width: min(100%, var(--msp-box-w, 1200px));
	transform: translateX(-50%);
}

.msp-boxed-yes .msp-vsc .msp-vsc__actions {
	/* Prozentwerte beziehen sich auf die Kartenbreite: schiebt die Buttons in die Box. */
	margin-left: max(0px, calc((100% - var(--msp-box-w, 1200px)) / 2));
	margin-right: max(0px, calc((100% - var(--msp-box-w, 1200px)) / 2));
}

/* Bilder über und unter dem Titel: feste Höhe, Breite proportional. */
.msp-vsc .msp-vsc__img-wrap {
	display: block;
	flex: none;
	max-width: 100%;
	margin: 0;
	line-height: 0;
}

.msp-vsc .msp-vsc__img-wrap--above {
	margin-bottom: 0.6em;
}

.msp-vsc .msp-vsc__img-wrap--below {
	margin-top: 0.4em;
	margin-bottom: 0.6em;
}

/* Der Textbereich lässt Klicks zum Video durch, verlinkte Bilder bleiben klickbar. */
.msp-vsc a.msp-vsc__img-wrap {
	pointer-events: auto;
	text-decoration: none;
	box-shadow: none;
}

.msp-vsc a.msp-vsc__img-wrap:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 4px;
}

.msp-vsc .msp-vsc__img {
	display: block;
	width: auto;
	max-width: 100%;
	height: 48px;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: contain;
	transition: opacity 0.2s ease;
}

/* Buttons (Ton & Info): gemeinsame Leiste in einer Ecke der Karte */
.msp-vsc__actions {
	position: absolute;
	top: var(--msp-act-top);
	right: var(--msp-act-right);
	bottom: var(--msp-act-bottom);
	left: var(--msp-act-left);
	z-index: 3;
	display: flex;
	flex-direction: var(--msp-act-dir); /* Ton-Button in der Ecke, die anderen daneben oder darüber */
	align-items: center;
	gap: var(--msp-btn-gap);
}

.msp-vsc .msp-vsc__btn,
.msp-vsc .msp-vsc__btn:hover,
.msp-vsc .msp-vsc__btn:focus,
.msp-vsc .msp-vsc__btn:active,
.msp-vsc .msp-vsc__panel-close,
.msp-vsc .msp-vsc__panel-close:hover,
.msp-vsc .msp-vsc__panel-close:focus,
.msp-vsc .msp-vsc__panel-close:active {
	/* Setzt Rahmen, Innenabstand und Schatten zurück, die Theme oder
	   Elementor-Website-Einstellungen allen Buttons geben. Eigene Werte
	   stellst du in den Stil-Controls des Widgets ein. */
	box-sizing: border-box;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0 none;
	border-radius: 50%;
	box-shadow: none;
	text-decoration: none;
	text-transform: none;
}

.msp-vsc .msp-vsc__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: var(--msp-btn-size);
	height: var(--msp-btn-size);
	background-color: #161a18;
	color: #fff;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.msp-vsc .msp-vsc__btn:hover,
.msp-vsc .msp-vsc__btn:focus-visible {
	background-color: #2b322e;
	color: #fff;
}

.msp-vsc__btn:focus-visible,
.msp-vsc__panel-close:focus-visible,
.msp-vsc__panel-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.msp-vsc__btn:active {
	transform: scale(0.94);
}

.msp-vsc__icon {
	width: var(--msp-btn-icon);
	height: var(--msp-btn-icon);
	flex: none;
	pointer-events: none;
}

.msp-vsc__icon--on,
.msp-vsc__sound[aria-pressed="true"] .msp-vsc__icon--off {
	display: none;
}

.msp-vsc__sound[aria-pressed="true"] .msp-vsc__icon--on {
	display: block;
}

/* Lightbox-Button: Standard nur auf Mobil sichtbar (je Gerät in den Optionen einstellbar). */
.msp-vsc .msp-vsc__btn.msp-vsc__expand {
	display: none;
}

@media (max-width: 767px) {
	.msp-vsc .msp-vsc__btn.msp-vsc__expand {
		display: inline-flex;
	}
}

/* Info-Panel: schiebt sich von links über das Video */
.msp-vsc__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 4;
	display: flex;
	flex-direction: column;
	width: var(--msp-panel-w);
	min-width: min(100%, 300px);
	max-width: 100%;
	background-color: rgba(10, 12, 22, 0.86);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: #fff;
	transform: translate3d(-101%, 0, 0);
	visibility: hidden;
	touch-action: pan-y; /* senkrecht scrollen, waagerecht wischen zum Schließen */
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.45s;
}

.msp-vsc__panel.is-open {
	transform: translate3d(0, 0, 0);
	visibility: visible;
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

/* Während des Wischens folgt das Panel dem Finger ohne Verzögerung. */
.msp-vsc__panel.is-dragging {
	transition: none;
}

/* Kopfzeile mit Schließen-Button: bleibt stehen, nur der Inhalt darunter scrollt. */
.msp-vsc__panel-head {
	flex: none;
	display: flex;
	justify-content: flex-start;
	/* Abstand des Schließen-Buttons nach oben und links (Stil → Info-Panel) */
	padding: var(--msp-close-top, 12px) 12px 0 var(--msp-close-left, 12px);
}

.msp-vsc .msp-vsc__panel-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background-color: transparent;
	color: #fff;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.msp-vsc .msp-vsc__panel-close:hover,
.msp-vsc .msp-vsc__panel-close:focus-visible {
	background-color: transparent;
	color: #fff;
	transform: scale(1.12);
}

.msp-vsc__panel-close svg {
	width: var(--msp-close-icon);
	height: var(--msp-close-icon);
	pointer-events: none;
}

.msp-vsc__panel-scroll {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 16px clamp(20px, 2.4vw, 36px) clamp(24px, 3vw, 44px);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

/* Scrollbar: nur der Balken ist sichtbar, die Schiene dahinter ist transparent. */
@supports (scrollbar-color: auto) {
	.msp-vsc__panel-scroll {
		scrollbar-width: thin;
		scrollbar-color: var(--msp-scroll-thumb) transparent;
	}
}

.msp-vsc__panel-scroll::-webkit-scrollbar {
	width: 6px;
	background: transparent;
}

.msp-vsc__panel-scroll::-webkit-scrollbar-track,
.msp-vsc__panel-scroll::-webkit-scrollbar-corner {
	background: transparent;
}

.msp-vsc__panel-scroll::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background-color: var(--msp-scroll-thumb);
}

/* margin: auto statt justify-content, damit überlanger Inhalt oben nicht abgeschnitten wird. */
.msp-vsc__panel-inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin-top: auto;
	margin-bottom: 0;
	text-align: left;
}

.msp-vsc .msp-vsc__panel-inner > * {
	max-width: 100%;
	margin-top: 0;
}

.msp-vsc .msp-vsc__panel-image {
	display: block;
	width: 160px;
	height: auto;
	margin: 0 0 20px;
	border-radius: 0;
}

.msp-vsc .msp-vsc__panel-title {
	margin: 0 0 0.6em;
	color: inherit;
	font-size: clamp(1.5rem, 2.4vw, 2.5rem);
	font-weight: 600;
	line-height: 1.1;
}

.msp-vsc .msp-vsc__panel-text {
	margin: 0 0 1.6em;
	font-size: 1rem;
	line-height: 1.65;
}

.msp-vsc .msp-vsc__panel-text > :first-child {
	margin-top: 0;
}

.msp-vsc .msp-vsc__panel-text > :last-child {
	margin-bottom: 0;
}

.msp-vsc .msp-vsc__panel-button {
	display: inline-block;
	padding: 0.85em 1.8em;
	border-radius: 999px;
	background-color: #fff;
	color: #111;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.msp-vsc a.msp-vsc__panel-button:hover,
.msp-vsc a.msp-vsc__panel-button:focus-visible {
	background-color: #e6e6e6;
	color: #111;
}

.msp-vsc .msp-vsc__panel-inner > :last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------ Lightbox
   Hängt direkt am <body> und liegt über der ganzen Seite. */
html.msp-vsc-lightbox-open {
	overflow: hidden;
}

.msp-vsc-lightbox {
	--msp-lb-bg: rgba(0, 0, 0, 0.92);
	--msp-lb-close: #fff;
	--msp-lb-close-size: 24px;
	--msp-lb-r: 1.7778;
	--msp-lb-ar: 16 / 9;
	--msp-lb-pad-x: 0px;
	--msp-lb-pad-y: 64px;

	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: var(--msp-lb-pad-y) var(--msp-lb-pad-x);
	background-color: var(--msp-lb-bg);
	opacity: 0;
	overscroll-behavior: contain;
	touch-action: none;
	transition: opacity 0.28s ease;
}

.msp-vsc-lightbox.is-open {
	opacity: 1;
}

/* Originalformat: so groß wie möglich, ohne Beschnitt. */
.msp-vsc-lightbox .msp-vsc-lightbox__video {
	display: block;
	width: min(100vw - 2 * var(--msp-lb-pad-x), (100vh - 2 * var(--msp-lb-pad-y)) * var(--msp-lb-r));
	max-width: 100%;
	height: auto;
	max-height: 100%;
	margin: 0;
	aspect-ratio: var(--msp-lb-ar);
	border: 0;
	border-radius: 0;
	background-color: #000;
	object-fit: contain;
	transform: scale(0.96);
	transition: transform 0.28s ease;
}

@supports (height: 100dvh) {
	.msp-vsc-lightbox .msp-vsc-lightbox__video {
		width: min(100vw - 2 * var(--msp-lb-pad-x), (100dvh - 2 * var(--msp-lb-pad-y)) * var(--msp-lb-r));
	}
}

.msp-vsc-lightbox.is-open .msp-vsc-lightbox__video {
	transform: scale(1);
}

.msp-vsc-lightbox .msp-vsc-lightbox__close,
.msp-vsc-lightbox .msp-vsc-lightbox__close:hover,
.msp-vsc-lightbox .msp-vsc-lightbox__close:focus,
.msp-vsc-lightbox .msp-vsc-lightbox__close:active {
	position: absolute;
	top: max(10px, env(safe-area-inset-top));
	right: max(10px, env(safe-area-inset-right));
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 44px;
	min-width: 0;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0 none;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: var(--msp-lb-close);
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.msp-vsc-lightbox .msp-vsc-lightbox__close svg {
	width: var(--msp-lb-close-size);
	height: var(--msp-lb-close-size);
	pointer-events: none;
	transition: transform 0.2s ease;
}

.msp-vsc-lightbox .msp-vsc-lightbox__close:hover svg {
	transform: scale(1.15);
}

.msp-vsc-lightbox .msp-vsc-lightbox__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (min-width: 768px) {
	.msp-vsc-lightbox {
		--msp-lb-pad-x: 4vw;
	}
}

@media (max-width: 1024px) {
	.msp-vsc {
		--msp-panel-w: 55%;
	}
}

@media (max-width: 767px) {
	.msp-vsc {
		--msp-btn-size: 44px;
		--msp-btn-icon: 18px;
		--msp-btn-offset: 16px;
		--msp-btn-gap: 8px;
		--msp-panel-w: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.msp-vsc .msp-vsc__poster {
		transition: none;
	}

	.msp-vsc-lightbox,
	.msp-vsc-lightbox .msp-vsc-lightbox__video,
	.msp-vsc-lightbox .msp-vsc-lightbox__close svg,
	.msp-vsc__btn,
	.msp-vsc__panel,
	.msp-vsc__panel.is-open,
	.msp-vsc__panel-close,
	.msp-vsc__panel-button {
		transition: none;
	}
}
