/**
 * NOËL — Académie des Métiers d'Art
 * Neige, sapin décoré, cadeaux et lutins.
 * Toutes les classes commencent par "noel-" pour ne pas gêner le reste du site.
 */

/* ─────────────────────────────────────────────────────────
   COULEURS DU SAPIN (palette « vert forêt, or et argent »)
   ───────────────────────────────────────────────────────── */
.noel-scene,
.noel-etoile {
	--nl-bg1: #5A2A2F;
	--nl-bg2: #3A1A1D;
	--nl-bg3: #26110F;
	--nl-ta: #2F5A47;
	--nl-tb: #173528;
	--nl-tc: #27503E;
	--nl-td: #122C21;
	--nl-g0: #FFF1C6;
	--nl-g1: #DEBF92;
	--nl-g2: #9B7A45;
	--nl-s0: #FFFFFF;
	--nl-s1: #C9CED4;
	--nl-s2: #7C838B;
	--nl-gar: #DEBF92;
}

/* ─────────────────────────────────────────────────────────
   NEIGE (couvre l'écran, laisse passer les clics)
   ───────────────────────────────────────────────────────── */
.noel-neige {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 900;
}

.noel-bouton {
	position: fixed;
	z-index: 902;
	right: 16px;
	bottom: 16px;
	padding: 10px 16px;
	font-family: 'Lato', sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #FBF8F3;
	background: #3A1A1D;
	border: 1px solid #DEBF92;
	cursor: pointer;
}

.noel-bouton:hover,
.noel-bouton:focus-visible {
	background: #6B1C23;
}

.noel-bouton:focus-visible {
	outline: 2px solid #DEBF92;
	outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────
   SCÈNE (remplace la carte du campus de Bordeaux)
   Le dessin garde la proportion 16/9 du cadre.
   ───────────────────────────────────────────────────────── */
.noel-scene {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: radial-gradient(ellipse at 50% 35%, var(--nl-bg1) 0%, var(--nl-bg2) 60%, var(--nl-bg3) 100%);
}

.noel-scene svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.noel-voeux {
	margin: 0;
	padding: 1.5rem 1rem 0;
	font-family: 'Bodoni Moda', serif;
	font-size: clamp(22px, 3vw, 28px);
	font-weight: 400;
	line-height: 1.35;
	color: #6B1C23;
	text-align: center;
	text-wrap: balance;
}

/* Hors période de fêtes, tout disparaît (voir les dates dans le JS) */
.noel-off .noel-neige,
.noel-off .noel-etoile,
.noel-off .noel-bouton,
.noel-off .noel-scene,
.noel-off .noel-voeux {
	display: none;
}

/* ─────────────────────────────────────────────────────────
   BOULES, LUMIÈRES ET PAILLETTES
   ───────────────────────────────────────────────────────── */
.noel-sway {
	transform-box: fill-box;
	transform-origin: 50% 0;
	animation: noel-sway 4s ease-in-out infinite alternate;
}

@keyframes noel-sway {
	from { transform: rotate(-2.2deg); }
	to { transform: rotate(2.2deg); }
}

.noel-led,
.noel-sparkle {
	animation: noel-twinkle 2.4s ease-in-out infinite;
}

.noel-sparkle {
	animation-duration: 3s;
}

@keyframes noel-twinkle {
	0%, 100% { opacity: 0.35; }
	50% { opacity: 1; }
}

.noel-glint {
	transform-box: fill-box;
	transform-origin: 50% 50%;
	opacity: 0;
	animation: noel-glint 3.6s ease-in-out infinite;
}

@keyframes noel-glint {
	0%, 70%, 100% { opacity: 0; transform: scale(0.2) rotate(0); }
	82% { opacity: 1; transform: scale(1) rotate(45deg); }
}

/* ─────────────────────────────────────────────────────────
   ÉTOILE : descend du haut à droite de la page, se pose sur la cime
   ───────────────────────────────────────────────────────── */
.noel-etoile {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 901;
	display: none;
	pointer-events: none;
	filter: drop-shadow(0 0 8px rgba(255, 235, 190, 0.85));
	will-change: transform;
}

.noel-starfall {
	transform-box: fill-box;
	transform-origin: 50% 50%;
	opacity: 0;
}

.noel-landed .noel-starfall {
	opacity: 1;
	animation: noel-settle 0.9s ease-out both;
}

@keyframes noel-settle {
	0% { transform: scale(1.3); }
	35% { transform: scale(0.92); }
	65% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

.noel-burst {
	opacity: 0;
	transform-box: fill-box;
	transform-origin: 50% 50%;
}

.noel-landed .noel-burst {
	animation: noel-burst 1.3s ease-out both;
}

.noel-landed .noel-burst2 {
	animation-name: noel-flash;
	animation-duration: 0.9s;
}

@keyframes noel-burst {
	0% { opacity: 0.9; transform: scale(1); }
	100% { opacity: 0; transform: scale(9); }
}

@keyframes noel-flash {
	0% { opacity: 0.85; transform: scale(1); }
	100% { opacity: 0; transform: scale(4); }
}

.noel-startop {
	transform-box: fill-box;
	transform-origin: 50% 50%;
	animation: noel-pulse 3s ease-in-out infinite;
}

@keyframes noel-pulse {
	0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(222, 191, 146, 0.6)); }
	50% { transform: scale(1.1); filter: drop-shadow(0 0 12px rgba(255, 235, 190, 0.95)); }
}

