:root {
	--primary: #f3000d;
	--primary-rgb: 243, 0, 13;
	--primary-light: #f3000d;
	--primary-light-rgb: 255, 138, 145;
	--primary-dark: #7d0000;
	--primary-dark-rgb: 125, 0, 0;

	--secondary: #1f6b45;
	--secondary-rgb: 31, 107, 69;
	--secondary-light: #5fa383;
	--secondary-light-rgb: 95, 163, 131;
	--secondary-dark: #0f3d27;
	--secondary-dark-rgb: 15, 61, 39;

	--logo: #c8102e;
}



/* Fond de page : blanc légèrement teinté de bleu, uni, pour que la neige blanche ressorte (le fond par défaut est blanc). */
body {
	background-color: #f6fcff;
	/* Loader : bleu nuit plutôt que le rouge principal, trop vif en plein écran (défini sur body dans app.scss). */
	--loader-bg-color: #12263f;
}

/* Neige : trois plans de profondeur (loin, milieu, proche), un par pseudo-élément. Chaque plan est une tuile SVG de flocons
   semés au hasard (tailles et opacités variées) : plus c'est loin, plus c'est petit, pâle et lent. Les flocons tombent
   et dérivent vers la droite (background-position), et chaque plan se balance en plus avec son propre rythme
   (translate) : c'est la brise. Le plan proche, plus grand, est un peu flou et bouge davantage (parallaxe). */
html::before,
body::before,
body::after {
	content: "";
	position: fixed;
	inset: 0 -160px; /* plus large que l'écran : le balancement ne laisse jamais voir un bord */
	z-index: 9999;
	pointer-events: none;
	background-repeat: repeat;
	will-change: background-position, translate;
}

/* Plan lointain : petit, pâle, lent, brise faible. */
html::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' fill='white'%3E%3Ccircle cx='72.1' cy='82.9' r='1.5' fill-opacity='0.57'/%3E%3Ccircle cx='214.6' cy='254.0' r='1.3' fill-opacity='0.73'/%3E%3Ccircle cx='117.7' cy='143.7' r='1.7' fill-opacity='0.65'/%3E%3Ccircle cx='38.0' cy='219.8' r='1.8' fill-opacity='0.56'/%3E%3Ccircle cx='108.4' cy='277.2' r='1.8' fill-opacity='0.73'/%3E%3Ccircle cx='290.2' cy='14.1' r='1.5' fill-opacity='0.74'/%3E%3Ccircle cx='217.6' cy='46.4' r='1.6' fill-opacity='0.70'/%3E%3Ccircle cx='12.1' cy='154.7' r='1.4' fill-opacity='0.63'/%3E%3Ccircle cx='219.7' cy='153.5' r='1.4' fill-opacity='0.69'/%3E%3C/svg%3E");
	background-size: 300px 300px;
	animation: noel-neige-loin 55s linear infinite, noel-brise-loin 9s ease-in-out infinite alternate;
}

/* Plan intermédiaire. */
body::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' fill='white'%3E%3Ccircle cx='98.0' cy='145.9' r='2.7' fill-opacity='0.80'/%3E%3Ccircle cx='285.1' cy='327.7' r='2.3' fill-opacity='0.84'/%3E%3Ccircle cx='83.3' cy='361.2' r='2.3' fill-opacity='0.80'/%3E%3Ccircle cx='92.1' cy='264.5' r='2.3' fill-opacity='0.71'/%3E%3Ccircle cx='285.0' cy='170.8' r='2.9' fill-opacity='0.75'/%3E%3Ccircle cx='389.1' cy='57.6' r='2.3' fill-opacity='0.80'/%3E%3Ccircle cx='374.2' cy='165.9' r='3.2' fill-opacity='0.72'/%3E%3Ccircle cx='206.0' cy='261.7' r='2.1' fill-opacity='0.88'/%3E%3C/svg%3E");
	background-size: 400px 400px;
	animation: noel-neige-milieu 32s linear infinite, noel-brise-milieu 7s ease-in-out -3s infinite alternate;
}

