/* BodyBoard — contrats ARENA-BG-01 et JARVIS-HUD-01.
   Chargé après la feuille du prototype : il ne la remplace pas, il la précise
   là où le protocole fixe des valeurs. */

:root {
  --arena-black: #010711;
  --arena-bg: #050b13;
  --arena-blue-deep: #021023;
  --arena-blue-mid: #072541;
  --cyan: #64e6f5;
  --cyan-strong: #23c8f1;
  --cyan-soft: rgba(100, 230, 245, .18);
  --text: #e7f2f7;
  --muted: #8aa1af;
  --volt: #d7ff3e;
}

/* --- LAYER 1 + 2 : le vide, puis l'atmosphère cyan derrière l'athlète ---- */
.experience {
  background:
    radial-gradient(ellipse at 50% 48%,
      rgba(7, 37, 65, .95) 0%,
      rgba(2, 16, 35, .88) 42%,
      rgba(1, 7, 17, 1) 76%),
    var(--arena-black);
}

/* --- LAYER 5 : finition d'écran. Scanlines + vignette, rien de plus ------
   Le grain reste sous 0,06 : au-delà, il dégrade le visage et le texte. */
.screen-finish {
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg,
      rgba(0, 0, 0, .07) 0, rgba(0, 0, 0, .07) 1px,
      transparent 1px, transparent 4px);
  box-shadow: inset 0 0 100px rgba(0, 0, 0, .40);
  opacity: 1;
}
.screen-finish::after {
  content: "";
  position: absolute; inset: 0;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* =======================================================================
   JARVIS-HUD-01 — la console est une interface projetée, pas une carte.
   ======================================================================= */
.bb-console {
  width: clamp(340px, 27vw, 380px);
  right: 40px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(4, 20, 33, .84), rgba(3, 13, 23, .56));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(100, 230, 245, .20);
  box-shadow: none;
  /* Coins coupés : la surface se lit comme un panneau technique, pas comme
     un rectangle arrondi de tableau de bord. */
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px),
                     calc(100% - 14px) 100%, 0 100%, 0 14px);
}

/* Deux accents seulement, en diagonale. Pas de bordure lumineuse complète. */
.bb-console::before,
.bb-console::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border: 1px solid rgba(100, 230, 245, .55);
  pointer-events: none;
}
.bb-console::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.bb-console::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.bb-console-title { font-size: 9px; letter-spacing: .16em; }
.bb-console-title small { display: block; margin-top: 6px; letter-spacing: .14em; }
.bb-step-pane h2 { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.15; }
.bb-field-tag { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.bb-input-wrap input { font-size: 17px; }
.bb-live-url, .bb-metric strong, .bb-step-counter { font-size: 12px; letter-spacing: .1em; }

/* --- morphing d'étape : 300 ms, une passe de scanner, pas de cinéma ----- */
/* L'état actif ne dépend JAMAIS d'une animation : il est déclaré ici.
   L'animation ne fait que l'atteindre — si elle est coupée, désactivée par
   `prefers-reduced-motion` ou interrompue, le panneau reste lisible. */
.bb-step-pane.is-active {
  opacity: 1;
  transform: none;
  animation: bb-morph 300ms cubic-bezier(.2, .75, .2, 1) forwards;
}
.bb-step-pane.is-active h2 { animation: bb-morph-titre 300ms 180ms backwards; }
.bb-step-pane.is-active .bb-input-wrap,
.bb-step-pane.is-active .bb-mini-grid,
.bb-step-pane.is-active .bb-metric-grid { animation: bb-morph-champs 300ms 220ms backwards; }
.bb-console__scanner {
  position: absolute; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0; pointer-events: none;
}
.bb-console.is-morphing .bb-console__scanner { animation: bb-scanner 220ms 80ms linear; }

@keyframes bb-morph { from { opacity: .25; transform: translateY(5px) } to { opacity: 1; transform: none } }
@keyframes bb-morph-titre { from { opacity: 0; transform: translateY(6px) } }
@keyframes bb-morph-champs { from { opacity: 0; transform: translateY(8px) } }
@keyframes bb-scanner { 0% { top: 0; opacity: .9 } 100% { top: 100%; opacity: 0 } }

/* --- étape 04 : le volt peut dominer, et seulement là ------------------- */
.bb-console[data-step="4"] .bb-primary {
  background: var(--volt); color: #10160a;
}
.bb-console[data-step="4"] { border-color: rgba(215, 255, 62, .38); }

/* --- mobile : un dock, pas une modale ---------------------------------- */
@media (max-width: 900px) {
  .bb-console {
    width: auto;
    left: 12px; right: 12px; bottom: 12px;
    top: auto; transform: none;
    max-height: 230px;
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px),
                       calc(100% - 12px) 100%, 0 100%, 0 12px);
  }
  /* Clavier ouvert : le sujet recule, l'entrée et le CTA restent visibles. */
  .clavier-ouvert .subject { transform: scale(.87); transform-origin: 50% 22%; }
  .clavier-ouvert .bb-carousel-zone,
  .clavier-ouvert .bb-message p,
  .clavier-ouvert .bb-hud__socle { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bb-step-pane.is-active,
  .bb-step-pane.is-active h2,
  .bb-step-pane.is-active .bb-input-wrap,
  .bb-console.is-morphing .bb-console__scanner { animation: none; }
  /* Couper l'animation ne doit rien effacer : on réaffirme l'état visible. */
  .bb-step-pane.is-active { opacity: 1; transform: none; }
  .bb-step-pane.is-active h2,
  .bb-step-pane.is-active .bb-input-wrap,
  .bb-step-pane.is-active .bb-mini-grid,
  .bb-step-pane.is-active .bb-metric-grid { opacity: 1; transform: none; }
}