/* ─────────────────────────────────────────────────────────
   LUTINS : arrivent avec un cadeau, le posent près du sapin, repartent
   (boucle de 16 secondes ; le lutin vert démarre 5 secondes plus tard).
   Les jambes et le balancement (noel-legl, noel-legr, noel-bob) sont
   créés par le JS pour ne bouger que pendant la marche.
   ───────────────────────────────────────────────────────── */
.noel-elfb {
	--noel-delai: 5s;
}

.noel-walka, .noel-walkb, .noel-flipa, .noel-flipb, .noel-bend,
.noel-hold, .noel-armsdown, .noel-drop, .noel-bob, .noel-legl, .noel-legr, .noel-hat {
	animation-duration: 16s;
	animation-iteration-count: infinite;
	animation-fill-mode: both;
	animation-delay: var(--noel-delai, 0s);
}

.noel-walka { animation-name: noel-walka; animation-timing-function: linear; }
.noel-walkb { animation-name: noel-walkb; animation-timing-function: linear; }
.noel-flipa { animation-name: noel-flipa; animation-timing-function: step-end; }
.noel-flipb { animation-name: noel-flipb; animation-timing-function: step-end; }
.noel-bend { animation-name: noel-bend; animation-timing-function: ease-in-out; transform-origin: 0 -16px; }
.noel-hold { animation-name: noel-hold; animation-timing-function: ease-in-out; }
.noel-armsdown { animation-name: noel-armsdown; animation-timing-function: step-end; }
.noel-drop { animation-name: noel-drop; animation-timing-function: ease-out; transform-box: fill-box; transform-origin: 50% 100%; }
.noel-bob { animation-name: noel-bob; animation-timing-function: ease-in-out; }
.noel-legl { animation-name: noel-legl; animation-timing-function: ease-in-out; transform-origin: -5px -19px; }
.noel-legr { animation-name: noel-legr; animation-timing-function: ease-in-out; transform-origin: 6px -19px; }
.noel-hat { animation-name: noel-hat; animation-timing-function: ease-in-out; transform-origin: 0 -58px; }

/* Clignement des yeux */
.noel-eyes {
	transform-box: fill-box;
	transform-origin: 50% 50%;
	animation: noel-blink 4.3s ease-in-out infinite;
}

@keyframes noel-blink {
	0%, 91%, 100% { transform: scaleY(1); }
	94% { transform: scaleY(0.08); }
}

@keyframes noel-walka {
	0% { transform: translateX(-250px); }
	28% { transform: translateX(-40px); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
	34% { transform: translateX(0); }
	50% { transform: translateX(0); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.5); }
	56% { transform: translateX(-40px); animation-timing-function: linear; }
	84% { transform: translateX(-250px); }
	100% { transform: translateX(-250px); }
}

@keyframes noel-walkb {
	0% { transform: translateX(260px); }
	28% { transform: translateX(40px); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
	34% { transform: translateX(0); }
	50% { transform: translateX(0); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.5); }
	56% { transform: translateX(40px); animation-timing-function: linear; }
	84% { transform: translateX(260px); }
	100% { transform: translateX(260px); }
}

@keyframes noel-flipa {
	0% { transform: scaleX(1); }
	50% { transform: scaleX(-1); }
	100% { transform: scaleX(-1); }
}

@keyframes noel-flipb {
	0% { transform: scaleX(-1); }
	50% { transform: scaleX(1); }
	100% { transform: scaleX(1); }
}

@keyframes noel-bend {
	0%, 30% { transform: rotate(3deg); }
	38%, 44% { transform: rotate(14deg); }
	49.5%, 52% { transform: rotate(0); }
	58%, 100% { transform: rotate(3deg); }
}

@keyframes noel-hold {
	0%, 34% { opacity: 1; transform: translateY(0); }
	39%, 39.9% { opacity: 1; transform: translateY(14px); }
	40%, 100% { opacity: 0; transform: translateY(14px); }
}

@keyframes noel-armsdown {
	0%, 39.9% { opacity: 0; }
	40%, 100% { opacity: 1; }
}

@keyframes noel-drop {
	0%, 39.9% { opacity: 0; transform: scale(1, 1); }
	40% { opacity: 1; transform: scale(1.1, 0.9); }
	43% { opacity: 1; transform: scale(0.97, 1.04); }
	46%, 93% { opacity: 1; transform: scale(1, 1); }
	100% { opacity: 0; transform: scale(1, 1); }
}

/* ─────────────────────────────────────────────────────────
   PRÉFÉRENCE UTILISATEUR — Réduction des animations
   Le sapin, les cadeaux et les lutins restent affichés, sans mouvement.
   ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.noel-sway, .noel-led, .noel-sparkle, .noel-glint, .noel-startop,
	.noel-landed .noel-starfall, .noel-landed .noel-burst,
	.noel-walka, .noel-walkb, .noel-flipa, .noel-flipb, .noel-bend,
	.noel-hold, .noel-armsdown, .noel-drop, .noel-bob, .noel-legl, .noel-legr, .noel-hat, .noel-eyes {
		animation: none;
	}

	.noel-etoile {
		display: none;
	}

	.noel-starfall {
		opacity: 1;
	}

	.noel-hold {
		opacity: 0;
	}

	.noel-glint {
		opacity: 0;
	}
}