/* Thèmes saisonniers : surcouches du thème de style.css, actives quand <html> porte data-season
   (voir js/season.js). Chaque saison ne redéfinit que les variables qu'elle retouche, en clair
   puis en sombre (mêmes sélecteurs que style.css), et ajoute son décor en dessous.
   Les couleurs d'état (--ok, --fail, --warn, --planned) portent du sens : on n'y touche pas. */

/* --- Halloween : accent citrouille, fonds légèrement violacés --- */
:root[data-season="halloween"] {
  --bg: #f7f3ef;
  --raised: #efe6e0;
  --text: #1f1622;
  --muted: #5d5260;
  --border: #dfd3cb;
  --row: #f4ede8;
  --accent: #ad4208;
  --accent-soft: #fbe2cd;
}
:root[data-season="halloween"][data-theme="dark"] {
  --bg: #15111b;
  --card: #241d2c;
  --raised: #30273a;
  --text: #f6f1f8;
  --muted: #bfb4c9;
  --border: #44384f;
  --row: #2a2233;
  --accent: #ff9a3c;
  --on-accent: #1d1206;
  --accent-soft: #46290f;
}
@media (prefers-color-scheme: dark) {
  :root[data-season="halloween"]:not([data-theme="light"]) {
    --bg: #15111b;
    --card: #241d2c;
    --raised: #30273a;
    --text: #f6f1f8;
    --muted: #bfb4c9;
    --border: #44384f;
    --row: #2a2233;
    --accent: #ff9a3c;
    --on-accent: #1d1206;
    --accent-soft: #46290f;
  }
}

/* Fin de séance ou de minuteur pendant une saison : le vert des réussites (halo, frise, pastilles
   « +… », boutons) prend la couleur d'accent de la saison (orange pour Halloween). */
[data-season] .workout.finished {
  --ok: var(--accent);
  --on-status: var(--on-accent);
}

/* Écrans de fin de séance (célébration, récapitulatif) pendant Halloween : une toile dans chaque
   coin du haut et une araignée qui descend au bout de son fil. Décor sans interaction, porté par
   le titre de l'écran (fixed : il reste dans les coins quel que soit le défilement). */
[data-season="halloween"] .workout.finished .workout-head::before,
[data-season="halloween"] .workout.finished .workout-head::after {
  content: ""; position: fixed; top: -14px; width: 104px; height: 104px; z-index: 1;
  background: var(--muted); opacity: 0.5; pointer-events: none;
  -webkit-mask: var(--deco-web) no-repeat center / contain;
  mask: var(--deco-web) no-repeat center / contain;
}
[data-season="halloween"] .workout.finished .workout-head::before { left: -14px; transform: scaleX(-1); }
[data-season="halloween"] .workout.finished .workout-head::after { right: -14px; }
[data-season="halloween"] .workout.finished .workout-body::after {
  content: ""; position: fixed; top: 0; right: 58px; width: 22px; height: 150px; z-index: 1;
  background: var(--text); opacity: 0.7; pointer-events: none;
  -webkit-mask: var(--deco-spider) no-repeat top center / contain;
  mask: var(--deco-spider) no-repeat top center / contain;
  transform-origin: top center;
  animation: spider-drop 1.4s cubic-bezier(0.34, 1.4, 0.64, 1) both, spider-sway 3.5s ease-in-out 1.4s infinite;
}
@keyframes spider-drop { from { transform: translateY(-150px); } to { transform: none; } }
@keyframes spider-sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg) translateY(6px); }
}
@media (prefers-reduced-motion: reduce) {
  [data-season="halloween"] .workout.finished .workout-body::after { animation: none; }
}

/* Décor : une toile d'araignée dans le coin de l'en-tête de l'accueil et une chauve-souris qui
   plane à côté. Dessins en masque, colorés par les variables du thème. La chauve-souris est un
   bouton (easter egg, voir bat.js) ; hors saison, elle n'existe pas à l'écran. */
.season-bat { display: none; }
[data-season="halloween"] .view-head.brand { position: relative; }
[data-season="halloween"] .view-head.brand::after {
  content: ""; position: absolute; top: -16px; right: -16px; width: 76px; height: 76px;
  background: var(--muted); opacity: 0.55; pointer-events: none;
  -webkit-mask: var(--deco-web) no-repeat center / contain;
  mask: var(--deco-web) no-repeat center / contain;
}
/* zone de toucher plus grande que le dessin */
[data-season="halloween"] .season-bat {
  display: block; position: absolute; top: 4px; right: 66px; width: 50px; height: 40px; padding: 0;
  border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; user-select: none;
}
[data-season="halloween"] .season-bat.gone { visibility: hidden; transition: visibility 0s 1.1s; }
[data-season="halloween"] .season-bat > span {
  display: block; width: 34px; height: 20px; margin: 10px auto 0; background: var(--accent);
  -webkit-mask: var(--deco-bat) no-repeat center / contain;
  mask: var(--deco-bat) no-repeat center / contain;
  animation: bat-hover 3.2s ease-in-out infinite;
}
@keyframes bat-hover {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-5px) rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) {
  [data-season="halloween"] .season-bat > span { animation: none; }
}
:root[data-season="halloween"] {
  --deco-web: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 76 76' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M76 0L0 0M76 0L6 30M76 0L30 58M76 0L58 74M76 0L76 76'/%3E%3Cpath d='M56 0Q58 6 57 8Q63 10 61 14Q68 14 68 19Q73 17 76 20'/%3E%3Cpath d='M36 0Q41 11 39 16Q51 20 47 29Q61 29 61 39Q70 36 76 40'/%3E%3Cpath d='M16 0Q25 16 21 24Q39 30 33 44Q54 44 54 59Q67 55 76 60'/%3E%3C/svg%3E");
  --deco-spider: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 150'%3E%3Cpath d='M10.6 0h0.8v128h-0.8z'/%3E%3Cellipse cx='11' cy='134' rx='5' ry='6'/%3E%3Ccircle cx='11' cy='126.5' r='3.2'/%3E%3Cpath d='M6.5 130 1 125M6 134 0 133M6.5 138 1 143M15.5 130 21 125M16 134 22 133M15.5 138 21 143' stroke='black' stroke-width='1.4' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  --deco-bat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 20'%3E%3Cpath d='M17 6l-2-4-1 3.5C11 3 6 2 0 4c3 1 4.5 3.5 4.5 7 2-2 4.5-2 6 0 1-1.500 2.500-1.500 3.500 0l3 5 3-5c1-1.500 2.500-1.500 3.500 0 1.500-2 4-2 6 0C29.500 7.500 31 5 34 4c-6-2-11-1-14 1.500L19 2z'/%3E%3C/svg%3E");
}