/* =======================================================================
   CREATOR-CAROUSEL-01 — des hologrammes, pas un carrousel horizontal.
   Le corps reste le héros : les cartes font 10–16vh contre 70–80vh pour le
   sujet, et vivent autour du podium, jamais devant le torse.
   ======================================================================= */
.creator-scene {
  position: absolute; inset: 0;
  perspective: 900px;
  transform-style: preserve-3d;
}

.creator-hologram {
  position: absolute;
  width: 220px; height: 120px;
  padding: 12px 14px;
  display: grid; align-content: start; gap: 3px;
  background: linear-gradient(135deg, rgba(7, 31, 46, .60), rgba(2, 10, 18, .22));
  border: 1px solid rgba(100, 230, 245, .18);
  backdrop-filter: blur(5px);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px),
                     calc(100% - 10px) 100%, 0 100%, 0 10px);
  color: var(--text, #e7f2f7);
  font-family: var(--ds-font-mono, ui-monospace, monospace);
  cursor: pointer;
  transition: border-color .3s ease, box-shadow .3s ease;
  will-change: transform, opacity;
}
.creator-hologram[data-active="true"] {
  border-color: rgba(100, 230, 245, .65);
  box-shadow: 0 0 26px rgba(35, 200, 241, .12);
}

.creator-hologram__nom { font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.creator-hologram__sport { font-size: 9px; letter-spacing: .16em; color: var(--muted, #8aa1af); }
.creator-hologram__prix { font-size: 11px; color: var(--cyan, #64e6f5); letter-spacing: .1em; }

/* Seule la carte active déplie son détail : six blocs de texte simultanés
   ne se lisent pas. */
.creator-hologram__detail {
  display: none;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(100, 230, 245, .16);
  gap: 2px;
}
.creator-hologram[data-active="true"] .creator-hologram__detail { display: grid; }
.creator-hologram__event { font-size: 10px; letter-spacing: .1em; }
.creator-hologram__ville { font-size: 9px; color: var(--muted, #8aa1af); letter-spacing: .12em; }
.creator-hologram__lien {
  margin-top: 4px; font-size: 10px; letter-spacing: .12em;
  color: var(--cyan, #64e6f5); text-decoration: none;
}
.creator-hologram__lien--demo { color: var(--muted, #8aa1af); }
.creator-hologram:focus-visible { outline: 1px solid var(--cyan, #64e6f5); outline-offset: 3px; }

@media (max-width: 900px) {
  .creator-hologram { width: 150px; height: 92px; padding: 9px 10px; }
  .creator-hologram__nom { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .creator-hologram { transition: none; }
}

/* P0 VISUAL 02 — le premier rendu ne dépend jamais de la réussite du JS.
   Tant que la scène n'a pas signalé `is-arena-ready`, le sujet est centré par
   la CSS ; ensuite la projection prend le relais et pose les pieds sur le
   podium. Sans cela, un échec du moteur décalait le corps de 80 px. */
.stage:not(.is-arena-ready) .subject {
  left: 50%;
  transform: translateX(-50%);
}
.stage.is-arena-ready .subject { transform: none; }

/* P0 VISUAL 03 — la télémétrie sort du torse : elle vit dans le couloir
   entre le sujet et la console. */
.bb-hud__telemetrie {
  left: calc(100% + 18px);
  top: 27%;
  width: 150px;
}
@media (max-width: 900px) { .bb-hud__telemetrie { display: none; } }

/* =======================================================================
   BLOCKER 03 — le formulaire disparaissait sous le pli.

   Cause : le prototype pose `min-height:378px` sur la console et 304 px sur
   son corps. En CSS, `min-height` l'emporte sur `max-height` : le dock mobile
   ne pouvait pas se compacter, et à partir de l'étape 02 le contenu sortait
   du dock sans que rien ne défile — le champ e-mail, le mot de passe et le
   CTA final devenaient inatteignables.

   Correction en trois temps : on lève le plancher, on compacte par état, et
   on garde un défilement *interne* au dock comme filet — jamais un
   défilement de document.
   ======================================================================= */
@media (max-width: 900px) {
  .bb-console {
    min-height: 0;
    max-height: min(230px, 46dvh);
    display: flex;
    flex-direction: column;
  }
  .bb-console-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 4px;
  }
  .bb-step-pane.is-active { min-height: 0; }

  /* Le CTA reste collé au bas du panneau : quoi qu'il arrive au-dessus,
     l'action principale est visible. */
  .bb-step-pane .bb-primary {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    box-shadow: 0 -10px 18px -12px rgba(3, 13, 23, .9);
  }

  /* Compactage par état : on retire ce qui explique, on garde ce qui agit. */
  .bb-console-copy,
  .bb-console-label,
  .bb-ready-check,
  .bb-console-fine { display: none; }
  .bb-step-pane h2 { font-size: 15px; margin-bottom: 8px; }
  .bb-input-wrap { margin-bottom: 8px; }

  /* Étape 02 : événement et date sur une ligne. */
  .bb-row { display: grid; grid-template-columns: 1fr 116px; gap: 8px; }

  /* Étape 03 : les pastilles sur une ligne, les trois métriques deviennent
     une seule ligne technique. */
  .bb-mini-grid { display: flex; gap: 6px; }
  .bb-mini-grid .bb-chip { flex: 1; padding: 8px 4px; font-size: 11px; }
  .bb-metric-grid { display: none; }
  .bb-ligne-technique { display: block; }

  /* Étape 04 : la grande carte laisse place à deux lignes. */
  .bb-final-card { display: none; }
  .bb-final-compact { display: grid; }
}

/* Les variantes compactes n'existent que sur le dock. */
.bb-ligne-technique,
.bb-final-compact { display: none; }
.bb-ligne-technique {
  font: 600 11px/1.4 var(--ds-font-mono, ui-monospace, monospace);
  letter-spacing: .08em;
  color: var(--cyan, #64e6f5);
  margin: 2px 0 10px;
}
.bb-final-compact { gap: 2px; margin-bottom: 10px; }
.bb-final-compact b { font-size: 13px; letter-spacing: .04em; }
.bb-final-compact span {
  font: 600 11px/1.4 var(--ds-font-mono, ui-monospace, monospace);
  color: var(--cyan, #64e6f5); letter-spacing: .08em;
}

/* Écrans très courts : même règle, seuil sur la hauteur. */
@media (max-height: 620px) {
  .bb-console { min-height: 0; max-height: calc(100dvh - 24px); }
  .bb-console-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .bb-console-copy { display: none; }
}

/* =======================================================================
   Pied de liens, en surimpression.

   Le référencement se joue dans le `<head>` ; ces liens ne sont là que pour
   que les pages existent aux yeux d'un robot et restent atteignables au
   clavier. Donc : minuscules, en bas à gauche, **aucun fond**, et le
   conteneur ne capte pas le pointeur — seuls les liens le font. L'arène
   garde toute sa surface cliquable.
   ======================================================================= */
.arena-liens {
  position: absolute;
  left: 40px;
  bottom: 28px;
  z-index: 6;
  display: flex;
  gap: 14px;
  pointer-events: none;       /* la scène reste manipulable au travers */
  font: 500 8px/1.2 var(--ds-font-mono, ui-monospace, monospace);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.arena-liens a {
  pointer-events: auto;       /* seuls les liens sont cliquables */
  color: #4d6a78;
  text-decoration: none;
  transition: color .18s ease;
}
.arena-liens a:hover,
.arena-liens a:focus-visible { color: var(--cyan, #64e6f5); }
.arena-liens a:focus-visible { outline: 1px solid var(--cyan, #64e6f5); outline-offset: 3px; }

/* Sur le dock mobile, ils passent au-dessus de la console, alignés à gauche
   et encore plus discrets — jamais sous un doigt qui vise un champ. */
@media (max-width: 900px) {
  .arena-liens {
    left: 12px;
    bottom: calc(min(230px, 46dvh) + 20px);
    gap: 10px;
    font-size: 7px;
  }
}
@media (max-height: 620px) { .arena-liens { display: none; } }

/* =======================================================================
   BODY-SCAN-01 — l'arène commence vide, et invite à l'habiter.
   ======================================================================= */

/* Tant qu'aucun sujet n'existe, la photographie de référence n'a rien à faire
   là : montrer un athlète générique et demander un nom, c'est faire visiter.
   On montre une zone d'acquisition. */
body:not(.a-un-sujet) .subject .tattoo-overlay,
body:not(.a-un-sujet) #athletePhoto { display: none; }

.body-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  opacity: .32;
  filter: drop-shadow(0 0 18px rgba(100, 230, 245, .08));
  pointer-events: none;
}
body.a-un-sujet .body-placeholder { display: none; }
.body-placeholder svg { height: 100%; width: auto; }
.body-placeholder__attente {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font: 600 8px/1 var(--ds-font-clock, ui-monospace, monospace);
  letter-spacing: .22em; color: var(--cyan, #64e6f5); white-space: nowrap;
}

#athletePhoto { transition: opacity .18s linear; }

/* Le terminal d'acquisition. Pas un dépôt de fichiers : une prise de vue. */
.bb-photo-drop {
  position: relative;
  height: 154px;
  display: grid; place-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(7, 31, 46, .46), rgba(2, 10, 18, .20));
  border: 1px solid rgba(100, 230, 245, .15);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px),
                     calc(100% - 12px) 100%, 0 100%, 0 12px);
  cursor: pointer; text-align: center;
  transition: border-color .18s ease, background-color .18s ease;
}
.bb-photo-drop__plus { font-size: 26px; color: var(--cyan, #64e6f5); line-height: 1; }
.bb-photo-drop__titre { font: 600 10px/1 var(--ds-font-mono, monospace); letter-spacing: .16em; }
.bb-photo-drop__aide { font-size: 11px; color: var(--muted, #8aa1af); }
.bb-photo-drop__relacher {
  display: none;
  font: 600 10px/1 var(--ds-font-mono, monospace); letter-spacing: .18em;
  color: var(--cyan, #64e6f5);
}
.bb-photo-drop[data-dragging="true"] {
  border-color: rgba(100, 230, 245, .68);
  background: rgba(35, 200, 241, .08);
}
.bb-photo-drop[data-dragging="true"] .bb-photo-drop__plus,
.bb-photo-drop[data-dragging="true"] .bb-photo-drop__titre,
.bb-photo-drop[data-dragging="true"] .bb-photo-drop__aide { display: none; }
.bb-photo-drop[data-dragging="true"] .bb-photo-drop__relacher { display: block; }

.bb-photo-recue {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 10px;
  border: 1px solid rgba(100, 230, 245, .18);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px),
                     calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.bb-photo-recue img { width: 44px; height: 44px; object-fit: cover; }
.bb-photo-recue b { display: block; font-size: 11px; }
.bb-photo-recue small { display: block; font-size: 10px; color: var(--muted, #8aa1af); }
.bb-photo-recue i { margin-left: auto; color: var(--volt, #d7ff3e); font-style: normal; }

/* Sur téléphone, prendre la photo est l'action première. */
.bb-photo-mobile { display: none; gap: 8px; }
@media (max-width: 900px) {
  .bb-photo-drop { display: none; }
  .bb-photo-mobile { display: grid; }
}

/* Le carrousel s'efface tant que la personne n'est pas dans l'arène. */
body.sans-sujet .creator-hologram { opacity: .3 !important; }
body.sans-sujet .creator-hologram[data-active="true"] { opacity: .55 !important; }

@media (prefers-reduced-motion: reduce) {
  #athletePhoto { transition: none; }
}
