/* =========================================================
   Thème de Noël
   Actif quand config.js contient  theme: "noel"
   Toutes les règles sont limitées à html[data-theme="noel"] :
   avec le thème "defaut", ce fichier n'a aucun effet.
   ========================================================= */

html[data-theme="noel"]{
  --bg: #050d24;
  --muted: #f6ead0;
  --noel-red: #ff3b4e;
  --noel-gold: #ffd23f;
  --noel-green: #3cf06e;
  --noel-blue: #3fa9ff;
  --noel-pink: #ff6ad5;
  --candy: repeating-linear-gradient(135deg, #ffffff 0 7px, #ff3b4e 7px 14px);
}

/* ---------- Fond : nuit d'hiver + bulles de lumière ---------- */
html[data-theme="noel"],
html[data-theme="noel"] body{
  background: radial-gradient(ellipse 120% 85% at 50% 0%, #2c55a3 0%, #163470 32%, #0b1d47 68%, #050d24 100%) fixed;
  background-color: #050d24;
}
html[data-theme="noel"] body{ position: relative; }
html[data-theme="noel"] .page{
  position: relative;
  z-index: 1;
  padding-top: 70px;
}
.noel-bokeh{
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.noel-bokeh span{
  position: absolute;
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--c), 0.6) 0%, rgba(var(--c), 0.26) 40%, rgba(var(--c), 0) 70%);
  animation: noelBokeh var(--d) ease-in-out infinite alternate;
  animation-delay: var(--t);
}
@keyframes noelBokeh{
  0%  { transform: translate(0, 0) scale(0.85); opacity: 0.55; }
  50% { opacity: 1; }
  100%{ transform: translate(26px, -34px) scale(1.12); opacity: 0.7; }
}

