/*
 * VARIO Seasonal Themes – Basis
 *
 * Wird nur geladen, wenn auf der Startseite ein Seasonal Theme aktiv ist.
 * Ohne aktives Theme existiert keine dieser Regeln auf der Seite.
 *
 * Ebenen-Prinzip
 * --------------
 * Die Dekoration sitzt als erstes Kind in ihrer Section und liegt mit
 * z-index: -1 in einem eigenen Stapelkontext (isolation: isolate). Damit
 * malt der Browser sie über den Section-Hintergrund, aber unter jeden Inhalt:
 * Text, Buttons, Film und Karten bleiben immer obenauf, ohne dass ein
 * bestehendes Element umgestellt wird. Die Ebene ist absolut positioniert,
 * nimmt keinen Platz ein (kein Layout Shift) und fängt keine Klicks ab.
 *
 * Elemente (.vs-item) bringen ihre Werte als Variablen 0…1 mit:
 *   --vs-x, --vs-y, --vs-size, --vs-delay, --vs-speed, --vs-rot
 *   --vs-side (0 links / 1 rechts), --vs-sx (0 außen … 1 innen)
 * Die Theme-Datei rechnet daraus Größe, Position und Tempo. Für Deko nur an
 * den Rändern:
 *   left: calc(var(--vs-side) * (100% - var(--vs-band))
 *        + var(--vs-sx) * (var(--vs-band) - <Elementbreite>));
 */

:root {
	--vs-greeny: #84b933;
	--vs-berry: #8c2952;
	--vs-dark: #2e2e2e;
	--vs-white: #ffffff;
}

/* Sections, die eine Ebene tragen. :has() greift nur dort, wo das Plugin
 * tatsächlich eine Ebene gesetzt hat. */
.vario-section:has(> .vario-seasonal-decoration) {
	position: relative;
	isolation: isolate;
}

.vario-seasonal-decoration {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	border-radius: inherit; /* abgerundete Sections (radius="1", Karten) sauber beschneiden */
	pointer-events: none;
	user-select: none;
	contain: strict;

	/* Mitte frei halten: Die Deko gehört an die Ränder, nicht über Headline,
	 * Buttons und Film. Themes können --vs-clear (Breite der freien Mitte)
	 * anpassen oder die Maske ganz abschalten.
	 * Oben und unten blenden --vs-fade-top / --vs-fade-bottom weich aus
	 * (Standard 0 = keine Blende), damit z. B. fallender Schnee am Ende der
	 * Section nicht hart abreißt. */
	--vs-clear: 1120px;
	--vs-feather-out: 80px;
	--vs-feather-in: 40px;
	--vs-fade-top: 0px;
	--vs-fade-bottom: 0px;

	/* Breite eines Randstreifens (links bzw. rechts der freien Mitte). Themes
	 * positionieren Rand-Deko damit über --vs-side und --vs-sx. */
	--vs-band: max(56px, calc((100% - var(--vs-clear)) / 2 + var(--vs-feather-in)));

	--vs-mask-x: linear-gradient(
		to right,
		#000 0,
		#000 calc(50% - var(--vs-clear) / 2 - var(--vs-feather-out)),
		transparent calc(50% - var(--vs-clear) / 2 + var(--vs-feather-in)),
		transparent calc(50% + var(--vs-clear) / 2 - var(--vs-feather-in)),
		#000 calc(50% + var(--vs-clear) / 2 + var(--vs-feather-out)),
		#000 100%
	);
	--vs-mask-y: linear-gradient(
		to bottom,
		transparent 0,
		#000 var(--vs-fade-top),
		#000 calc(100% - var(--vs-fade-bottom)),
		transparent 100%
	);
	-webkit-mask-image: var(--vs-mask-x), var(--vs-mask-y);
	-webkit-mask-composite: source-in;
	mask-image: var(--vs-mask-x), var(--vs-mask-y);
	mask-composite: intersect;
}

.vario-seasonal-decoration .vs-item {
	position: absolute;
	left: calc(var(--vs-x) * 100%);
	top: calc(var(--vs-y) * 100%);
	display: block;
	pointer-events: none;
}

/* Figuren-Ebene ('figure' => true in der Config): ganz ohne Maske, damit
 * eine einzelne Figur nicht am Rand der freien Mitte ausgeblendet wird. Die
 * Theme-CSS platziert die Figur als ::before und blendet die Ebene auf
 * kleinen Bildschirmen aus. */
.vario-seasonal-decoration--figure {
	-webkit-mask-image: none;
	mask-image: none;
}

