/* ==========================================================================
   BETATHLON — LA VISITE DE LA DÉMO (demo.html)
   Contrat de tokens : aucune couleur, aucune police, aucun rayon en dur.
   Tout passe par var(--…) défini dans tokens.css.
   Composants absents de la charte du site et construits ici (signalés au
   rapport S199-4) : la progression en cibles, la navigation écran par écran,
   la grille du tirage et le barème de points.
   ========================================================================== */

/* ---------- Cadre général ---------- */
.demo {
  position: relative;
}
.demo__inner {
  max-width: var(--largeur-texte);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* ---------- Progression : dix cibles de tir ---------- */
.demo__progression {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.demo__cibles {
  display: flex;
  gap: var(--space-1);
  flex: 1;
  flex-wrap: wrap;
}
.demo__cible {
  width: 13px;
  height: 13px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--ligne);
  cursor: pointer;
  transition: background var(--duree-courte) var(--ease-sortie),
              border-color var(--duree-courte) var(--ease-sortie),
              transform var(--duree-courte) var(--ease-sortie);
}
.demo__cible:hover { border-color: var(--recompense-a30); }
.demo__cible--faite {
  background: var(--recompense);
  border-color: var(--recompense);
}
.demo__cible--courante {
  border-color: var(--recompense);
  transform: scale(1.35);
  box-shadow: var(--bloom-recompense);
}
.demo__compteur {
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--texte-faible);
  white-space: nowrap;
}

/* ---------- Le plateau ---------- */
.demo__deck { position: relative; }
.demo__piste { display: flex; flex-direction: column; gap: var(--space-4); }

/* Sans JavaScript, les dix écrans restent empilés et tous lisibles.
   La classe demo--js (posée par demo.js) active seulement alors le pas-à-pas. */
.demo--js .demo__deck {
  overflow: hidden;
  height: clamp(30rem, 62vh, 40rem);
}
.demo--js .demo__piste {
  flex-direction: row;
  gap: 0;
  height: 100%;
  will-change: transform;
  transition: transform var(--duree-moyenne) var(--ease-sortie);
}
.demo--js .demo__piste--glisse { transition: none; }
.demo--js .demo__ecran {
  min-width: 100%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}
.demo--js .demo__ecran::-webkit-scrollbar { display: none; }

/* ---------- Un écran ---------- */
.demo__ecran {
  background: var(--surface);
  border: var(--border-carte);
  border-radius: var(--rayon-carte);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
}
.demo--js .demo__ecran { border-radius: var(--rayon-carte); }
.demo__ecran--centre { text-align: center; align-items: center; justify-content: center; }

.demo__sur {
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--recompense-ombre);
}
.demo__titre {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 400;
  line-height: 1;
  letter-spacing: .015em;
  margin-top: var(--space-1);
  text-shadow: var(--glow-titre);
}
.demo__titre em {
  font-style: normal;
  background: var(--recompense-metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.demo__corps {
  margin-top: var(--space-2);
  font-size: var(--text-body);
  font-weight: 300;
  line-height: 1.55;
  color: var(--texte);
}
.demo__corps strong { font-weight: 600; color: var(--recompense-vive); }

.demo__scene { margin-top: auto; padding-top: var(--space-3); }
.demo__ecran--centre .demo__scene { margin-top: var(--space-3); width: 100%; }

.demo__accroche {
  margin-top: var(--space-2);
  font-size: var(--text-small);
  color: var(--texte-attenue);
  border-left: 2px solid var(--recompense-a30);
  padding-left: var(--space-2);
}
.demo__ecran--centre .demo__accroche { border-left: none; padding-left: 0; }
.demo__note {
  margin-top: var(--space-2);
  font-size: var(--text-small);
  color: var(--texte-faible);
  line-height: 1.5;
}
.demo__note strong { color: var(--texte-attenue); font-weight: 600; }
.demo__legende {
  margin-top: var(--space-2);
  font-size: var(--text-micro);
  color: var(--texte-faible);
  font-style: italic;
  text-align: center;
  line-height: 1.45;
}

/* ---------- Plaques d'athlètes ---------- */
.demo__plaques { display: flex; flex-direction: column; gap: var(--space-1); }
.demo__plaque {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-haute);
  border: var(--border-carte);
  border-radius: var(--rayon-plaque);
  padding: var(--space-1) var(--space-2);
}
.demo__plaque--a-toi {
  border: var(--border-recompense);
  background: linear-gradient(90deg, var(--recompense-a10), transparent);
}
.demo__plaque--prise { opacity: .42; }
.demo__drapeau { width: 1.4em; height: 1.05em; border-radius: 2px; flex: none; }
.demo__qui {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-size: 1.15rem;
  letter-spacing: .03em;
}
.demo__cote { font-family: var(--font-display); font-size: 1.15rem; color: var(--recompense); }
.demo__par {
  font-size: var(--text-micro);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--texte-faible);
}

