/* ==========================================================================
   Le chemin : sentier qui serpente de section en section (js/chemin.js).
   - Bande sable (le sentier), pointillés gris (« à venir »), trait vert (« parcouru », tracé au défilement).
   - Étoiles à ramasser posées sur le sentier ; elles sautent vers le compteur de la barre du haut.
   - Sans JS, rien de tout cela n'existe : js/chemin.js crée les calques et pose html.chemin-actif.

   Bornes (pour T4 à T7) : <span class="borne" data-chemin aria-hidden="true"></span>, placée en CSS
   (position absolue dans un parent positionné, left/top). Une borne est un point : le sentier passe
   par le centre de sa boîte. Une borne en display:none est ignorée (bornes propres au mobile, etc.).
   ========================================================================== */

.borne { position: absolute; width: 0; height: 0; pointer-events: none; }

/* Le contenu passe au-dessus du sentier, les étoiles au-dessus du contenu */
html.chemin-actif main { position: relative; }
html.chemin-actif main > section { position: relative; z-index: 1; }

.chemin, .chemin-etoiles {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  pointer-events: none; overflow: hidden;
}
.chemin { z-index: 0; }
.chemin-etoiles { z-index: 3; }
.chemin svg { position: absolute; left: 0; top: 0; display: block; max-width: none; overflow: hidden; }

.chemin__bande {
  fill: none; stroke: var(--sable); stroke-width: 40px;
  stroke-linecap: round; stroke-linejoin: round;
}
.chemin__pointilles {
  fill: none; stroke: var(--gris-clair); stroke-width: 3px;
  stroke-dasharray: 1 11; stroke-linecap: round;
}
.chemin__trace {
  fill: none; stroke: var(--vert-action); stroke-width: 5px;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Nuit (dernier appel) : fond dessiné par js/chemin.js sous le sentier, qui change de teinte à son bord haut */
.chemin__nuit { position: absolute; left: 0; right: 0; bottom: 0; background: var(--vert-nuit); }
.chemin__arret--bande-jour { stop-color: var(--sable); }
.chemin__arret--bande-nuit { stop-color: var(--vert-profond); }
.chemin__arret--pointilles-jour { stop-color: var(--gris-clair); }
.chemin__arret--pointilles-nuit { stop-color: var(--gris-vert); }
.chemin__arret--trace-jour { stop-color: var(--vert-action); }
.chemin__arret--trace-nuit { stop-color: var(--vert-vif); }
.chemin--nuit .chemin__bande { stroke: url(#mk-chemin-bande) var(--sable); }
.chemin--nuit .chemin__pointilles { stroke: url(#mk-chemin-pointilles) var(--gris-clair); }
.chemin--nuit .chemin__trace { stroke: url(#mk-chemin-trace) var(--vert-action); }

/* Point de départ */
.chemin__depart {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  border-radius: 50%; background: var(--vert-action); border: 6px solid var(--vert-menthe);
}

/* Étoiles à ramasser */
.chemin__etoile {
  --taille: 36px;
  position: absolute; width: var(--taille); height: var(--taille);
  margin: calc(var(--taille) / -2) 0 0 calc(var(--taille) / -2);
  color: var(--ambre);
  transition: opacity var(--duree-micro) var(--courbe-sortie);
}
.chemin__etoile svg { width: 100%; height: 100%; }
html.js .chemin__etoile.boucle { animation: cheminScintille 3.2s ease-in-out infinite; }
.chemin__etoile.est-ramassee, html.js .chemin__etoile.boucle.est-ramassee { opacity: 0; animation: none; }
@keyframes cheminScintille { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: .7; } }

/* Étoile en vol vers le compteur (créée par js/chemin.js, position fixe) */
.vol-etoile, .vol-etoile__halo {
  position: fixed; z-index: 70; width: 40px; height: 40px; pointer-events: none;
}
.vol-etoile__y, .vol-etoile__forme { display: block; width: 40px; height: 40px; }
.vol-etoile__forme { color: var(--ambre); }
.vol-etoile__halo { box-sizing: border-box; border: 3px solid var(--ambre); border-radius: 50%; opacity: 0; }

@media (max-width: 899px) {
  .chemin__bande { stroke-width: 26px; }
  .chemin__pointilles { stroke-width: 2.5px; stroke-dasharray: 1 9; }
  .chemin__trace { stroke-width: 4px; }
  .chemin__depart { width: 20px; height: 20px; margin: -10px 0 0 -10px; border-width: 5px; }
  .chemin__etoile { --taille: 30px; }
  .vol-etoile, .vol-etoile__halo, .vol-etoile__y, .vol-etoile__forme { width: 36px; height: 36px; }
}

/* ---------- Compteur de la barre du haut ---------- */
.compteur-chemin {
  display: none; align-items: center; justify-content: center; gap: var(--e1);
  min-width: 76px; height: 44px; margin: 0; padding: 0 var(--e4) 0 var(--e3);
  border-radius: var(--r-pastille); background: var(--ambre); color: var(--vert-nuit);
  font: 600 1.25rem/1 var(--police-titre); font-variant-numeric: tabular-nums;
}
html.chemin-actif .compteur-chemin { display: inline-flex; }
.compteur-chemin .ic { width: 24px; height: 24px; flex: none; }
.compteur-chemin__nombre { min-width: 1.4ch; text-align: center; }
@media (max-width: 899px) {
  .compteur-chemin { min-width: 60px; height: 40px; padding: 0 var(--e3) 0 var(--e2); font-size: 1.125rem; }
  .compteur-chemin .ic { width: 22px; height: 22px; }
}
@media (max-width: 419px) {
  /* Place pour le compteur, le bouton et le menu à 360 px : l'icône du bouton s'efface */
  .barre__ico-telecharger { display: none; }
  .compteur-chemin { min-width: 56px; padding: 0 10px 0 6px; }
}