/* neige qui tombe (canvas créé par js/theme.js) */
.noel-snow{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

/* tapis de neige en bas de l'écran */
html[data-theme="noel"] body::after{
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 30px;
  z-index: 0;
  pointer-events: none;
  background: url(../img/noel-snowbank.svg) repeat-x left bottom / 240px 30px;
}

/* ---------- Guirlande lumineuse en haut de la page ---------- */
.noel-garland{
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 64px;
  overflow: hidden;
  z-index: 5;
  pointer-events: none;
}
.noel-garland svg{ display: block; }
.noel-garland .gb{
  filter: drop-shadow(0 0 3px var(--c)) drop-shadow(0 0 8px var(--c));
  animation: noelBulb 1.65s ease-in-out infinite;
  animation-delay: var(--dl);
}
@keyframes noelBulb{
  0%, 100%{ opacity: 1; }
  50%     { opacity: 0.3; }
}

/* ---------- Message "Joyeux Noël !" ---------- */
html[data-theme="noel"] header .noel-wish{
  margin: 0 0 10px;
  color: #fff;
  font-size: clamp(1.25rem, 3.4vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.3;
  white-space: nowrap;
}
.noel-wish span{
  display: inline-block;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 0 12px currentColor;
  animation: noelHop 1.9s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.09s);
}
.noel-wish span:nth-child(5n+1){ color: #ff4d5e; }
.noel-wish span:nth-child(5n+2){ color: #ffd23f; }
.noel-wish span:nth-child(5n+3){ color: #3cf06e; }
.noel-wish span:nth-child(5n+4){ color: #5cb8ff; }
.noel-wish span:nth-child(5n+5){ color: #ff7ad9; }
.noel-wish::before,
.noel-wish::after{
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin: 0 0.35em;
  vertical-align: 0.05em;
  background: #ffd23f;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 0 4px #ffd23f);
  animation: noelStar 2.6s ease-in-out infinite;
}
.noel-wish::after{ animation-delay: 1.3s; }
@keyframes noelHop{
  0%, 55%, 100%{ transform: translateY(0) rotate(0); }
  25%          { transform: translateY(-7px) rotate(-5deg); }
  40%          { transform: translateY(1px) rotate(2deg); }
}
@keyframes noelStar{
  0%, 100%{ transform: scale(0.85) rotate(0deg); }
  50%     { transform: scale(1.15) rotate(36deg); }
}

/* ---------- Titre : lettres "ampoules" multicolores ---------- */
html[data-theme="noel"] header h1{
  background: linear-gradient(90deg, #ff4d5e, #ffd23f, #3cf06e, #5cb8ff, #ff7ad9);
  -webkit-background-clip: text;
  background-clip: text;
}
html[data-theme="noel"] header h1.fx{
  --violet: #ffd23f;
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
}
html[data-theme="noel"] .tw .tl{ text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
html[data-theme="noel"] .tw .tl:nth-child(5n+1){ color: #ff4d5e; }
html[data-theme="noel"] .tw .tl:nth-child(5n+2){ color: #ffd23f; }
html[data-theme="noel"] .tw .tl:nth-child(5n+3){ color: #3cf06e; }
html[data-theme="noel"] .tw .tl:nth-child(5n+4){ color: #5cb8ff; }
html[data-theme="noel"] .tw .tl:nth-child(5n+5){ color: #ff7ad9; }
html[data-theme="noel"] .tw .tl.on{
  color: #ffffff;
  text-shadow: 0 0 6px #ffd23f, 0 0 16px #ffb000, 0 0 30px #ff8c1a;
}
html[data-theme="noel"] .tcaret{
  background: #ffd23f;
  box-shadow: 0 0 8px #ffd23f, 0 0 18px #ff8c1a;
}
/* petit bonnet sur le "T" du titre */
html[data-theme="noel"] .tw:first-child .tl:first-child{ position: relative; }
html[data-theme="noel"] .tw:first-child .tl:first-child::before{
  content: "";
  position: absolute;
  left: -0.26em;
  top: -0.5em;
  width: 0.98em;
  height: 0.78em;
  background: url(../img/noel-hat.svg) no-repeat center / contain;
  transform: rotate(-16deg);
  pointer-events: none;
}

/* ---------- Carte : halo doré, bonnet et houx ---------- */
html[data-theme="noel"] .board-wrap{
  filter: drop-shadow(0 0 28px rgba(255, 210, 63, 0.22)) drop-shadow(0 20px 45px rgba(0, 0, 0, 0.55));
}
.noel-hat,
.noel-holly{
  position: absolute;
  z-index: 3;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
html[data-theme="noel"] .board-wrap img.noel-hat{
  inset: auto;
  left: -3.5%;
  top: -6.5%;
  width: 18%;
  height: auto;
  transform: rotate(-20deg);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}
html[data-theme="noel"] .board-wrap img.noel-holly{
  inset: auto;
  right: -2.5%;
  bottom: -3%;
  width: 14%;
  height: auto;
  transform: rotate(-8deg);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
html[data-theme="noel"] .board-caption{
  color: #ffd23f;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.5);
}

/* ---------- Boutons : rouge, vert, sucre d'orge et neige ---------- */
html[data-theme="noel"] .btn-link{
  position: relative;
  color: #ffffff;
  border: 3px solid transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
/* vert, bordure sucre d'orge : Guide et GitHub */
html[data-theme="noel"] .button-group > .btn-link:nth-child(1),
html[data-theme="noel"] .btn-row .btn-link:nth-child(2){
  background: linear-gradient(135deg, #2cc062 0%, #0f6a2d 100%) padding-box, var(--candy) border-box;
  box-shadow: 0 6px 20px rgba(44, 192, 98, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
/* rouge, bordure dorée : Doc et Drive */
html[data-theme="noel"] .button-group > .btn-link:nth-child(2),
html[data-theme="noel"] .btn-row .btn-link:nth-child(1){
  background: linear-gradient(135deg, #ff4d5e 0%, #b3101f 100%) padding-box, linear-gradient(135deg, #fff1a8, #ffc23a 50%, #e89a00) border-box;
  box-shadow: 0 6px 20px rgba(255, 59, 78, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
/* bleu nuit étoilé, bordure sucre d'orge : Kubii */
html[data-theme="noel"] .btn-link.xmas{
  background: linear-gradient(135deg, #2a58ad 0%, #0c2250 100%) padding-box, var(--candy) border-box;
  box-shadow: 0 6px 22px rgba(63, 169, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
html[data-theme="noel"] .btn-sub{ color: #fff4dc; opacity: 0.9; }

/* chapeau de neige sur les boutons */
html[data-theme="noel"] .button-group .btn-link:not(.xmas)::before{
  content: "";
  position: absolute;
  top: -6px;
  left: 16px;
  right: 16px;
  height: 15px;
  background: url(../img/noel-snowcap.svg) repeat-x left top / 60px 15px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  mask: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  filter: drop-shadow(0 2px 1px rgba(0, 30, 80, 0.3));
  pointer-events: none;
}

/* survol : le bouton "tinte" comme une clochette */
html[data-theme="noel"] .button-group .btn-link:hover{
  filter: brightness(1.12) saturate(1.1);
  animation: noelJingle 0.6s ease-in-out;
}
@keyframes noelJingle{
  0%  { transform: translateY(-2px) rotate(0); }
  20% { transform: translateY(-2px) rotate(-2.5deg); }
  40% { transform: translateY(-2px) rotate(2deg); }
  60% { transform: translateY(-2px) rotate(-1.2deg); }
  80% { transform: translateY(-2px) rotate(0.6deg); }
  100%{ transform: translateY(-2px) rotate(0); }
}

/* ---------- Mise en page PC (paysage) ---------- */
@media (orientation: landscape){
  html[data-theme="noel"] .page{
    padding-top: 56px;
    padding-bottom: 34px;
  }
  html[data-theme="noel"] .page .board-wrap{
    width: min(78vh, 920px, calc(100vw - 12vw - 330px));
  }
  html[data-theme="noel"] header .noel-wish{
    font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  }
  html[data-theme="noel"] .noel-wish::before{ margin-left: 0; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce){
  .noel-bokeh span,
  .noel-garland .gb,
  .noel-wish span,
  .noel-wish::before,
  .noel-wish::after,
  html[data-theme="noel"] .button-group .btn-link:hover{ animation: none; }
}

/* le texte "Disponible" garde son vert lumineux (pas d'ombre sous le dégradé) */
html[data-theme="noel"] .btn-title.dispo{ text-shadow: none; }

/* guirlande du bouton Kubii : uniquement avec le thème de Noël */
html[data-theme="noel"] .xmas-lights{ display: flex; }

/* neige du bouton Kubii : uniquement avec le thème de Noël */
html[data-theme="noel"] .xmas-snow{ display: block; }
@media (prefers-reduced-motion: reduce){
  html[data-theme="noel"] .xmas-snow{ display: none; }
}