/* Kleine Desktops: Figur kleiner und näher an den Rand, damit sie auch neben
 * längeren Hero-Texten frei steht. Themes rechnen ihre Breite mit --vs-fig. */
@media (min-width: 1200px) and (max-width: 1439.98px) {
	.vario-seasonal-decoration--figure {
		--vs-fig: 0.75;
	}
}

/* Akzent-Ebenen in späteren Sections: ohne Mittelmaske. */
.vario-seasonal-decoration--accent {
	--vs-mask-x: linear-gradient(#000, #000);
}

/* -------------------------------------------------------------------------
 * Geräte: Desktop ab 1200 px voll, Tablet reduziert, Mobil deutlich weniger.
 * ------------------------------------------------------------------------- */

@media (max-width: 1199.98px) {
	.vario-seasonal-decoration .vs-from-desktop {
		display: none;
	}

	/* Relativ zur Breite, sonst wäre die freie Mitte auf kleinen Tablets
	 * breiter als der Bildschirm und die Maske verschluckte alles. */
	.vario-seasonal-decoration {
		--vs-clear: min(820px, 76vw);
	}
}

@media (max-width: 767.98px) {
	.vario-seasonal-decoration .vs-from-tablet {
		display: none;
	}

	/* Auf dem Handy gibt es keine freien Ränder: Die Maske lässt nur einen
	 * schmalen Streifen außen stehen (je etwa 20 % der Breite), die Theme-Datei hält die Elemente klein
	 * und leise. */
	.vario-seasonal-decoration {
		--vs-clear: 60vw;
		--vs-feather-out: 24px;
		--vs-feather-in: 8px;
	}

	.vario-seasonal-decoration--accent {
		display: none;
	}
}

/* -------------------------------------------------------------------------
 * Bewegung reduzieren: alles steht still, die Deko bleibt sichtbar.
 * ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.vario-seasonal-decoration,
	.vario-seasonal-decoration::before,
	.vario-seasonal-decoration::after,
	.vario-seasonal-decoration *,
	.vario-seasonal-decoration *::before,
	.vario-seasonal-decoration *::after {
		animation: none !important;
		transition: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Logo-Schmuck (nur mit Body-Klasse vario-season-logo)
 *
 * Das grüne Logo-Bild bleibt im DOM (Alt-Text, Link, Maße), wird nur
 * unsichtbar. Darüber liegt das saisonale SVG als Pseudo-Element in exakt
 * derselben Position. Die SVG-Fläche ist größer als das Logo (10 px oben,
 * 20 px rechts bei 30 px Logohöhe), deshalb die Prozentwerte:
 *   top    = -14.9 / 45.3   der Logohöhe
 *   height =  60.2 / 45.3
 *   width  = 214.7 / 184.9  der Logobreite
 * Prozentwerte skalieren mit, wenn das Theme das Logo mobil auf 25 px setzt.
 * Das Pseudo-Element nimmt keinen Platz ein und fängt keine Klicks ab.
 * Das Bild (Daten-URI) setzt das Plugin inline.
 *
 * Über Berry-Sections zeigt das Theme das weiße Logo. Dort bleibt es ohne
 * Schmuck: Das saisonale Logo blendet sich mit aus.
 * ------------------------------------------------------------------------- */

.vario-season-logo .nav-logo .logo-default {
	opacity: 0;
}

.vario-season-logo .nav-logo::after {
	content: "";
	position: absolute;
	left: 0;
	top: -32.89%;
	width: 116.12%;
	height: 132.89%;
	background-repeat: no-repeat;
	background-position: 0 0;
	background-size: 100% 100%;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.vario-season-logo .vario-nav.over-berry .nav-logo::after {
	opacity: 0;
}

/* Hoher Kontrast (Windows): Hintergrundbilder können fehlen, deshalb dort
 * das Original-Logo. */
@media (forced-colors: active) {
	.vario-season-logo .nav-logo .logo-default {
		opacity: 1;
	}

	.vario-season-logo .vario-nav.over-berry .nav-logo .logo-default {
		opacity: 0;
	}

	.vario-season-logo .nav-logo::after {
		content: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vario-season-logo .nav-logo::after {
		transition: none;
	}
}

/* Druck: keine Deko, Original-Logo. */
@media print {
	.vario-seasonal-decoration {
		display: none !important;
	}

	.vario-season-logo .nav-logo .logo-default {
		opacity: 1;
	}

	.vario-season-logo .nav-logo::after {
		content: none;
	}
}