/* Plan proche : gros, un peu flou, rapide, la brise le pousse le plus loin. */
body::after {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520' fill='white'%3E%3Ccircle cx='130.2' cy='330.0' r='3.8' fill-opacity='0.86'/%3E%3Ccircle cx='22.5' cy='149.3' r='4.1' fill-opacity='0.93'/%3E%3Ccircle cx='394.0' cy='53.2' r='4.4' fill-opacity='0.96'/%3E%3Ccircle cx='217.2' cy='506.6' r='3.7' fill-opacity='0.96'/%3E%3Ccircle cx='7.0' cy='423.0' r='4.9' fill-opacity='0.97'/%3E%3C/svg%3E");
	background-size: 520px 520px;
	filter: blur(.7px);
	animation: noel-neige-proche 20s linear infinite, noel-brise-proche 11s ease-in-out -5s infinite alternate;
}

/* Chute + dérive vers la droite. Chaque plan avance d'un nombre entier de tuiles : la boucle ne saute pas.
   Loin : 2 tuiles en bas, 1 à droite. Milieu : 3 en bas, 1 à droite. Proche : 3 en bas, 2 à droite (plus penché). */
@keyframes noel-neige-loin { to { background-position: 300px 600px; } }
@keyframes noel-neige-milieu { to { background-position: 400px 1200px; } }
@keyframes noel-neige-proche { to { background-position: 1040px 1560px; } }

/* Brise : balancement gauche-droite, plus ample pour les plans proches, avec un biais vers la droite. */
@keyframes noel-brise-loin { from { translate: -10px 0; } to { translate: 30px 0; } }
@keyframes noel-brise-milieu { from { translate: -25px 0; } to { translate: 70px 0; } }
@keyframes noel-brise-proche { from { translate: -40px 0; } to { translate: 130px 0; } }

/* Fonte : la neige est pleine en haut de page ; au fil du défilement elle s'efface par le bas de l'écran, et en bas de page il n'en reste qu'en haut de l'écran.
   Liée à la position de défilement de la page (scroll-driven animation), donc seulement là où c'est géré ;
   ailleurs la neige reste entière. Réécrit les trois animations de chaque plan en ajoutant la fonte. */
@supports (animation-timeline: scroll()) {
	html::before {
		animation: noel-neige-loin 55s linear infinite, noel-brise-loin 9s ease-in-out infinite alternate, noel-fonte linear both;
		animation-timeline: auto, auto, scroll(root block);
	}
	body::before {
		animation: noel-neige-milieu 32s linear infinite, noel-brise-milieu 7s ease-in-out -3s infinite alternate, noel-fonte linear both;
		animation-timeline: auto, auto, scroll(root block);
	}
	body::after {
		animation: noel-neige-proche 20s linear infinite, noel-brise-proche 11s ease-in-out -5s infinite alternate, noel-fonte linear both;
		animation-timeline: auto, auto, scroll(root block);
	}
}

/* La fonte est un masque qui remonte : en haut de page, la neige couvre tout l'écran (limite à 130 %, hors écran) ;
   en défilant, la limite remonte jusqu'à 35 % de l'écran en bas de page. Il reste alors un peu de neige tout en haut
   de l'écran, qui s'estompe sur les 30 % au-dessus de la limite et disparaît vers le bas. */
@property --neige-coupe {
	syntax: "<percentage>";
	inherits: false;
	initial-value: 130%;
}

@supports (animation-timeline: scroll()) {
	html::before,
	body::before,
	body::after {
		mask-image: linear-gradient(to bottom, #000 calc(var(--neige-coupe) - 30%), transparent var(--neige-coupe));
	}
}

@keyframes noel-fonte {
	0%, 10% { --neige-coupe: 130%; }
	100% { --neige-coupe: 35%; }
}

@media (prefers-reduced-motion: reduce) {
	html::before,
	body::before,
	body::after {
		animation: none;
		display: none;
	}
}


/* Menu : fond du rouge principal éclairci à 80 % (le thème par défaut le fait à 60 %). */
@container menu (min-width: 992px) {
	.menu-bg {
		background: color-mix(in srgb, var(--primary), var(--light) 80%);
	}
}