/* ---------- Grille du tirage ---------- */
.demo__tirage {
  display: grid;
  grid-template-columns: 4.5rem 1fr 1fr;
  gap: 4px;
  font-size: var(--text-micro);
}
.demo__tirage-h {
  font-size: var(--text-micro);
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--texte-faible);
  padding: 0 0 var(--space-1) 2px;
  line-height: 1.3;
}
.demo__rang {
  background: var(--surface-haute);
  border-radius: 8px;
  padding: var(--space-1) 4px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--recompense);
}
.demo__case {
  background: var(--surface-haute);
  border: var(--border-subtile);
  border-radius: 8px;
  padding: var(--space-1) 6px;
  text-align: center;
  color: var(--texte);
}
.demo__case b { color: var(--recompense-vive); font-weight: 600; }
.demo__rang--premier {
  background: var(--recompense-a10);
  box-shadow: inset 0 0 0 1px var(--recompense-a30);
}
.demo__tirage-note {
  margin-top: var(--space-2);
  font-size: var(--text-micro);
  color: var(--texte-faible);
  text-align: center;
}

/* ---------- Liste privée ---------- */
.demo__liste-entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
  font-size: var(--text-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--texte-faible);
}
.demo__liste-entete .ic { margin-right: .35em; vertical-align: -.1em; }
.demo__liste { display: flex; flex-direction: column; gap: 4px; list-style: none; }
.demo__ligne {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-haute);
  border: var(--border-subtile);
  border-radius: 8px;
  padding: 6px var(--space-2);
  font-size: var(--text-small);
}
.demo__rangnum {
  font-family: var(--font-display);
  font-size: var(--text-body);
  color: var(--recompense-ombre);
  width: 1em;
}

/* ---------- Barème de points ---------- */
.demo__bareme { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.demo__bareme > div {
  background: var(--surface-haute);
  border: var(--border-subtile);
  border-radius: 8px;
  padding: var(--space-1) 0;
  text-align: center;
}
.demo__place { font-size: var(--text-micro); color: var(--texte-faible); }
.demo__points { font-family: var(--font-display); font-size: 1.25rem; margin-top: 2px; }
.demo__bareme > div:first-child .demo__points {
  background: var(--recompense-metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Calcul de la cote ---------- */
.demo__calcul {
  margin-top: var(--space-2);
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  letter-spacing: .04em;
}
.demo__calcul span { color: var(--recompense); }
.demo__calcul small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-micro);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--texte-faible);
  margin-top: var(--space-1);
  font-weight: 400;
}

/* ---------- Cartes bonus ---------- */
.demo__cartes { display: flex; flex-direction: column; gap: var(--space-2); }
.demo__carte {
  border: var(--border-recompense);
  border-radius: var(--rayon-plaque);
  padding: var(--space-2);
  background: var(--surface-haute);
}
.demo__carte h4 {
  display: flex;
  align-items: center;
  gap: .45em;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: .03em;
  color: var(--recompense);
}
.demo__carte p {
  font-size: var(--text-small);
  line-height: 1.45;
  color: var(--texte-attenue);
  font-weight: 300;
  margin-top: 2px;
}

/* ---------- Écran final ---------- */
.demo__liens {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}
.demo__lien {
  border: var(--border-subtile);
  border-radius: var(--rayon-plaque);
  padding: var(--space-2);
  font-size: var(--text-small);
  color: var(--texte);
}
.demo__lien strong { color: var(--recompense); font-weight: 600; }
.demo__lien a { color: var(--recompense); }
.demo__final { margin-top: var(--space-3); }

