/* Mégadanse : page Calendrier, au style validé de l'accueil V1 et du planning (accueil-v1.css : .v1-carte,
   .v1-carte-rouge, .v1-carte-noire, .v1-titre, .v1-trait, .mb-carte et calques MagicBento, SpotlightCard ;
   variables de .v1-zone, posée sur le panneau). Rouge, noir, blanc ; titres en Archivo italique.
   Haut : la saison (carte rouge, ligne de la saison jusqu'à aujourd'hui) et « À noter » (carte noire penchée).
   Puis une tuile par période sans cours, toutes de la même taille ; la période en cours en rouge.
   Survol, et au doigt la tuile au centre de l'écran : fond noir, texte blanc, bord rouge (jamais translucide).
   Animations : transform et opacity seulement (entrées, ligne de la saison, chiffres du jour, MagicBento). */

/* ---------- Haut : saison et note côte à côte à partir de 900 px ---------- */
.cal-haut { display: grid; gap: clamp(20px, 3vw, 32px); margin-bottom: clamp(36px, 5vw, 64px); }
@media (min-width: 900px) { .cal-haut { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; } }

/* ---------- Saison (carte rouge) ---------- */
.cal-saison { padding: clamp(24px, 4vw, 52px); }
/* #calendrier-note : l'emporte sur la couleur des intertitres posés sur le fond (profondeur.css). */
#calendrier-note .cal-saison-titre { color: var(--blanc); text-shadow: none; font-family: var(--f-titre); font-size: clamp(2rem, 1.2rem + 3vw, 3.8rem); }
.cal-saison-dates { display: block; margin-top: 18px; font-weight: 600; font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.25rem); line-height: 1.45; color: rgb(255 255 255 / 0.9); }
.cal-saison-dates time { font-family: var(--f-titre); font-style: italic; font-weight: 800; color: var(--blanc); white-space: nowrap; }
.cal-ligne { position: relative; display: block; height: 12px; margin-top: clamp(26px, 3vw, 38px); border-radius: 999px; background: var(--rouge-sombre); }
.cal-ligne-plein { position: absolute; inset: 0; border-radius: inherit; background: var(--blanc); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; }
.cal-ligne-pause { position: absolute; top: -4px; bottom: -4px; min-width: 3px; border-radius: 2px; background: var(--noir); transform-origin: 50% 100%; }
.cal-ligne-auj {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: var(--blanc); box-shadow: 0 0 0 4px var(--noir), 0 6px 14px rgb(0 0 0 / 0.35);
}
.cal-ligne-legende {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 14px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(255 255 255 / 0.86);
}
.cal-ligne-legende strong { font-family: var(--f-titre); font-style: italic; font-weight: 800; font-size: 1rem; letter-spacing: 0.02em; text-align: center; color: var(--blanc); }

