/* ---------- Décor de Noël ----------
   Couche saisonnière posée par-dessus le site : tout passe par body.noel,
   que noel.js ajoute (désactivable dans ⚙️). Pour l'enlever après les fêtes,
   supprimer noel.css, noel.js et leurs lignes dans templates/index.html. */

/* Guirlande lumineuse en haut de page */
.guirlande {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 84px;  /* assez haut pour que le halo des ampoules ne soit pas coupé */
  margin: 0;
  padding: 0;
  list-style: none;
  display: none;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
body.noel .guirlande { display: flex; }
body.noel { padding-top: 56px; }

.guirlande li {
  --c: #ef4444;
  --c-eteinte: rgba(239, 68, 68, 0.35);
  position: relative;
  flex: none;
  width: 12px;
  height: 24px;
  margin: 18px 20px 0 20px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 4px 20px 3px var(--c);
  animation: ampoule 2s ease-in-out infinite;
}
.guirlande li:first-child { margin-left: -26px; }
/* Culot */
.guirlande li::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 1px;
  width: 10px;
  height: 9px;
  border-radius: 3px;
  background: #334155;
}
/* Fil jusqu'à l'ampoule suivante (pas de 52 px) */
.guirlande li::after {
  content: "";
  position: absolute;
  top: -14px;
  left: 6px;
  width: 52px;
  height: 18px;
  border-bottom: 2px solid #334155;
  border-radius: 50%;
}
.guirlande li:nth-child(4n+2) { --c: #fbbf24; --c-eteinte: rgba(251, 191, 36, 0.35); animation-duration: 2.4s; animation-delay: -0.6s; }
.guirlande li:nth-child(4n+3) { --c: #22c55e; --c-eteinte: rgba(34, 197, 94, 0.35); animation-duration: 1.8s; animation-delay: -1.1s; }
.guirlande li:nth-child(4n+4) { --c: #60a5fa; --c-eteinte: rgba(96, 165, 250, 0.35); animation-duration: 2.2s; animation-delay: -0.3s; }
@keyframes ampoule {
  0%, 100% { background: var(--c); box-shadow: 0 4px 20px 3px var(--c); }
  50% { background: var(--c-eteinte); box-shadow: 0 4px 20px 3px transparent; }
}

/* Neige posée sur les cartes */
body.noel .card, body.noel .chart-container { position: relative; }
body.noel .card::before, body.noel .chart-container::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 10px;
  right: 10px;
  height: 17px;
  border-radius: 9px;
  pointer-events: none;
  background:
    /* congères sur le dessus */
    radial-gradient(26px 8px at 50% 100%, #ffffff 96%, transparent 100%) 0 0 / 70px 8px repeat-x,
    radial-gradient(16px 6px at 50% 100%, #ffffff 96%, transparent 100%) 35px 2px / 52px 6px repeat-x,
    /* couche de neige */
    linear-gradient(#ffffff, #e2e8f0) 0 7px / 100% 6px no-repeat,
    /* coulures sous le bord */
    radial-gradient(6px 4px at 50% 0, #e2e8f0 96%, transparent 100%) 18px 13px / 86px 4px repeat-x,
    radial-gradient(4px 3px at 50% 0, #e2e8f0 96%, transparent 100%) 47px 13px / 61px 3px repeat-x;
  filter: drop-shadow(0 2px 2px rgba(15, 23, 42, 0.3));
}

/* Sous-titre : compte à rebours */
.noel-compte { display: none; }
body.noel .noel-compte {
  display: block;
  text-align: center;
  margin: -20px 0 26px 0;
  font-size: 14px;
  color: #cbd5e1;
}

/* Flocons qui tombent doucement (couche du ciel, derrière les cartes) */
.flocons {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}
body.noel .flocons { opacity: 1; }
body.noel.cond-rain .flocons { opacity: 0; }
.flocons span {
  position: absolute;
  top: -5%;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}
/* Animés seulement pendant la saison : inutile de les faire tomber cachés. */
body.noel .flocons span { animation: flocon-chute linear infinite; }
@keyframes flocon-chute {
  from { transform: translateY(0) translateX(0) rotate(0deg); }
  50% { transform: translateY(55vh) translateX(25px) rotate(180deg); }
  to { transform: translateY(110vh) translateX(-10px) rotate(360deg); }
}

/* Traîneau du Père Noël, la nuit, de droite à gauche devant la lune */
.traineau {
  position: absolute;
  top: 10%;
  left: 0;
  font-size: 30px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(110vw);
  pointer-events: none;
}
body.noel.is-night:not(.cond-rain) .traineau {
  opacity: 1;
  animation: traineau-passe 50s linear 4s infinite;
}
.traineau-vol { display: inline-block; animation: traineau-tangue 3s ease-in-out infinite; }
.traineau .pere-noel { display: inline-block; font-size: 0.75em; margin-right: -0.85em; transform: translateY(-0.45em); }
.traineau-vol::after { content: "✨"; font-size: 0.6em; margin-left: 4px; opacity: 0.8; }
@keyframes traineau-passe {
  0% { transform: translateX(110vw); }
  36% { transform: translateX(-40vw); }
  100% { transform: translateX(-40vw); }
}
@keyframes traineau-tangue {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

/* Interrupteur dans ⚙️ */
.reglage-ligne input#noel-actif { accent-color: #ef4444; }

@media (max-width: 640px) {
  body.noel { padding-top: 74px; }
  body.noel .noel-compte { margin: -12px 0 20px 0; font-size: 13px; }
  .traineau { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .guirlande li, .traineau-vol { animation: none; }
  .flocons, .traineau { display: none; }
}