/* ---------- Commandes ---------- */
.demo__commandes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.demo__aide {
  font-size: var(--text-micro);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--texte-faible);
  text-align: center;
  flex: 1;
}
.demo__fleche {
  flex: none;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-subtile);
  border-radius: var(--rayon-bouton);
  background: transparent;
  color: var(--recompense);
  font-size: var(--text-lead);
  cursor: pointer;
  transition: border-color var(--duree-courte) var(--ease-sortie),
              background var(--duree-courte) var(--ease-sortie);
}
.demo__fleche:hover:not([disabled]) {
  border-color: var(--recompense-a30);
  background: var(--recompense-a10);
}
.demo__fleche[disabled] { opacity: .25; cursor: default; }

/* Sans JavaScript, les commandes de pas-à-pas n'ont pas d'objet. */
.demo:not(.demo--js) .demo__progression,
.demo:not(.demo--js) .demo__commandes { display: none; }

/* ---------- Écrans larges ---------- */
@media (min-width: 720px) {
  .demo__inner { max-width: var(--largeur-texte); }
  .demo__ecran { padding: var(--space-4); }
  .demo__tirage { font-size: var(--text-small); }
}

@media (prefers-reduced-motion: reduce) {
  .demo--js .demo__piste { transition: none; }
  .demo__cible { transition: none; }
}

/* ==========================================================================
   Blocs de communication au-dessus de la visite (S199-5 lot 1, habillés S199-6).
   Même contrat : tokens uniquement. Recettes transposées d'index.html :
   badge et titre métal du héros, voile de .saison__bg/.coeff__bg (en color-mix
   sur var(--fond), aucun rgba littéral), flèche .hero__scroll, duo .app__grid,
   cadre téléphone .iphone (jetons à la place de ses couleurs codées en dur).
   ========================================================================== */

/* ---------- Bloc 1 : héros duo texte + téléphone ---------- */
.comm-hero {
  position: relative;
  min-height: 92svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 115%, var(--energie-a12), transparent 55%),
    var(--fond);
}
.comm-hero__duo {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: var(--space-5);
  align-items: center;
  max-width: var(--largeur-contenu);
  margin: 0 auto;
  width: 100%;
  padding: 7rem var(--space-3) var(--space-6);
}
.comm__badge {
  display: inline-block;
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--recompense-vive);
  border: var(--border-recompense);
  background: var(--recompense-a10);
  border-radius: var(--rayon-bouton);
  padding: .5em 1.3em;
  margin-bottom: var(--space-3);
}
.comm-hero__titre {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  line-height: .96;
  letter-spacing: .015em;
  font-weight: 400;
  background: var(--recompense-metal);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--recompense);
  filter: drop-shadow(var(--glow-titre));
  margin-bottom: var(--space-3);
}
.comm__corps {
  font-size: var(--text-lead);
  font-weight: 300;
  color: var(--texte);
  max-width: 42rem;
  margin: 0 0 var(--space-2);
}
.comm__corps--final {
  color: var(--recompense-vive);
  font-weight: 400;
}
.comm__cta { margin-top: var(--space-4); }

/* Le téléphone — transposition en jetons du composant .iphone d'index.html,
   aspect calé sur les captures recadrées (640 × 1124 + 10px de lunette). */
.comm-phone {
  position: relative;
  z-index: 1;
  width: min(290px, 74vw);
  aspect-ratio: 660 / 1144;
  justify-self: center;
  border-radius: 44px;
  background: var(--surface-haute);
  border: 3px solid var(--ligne);
  box-shadow:
    inset 0 0 0 2px var(--fond),
    0 30px 80px color-mix(in srgb, var(--fond) 65%, transparent),
    var(--bloom-recompense);
  padding: 10px;
  animation: comm-flotte 7s ease-in-out infinite;
}
.comm-phone__ilot {
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  width: 84px; height: 22px;
  border-radius: 999px;
  background: var(--fond);
  z-index: 5;
}
.comm-phone__ecran {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 34px;
  background: var(--fond);
  overflow: hidden;
}
/* Sans JavaScript : seule la première image (marquée --actif dans le HTML)
   est visible — jamais de cadre vide. Le script ne fait que déplacer la marque. */