/* ---------- À noter (carte noire), avec la phrase et le lien vers le planning ---------- */
.cal-note { display: grid; gap: 14px; align-content: start; padding: clamp(24px, 3.4vw, 40px); }
.cal-note::before { content: ''; width: 34px; height: 4px; border-radius: 2px; background: var(--rouge); }
#cal-note-titre {
  margin: 0; color: #ff5a64; text-shadow: none;
  font-family: var(--f-titre); font-style: italic; font-weight: 800; font-stretch: 108%; text-transform: uppercase;
  font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem); line-height: 1.05;
}
.cal-note-texte { display: block; font-weight: 600; font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.25rem); line-height: 1.45; color: var(--blanc); }
.cal-note-texte:empty { display: none; }
.cal-lien { display: block; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 0.18); color: rgb(255 255 255 / 0.82); }
.cal-lien a { color: var(--blanc); font-weight: 700; text-decoration: underline; text-decoration-color: var(--rouge); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cal-lien a:hover, .cal-lien a:focus-visible { color: #ff5a64; text-decoration-color: currentColor; }

/* ---------- Grille des périodes : colonnes et rangées égales ; la tête sur deux colonnes ---------- */
.cal-grille {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); grid-auto-rows: 1fr;
  gap: clamp(12px, 1.4vw, 18px); margin: 0; padding: 0; list-style: none;
}
.cal-cellule { display: flex; min-width: 0; }
.cal-entree { display: flex; flex: 1; min-width: 0; }
@media (min-width: 640px) { .cal-tete { grid-column: span 2; } }
.cal-tete-carte {
  position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0;
  padding: clamp(20px, 2.4vw, 30px); border-radius: var(--r-carte); background: var(--noir); color: var(--blanc);
  box-shadow: 0 18px 44px rgb(0 0 0 / 0.38);
}
#calendrier-periodes .cal-tete-carte .v1-titre { color: var(--blanc); text-shadow: none; font-family: var(--f-titre); font-size: clamp(2rem, 1.2rem + 3vw, 3.6rem); }
#calendrier-periodes .cal-tete-carte .v1-titre em { color: #ff5a64; }
.cal-compte { display: block; max-width: 40ch; margin-top: 14px; font-weight: 600; color: rgb(255 255 255 / 0.86); }
.cal-vide { display: block; padding: 20px 24px; border-radius: var(--r-carte); background: var(--blanc); box-shadow: var(--ombre-carte); font-weight: 600; }

/* ---------- Tuile : le jour en haut (chiffre, mois), l'état à droite, la période en bas ---------- */
.cal-periode.mb-carte {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(10px, 1fr) auto auto;
  grid-template-areas: 'jour etat' '. .' 'libelle libelle' 'dates dates';
  column-gap: 12px; padding: clamp(18px, 2vw, 24px);
}
.cal-jour { grid-area: jour; display: grid; justify-items: start; line-height: 1; }
.cal-jour-n {
  display: block; font-family: var(--f-titre); font-style: italic; font-weight: 900; font-stretch: 112%;
  font-size: clamp(2.6rem, 2rem + 1.8vw, 3.4rem); line-height: 0.9; letter-spacing: -0.03em; color: var(--rouge); font-variant-numeric: tabular-nums;
}
.cal-jour-m { margin-top: 4px; font-family: var(--f-titre); font-style: italic; font-weight: 800; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; }
.cal-etat {
  grid-area: etat; justify-self: end; align-self: start; padding: 4px 10px; border-radius: 999px; background: var(--rouge); color: var(--blanc);
  font: 700 0.66rem/1.2 var(--f-texte); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}
/* #calendrier-periodes : l'emporte sur la couleur des intertitres posés sur le fond (profondeur.css). */
#calendrier-periodes .cal-libelle {
  grid-area: libelle; margin: 0; color: inherit; text-shadow: none;
  font-family: var(--f-titre); font-style: italic; font-weight: 800; font-stretch: 108%; text-transform: uppercase;
  font-size: clamp(1.15rem, 0.95rem + 0.6vw, 1.45rem); line-height: 1.06; overflow-wrap: break-word;
}
.cal-precision { display: block; margin-top: 6px; font: 500 0.8rem/1.35 var(--f-texte); text-transform: none; color: var(--encre-douce); }
.cal-dates { grid-area: dates; display: block; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgb(13 11 11 / 0.12); font-size: 0.92rem; line-height: 1.4; color: var(--encre-douce); }
.cal-dates time { font-weight: 700; color: var(--noir); }

/* Période passée : chiffre gris et pastille au trait. Période en cours : tuile rouge. */
.cal-periode[data-etat='passee'] .cal-jour-n { color: var(--encre-douce); }
.cal-periode[data-etat='passee'] .cal-etat { background: transparent; color: var(--encre-douce); box-shadow: inset 0 0 0 1.5px currentColor; }
.cal-periode[data-etat='en-cours'] { background: var(--rouge); color: var(--blanc); }
.cal-periode[data-etat='en-cours'] .cal-jour-n { color: var(--blanc); }
.cal-periode[data-etat='en-cours'] .cal-etat { background: var(--blanc); color: var(--rouge); }
.cal-periode[data-etat='en-cours'] :is(.cal-dates, .cal-precision) { color: rgb(255 255 255 / 0.86); border-top-color: rgb(255 255 255 / 0.3); }
.cal-periode[data-etat='en-cours'] .cal-dates time { color: var(--blanc); }

/* ---------- Survol (souris) et tuile active (MagicBento, au doigt) : fond noir, texte blanc, bord rouge ---------- */
.cal-periode[data-actif] { background: var(--noir); color: var(--blanc); box-shadow: inset 0 0 0 2px var(--rouge), 0 18px 44px rgb(0 0 0 / 0.38); }
.cal-periode[data-actif] .cal-jour-n { color: #ff5a64; }
.cal-periode[data-actif] :is(.cal-dates, .cal-precision) { color: rgb(255 255 255 / 0.72); border-top-color: rgb(255 255 255 / 0.2); }
.cal-periode[data-actif] .cal-dates time { color: var(--blanc); }
.cal-periode[data-actif] .cal-etat { background: var(--rouge); color: var(--blanc); box-shadow: none; }
@media (hover: hover) {
  .cal-periode:hover { background: var(--noir); color: var(--blanc); box-shadow: inset 0 0 0 2px var(--rouge), 0 18px 44px rgb(0 0 0 / 0.38); }
  .cal-periode:hover .cal-jour-n { color: #ff5a64; }
  .cal-periode:hover :is(.cal-dates, .cal-precision) { color: rgb(255 255 255 / 0.72); border-top-color: rgb(255 255 255 / 0.2); }
  .cal-periode:hover .cal-dates time { color: var(--blanc); }
  .cal-periode:hover .cal-etat { background: var(--rouge); color: var(--blanc); box-shadow: none; }
}