.comm-phone__img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--duree-longue) var(--ease-sortie);
}
.comm-phone__img--actif { opacity: 1; }
@keyframes comm-flotte {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* La flèche d'invitation — recette de .hero__scroll d'index.html */
.comm-hero__scroll {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: var(--texte-attenue);
  font-size: 1.4rem;
  animation: comm-flotte-fleche 2.4s ease-in-out infinite;
}
.comm-hero__scroll:hover { color: var(--recompense); }
@keyframes comm-flotte-fleche {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------- Blocs 2 à 5 : fonds photographiques + alternance ---------- */

/* ⬇️ ATTRIBUTION DES FONDS — proposition à corriger ICI, une ligne par bloc. */
.comm-bloc--2 { --comm-fond-image: url('../img/preinscription.jpg'); }
.comm-bloc--3 { --comm-fond-image: url('../img/jeu.jpg'); }
.comm-bloc--4 { --comm-fond-image: url('../img/hero.jpg'); }
.comm-bloc--5 { --comm-fond-image: url('../img/saison.jpg'); }

.comm-bloc {
  position: relative;
  overflow: hidden;
  text-align: left;
}
/* Voile : opaque du côté du texte, ouvert du côté de la photo —
   même logique que .coeff__bg, en color-mix sur var(--fond). */
.comm-bloc__fond {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--fond) 93%, transparent) 0%,
      color-mix(in srgb, var(--fond) 72%, transparent) 55%,
      color-mix(in srgb, var(--fond) 38%, transparent) 100%),
    var(--comm-fond-image) center / cover no-repeat,
    var(--fond);
}
.comm-bloc--droite .comm-bloc__fond {
  background:
    linear-gradient(270deg,
      color-mix(in srgb, var(--fond) 93%, transparent) 0%,
      color-mix(in srgb, var(--fond) 72%, transparent) 55%,
      color-mix(in srgb, var(--fond) 38%, transparent) 100%),
    var(--comm-fond-image) center / cover no-repeat,
    var(--fond);
}
.comm-bloc .section__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 34rem) 1fr;
}
.comm-bloc--droite .section__inner {
  grid-template-columns: 1fr minmax(0, 34rem);
}
.comm-bloc--droite .comm-bloc__texte { grid-column: 2; }
.comm-bloc .comm__corps { color: var(--texte); }
.comm-bloc .comm__corps--final { color: var(--recompense-vive); }
.comm-bloc--metal .section__titre {
  background: var(--recompense-metal);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--recompense);
  filter: drop-shadow(var(--glow-titre));
}

/* ---------- Écrans étroits : tout en colonne, téléphone sous le texte ---------- */
@media (max-width: 860px) {
  .comm-hero { min-height: auto; }
  .comm-hero__duo {
    grid-template-columns: 1fr;
    padding-top: 6rem;
    padding-bottom: 5.5rem;
  }
  .comm-phone { margin-top: var(--space-4); }
  .comm-bloc .section__inner,
  .comm-bloc--droite .section__inner { grid-template-columns: 1fr; }
  .comm-bloc--droite .comm-bloc__texte { grid-column: 1; }
  /* en colonne, le voile devient vertical pour garder le texte lisible */
  .comm-bloc__fond,
  .comm-bloc--droite .comm-bloc__fond {
    background:
      linear-gradient(180deg,
        color-mix(in srgb, var(--fond) 93%, transparent) 0%,
        color-mix(in srgb, var(--fond) 78%, transparent) 100%),
      var(--comm-fond-image) center / cover no-repeat,
      var(--fond);
  }
}

@media (prefers-reduced-motion: reduce) {
  /* accessibilité : plus de flottement, plus de fondu — l'écran 1 reste affiché
     (le script du carrousel ne démarre pas non plus, voir demo.js) */
  .comm-phone, .comm-hero__scroll { animation: none; }
  .comm-phone__img { transition: none; }
}

/* ---------- Annonce de la visite (raccord communication → mode d'emploi, S199-7) ----------
   Grammaire des blocs : surtitre or + titre display. Le repère de défilement est
   volontairement discret — un libellé, pas un bouton. Jetons uniquement. */
.demo-annonce {
  text-align: center;
  margin-bottom: var(--space-4);
}
.demo-annonce .section__titre {
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-1);
}
.demo-annonce .section__sur { text-align: center; }
.demo-annonce__scroll {
  font-size: var(--text-small);
  color: var(--texte-attenue);
  letter-spacing: .08em;
}
