/* ============================================================
   create/ : une promenade en forêt, en noir et blanc.

   Deux régimes pour un même HTML :
   · .js.mode-3d  la forêt tourne : une station à la fois, pas de défilement ;
   · sans 3D      (WebGL absent, robot, script bloqué) : un document qui se lit
                  de haut en bas, médias compris. C'est aussi ce que voit un
                  moteur de recherche, d'où le soin porté au HTML.
   ============================================================ */

:root {
  --noir: #000;
  --nuit: #07080a;
  --blanc: #f4f4f2;
  --gris-1: #c9cacb;
  --gris-2: #8d8f92;
  --gris-3: #4a4c50;
  --trait: rgba(255, 255, 255, 0.16);
  --voile: rgba(0, 0, 0, 0.55);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --texte: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --marge: clamp(16px, 3.2vw, 44px);
  --panneau: min(440px, 36vw);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--noir); }
body {
  margin: 0;
  background: var(--noir);
  color: var(--blanc);
  font: 400 16px/1.55 var(--texte);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blanc); outline-offset: 3px; border-radius: 4px; }
em { font-style: italic; }

/* ---------- Typographie commune ---------- */
.sur {
  margin: 0 0 14px;
  font: 500 12px/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gris-2);
}
.station h1, .station h2 {
  margin: 0 0 16px;
  font: 400 clamp(38px, 4.6vw, 68px)/0.98 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.station h1 em, .station h2 em { color: var(--gris-1); }
.chapo { margin: 0 0 18px; color: var(--gris-1); max-width: 46ch; font-weight: 300; }
.prix { margin: 0 0 14px; font: 400 15px/1.3 var(--texte); color: var(--gris-1); }
.prix strong { font: 400 30px/1 var(--serif); color: var(--blanc); margin-right: 6px; }

.bouton {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px;
  border: 1px solid var(--blanc);
  border-radius: 999px;
  background: var(--blanc);
  color: var(--noir);
  font: 500 14px/1 var(--texte);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.bouton:hover { background: transparent; color: var(--blanc); }
.bouton.ligne { background: transparent; color: var(--blanc); }
.bouton.ligne:hover { background: var(--blanc); color: var(--noir); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0; }
.liens { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 18px 0 0; font-size: 14px; color: var(--gris-2); }
.liens a, .lien {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--gris-1); text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: var(--gris-3);
}
.liens a:hover, .lien:hover { color: var(--blanc); text-decoration-color: var(--blanc); }

.sujets { list-style: none; margin: 0; padding: 0; }
.sujet h3 { margin: 0 0 4px; font: 400 26px/1.1 var(--serif); }
.sujet p { margin: 0 0 6px; color: var(--gris-1); font-size: 15px; font-weight: 300; }
.sujet .prompt {
  margin-top: 10px;
  font: 400 12px/1.55 var(--mono);
  color: var(--gris-2);
}
.sujet .prompt::before { content: "prompt  "; color: var(--gris-3); }

/* ============================================================
   RÉGIME DOCUMENT (sans 3D)
   ============================================================ */
.contenu { padding: 110px var(--marge) 40px; max-width: 1180px; margin: 0 auto; }
.station { padding: 40px 0 56px; border-bottom: 1px solid var(--trait); }
.station .sujets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 22px; margin-top: 26px; }
.sujet .media { margin-top: 12px; width: 100%; height: auto; border-radius: 6px; background: #111; }
.pied { padding: 28px var(--marge) 48px; color: var(--gris-2); font-size: 13px; max-width: 1180px; margin: 0 auto; }
.pied p { margin: 0 0 6px; }

.tete {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--marge) 14px;
  pointer-events: none;
}
.tete > * { pointer-events: auto; }
.marque { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.marque img { width: 44px; height: 44px; }
.son {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: 1px solid var(--trait); border-radius: 999px;
  background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(6px);
  font: 400 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer;
}
.son svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.son .haut-parleur { fill: currentColor; stroke: none; }
.son .barre { display: none; }
.son[aria-pressed="false"] .ondes { display: none; }
.son[aria-pressed="false"] .barre { display: inline; }
.son[aria-pressed="false"] span { color: var(--gris-2); }

.secours {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
  width: min(560px, calc(100% - 32px));
  margin: 0; padding: 12px 16px; border: 1px solid var(--trait); border-radius: 10px;
  background: rgba(0, 0, 0, 0.85); color: var(--gris-1); font-size: 14px;
}

/* ============================================================
   CHARGEMENT
   ============================================================ */
.chargeur { display: none; }
.js .chargeur {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: max(18px, env(safe-area-inset-top)) var(--marge) max(22px, env(safe-area-inset-bottom));
  background: var(--noir);
  transition: opacity 1.4s var(--ease), visibility 1.4s;
}
.chargeur.parti { opacity: 0; visibility: hidden; pointer-events: none; }
.ch-bruit { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: auto; opacity: 0.6; }
.js .chargeur::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.55), transparent 65%), linear-gradient(0deg, rgba(0,0,0,0.6), transparent 45%);
}
.ch-haut, .ch-centre, .ch-bas { position: relative; }
.ch-haut {
  display: flex; justify-content: space-between;
  font: 400 12px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gris-2);
}
.ch-centre { align-self: center; justify-self: start; }
.ch-sur { margin: 0 0 18px; font: 500 12px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gris-1); }
.ch-titre {
  margin: 0; font: 400 clamp(46px, 8.4vw, 132px)/0.9 var(--serif); letter-spacing: -0.02em;
}
.ch-titre em { color: var(--gris-1); }
.ch-chapo { margin: 22px 0 0; max-width: 34ch; color: var(--gris-1); font: 300 clamp(15px, 1.4vw, 19px)/1.5 var(--texte); }
.ch-bas { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 18px 32px; }
.ch-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; max-width: 420px; font: 400 12px/1.2 var(--mono); color: var(--gris-2); }
.ch-liste li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.ch-liste li.fini { color: var(--blanc); }
.ch-liste .taille { color: var(--gris-2); margin-right: 10px; }
.ch-liste li.manque .etat { color: var(--gris-2); }
.ch-liste .barre { grid-column: 1 / -1; height: 1px; background: var(--trait); overflow: hidden; }
.ch-liste .barre i { display: block; height: 100%; width: 0; background: var(--blanc); transition: width 0.25s linear; }
.ch-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.ch-entrer {
  position: relative; overflow: hidden; margin: 0;
  display: inline-flex; align-items: center; gap: 14px;
  padding: 18px 30px; border: 1px solid var(--blanc); border-radius: 999px;
  background: transparent; color: var(--blanc);
  font: 500 15px/1 var(--texte); letter-spacing: 0.02em; cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
.ch-entrer b { font: 400 13px/1 var(--mono); color: var(--gris-2); }
.ch-entrer { cursor: progress; border-color: var(--gris-3); color: var(--gris-1); }
.ch-conseil { grid-column: 1 / -1; margin: 0; font: 400 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gris-3); }

/* ============================================================
   RÉGIME PROMENADE (la 3D tourne)
   ============================================================ */
.vue { display: none; }
.mode-3d, .mode-3d body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.mode-3d body { position: fixed; inset: 0; touch-action: none; }
.mode-3d .vue { display: block; position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
.mode-3d .grain {
  position: fixed; inset: -50%; z-index: 5; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.4 -0.2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-4%, 3%); } 40% { transform: translate(3%, -5%); }
  60% { transform: translate(-6%, -2%); } 80% { transform: translate(5%, 4%); } 100% { transform: translate(0, 0); }
}

.mode-3d .contenu {
  position: fixed; z-index: 10;
  left: var(--marge); bottom: 108px; top: auto;
  width: var(--panneau); max-width: none; margin: 0; padding: 0;
  pointer-events: none;
}
/* Un voile sombre derrière le texte, pour qu'il se lise sur n'importe quel plan. */
.mode-3d .contenu::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: 0; bottom: 0; width: calc(var(--panneau) + var(--marge) * 3); height: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,0.62), rgba(0,0,0,0.3) 62%, transparent);
  opacity: var(--voile-op, 1); transition: opacity 0.8s;
}
.mode-3d .station {
  position: absolute; left: 0; bottom: 0; width: 100%;
  padding: 0; border: 0;
  opacity: 0; visibility: hidden; transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.9s var(--ease), visibility 0.7s;
}
.mode-3d .station.active { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.mode-3d .station .sujets { display: block; margin: 18px 0 0; min-height: 0; }
.mode-3d .sujet { display: none; }
.mode-3d .sujet.actif { display: block; animation: sujet 0.6s var(--ease); }
.mode-3d .sujet .media { display: none; }
/* Les prompts restent dans le HTML (référencement, page sans 3D), pas dans la promenade. */
.mode-3d .sujet .prompt { display: none; }
.mode-3d .pied { display: none; }
.mode-3d #lisiere { display: none; }
.mode-3d .station h1, .mode-3d .station h2 { font-size: clamp(40px, 4.4vw, 72px); }
.mode-3d #contact .liens, .mode-3d #contact .actions { pointer-events: auto; }
@keyframes sujet { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Mots qui se révèlent un à un à l'arrivée dans une station */
.mot { display: inline-block; opacity: 0; transform: translateY(0.35em); filter: blur(6px); }
.station.active .mot {
  opacity: 1; transform: none; filter: none;
  transition: opacity 0.8s var(--ease), transform 0.9s var(--ease), filter 0.8s var(--ease);
  transition-delay: calc(var(--i) * 45ms + 120ms);
}

/* Vignettage et fondu au noir (mouvement réduit), par-dessus la 3D. */
.mode-3d body::after {
  content: ""; position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 45%, transparent 55%, rgba(0,0,0,0.32) 100%);
}
.fondu { position: fixed; inset: 0; z-index: 40; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.fondu.noir { opacity: 1; }

/* ---------- Continuer : passer à l'étape suivante ---------- */
.suite { display: none; }
.mode-3d .suite {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 18px;
  padding: 13px 18px 13px 22px; border-radius: 999px;
  border: 1px solid var(--blanc); background: var(--blanc); color: var(--noir);
  font: 400 14px/1 var(--texte); cursor: pointer; transition: transform 0.25s var(--ease);
}
.mode-3d .suite b { font-weight: 600; }
.mode-3d .suite svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; animation: suite 1.8s ease-in-out infinite; }
.mode-3d .suite:hover { transform: translateY(-2px); }
@keyframes suite { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(3px); } }
.mode-3d .pilote .suite { margin-top: 0; justify-content: center; }

/* ---------- Le sentier (navigation basse) ---------- */
/* Un voile clair sous le sentier : ses noms restent lisibles sur la canopée. */
.mode-3d body::before {
  content: ""; position: fixed; z-index: 9; left: 0; right: 0; bottom: 0; height: 100px; pointer-events: none;
  background: linear-gradient(0deg, rgba(236, 230, 220, 0.6), transparent);
}
.sentier {
  position: fixed; z-index: 15; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(760px, calc(100% - var(--marge) * 2));
  display: grid; grid-template-columns: repeat(var(--n), 1fr); align-items: start;
}
.sentier::before, .sentier .avance {
  content: ""; position: absolute; top: 5px; left: calc(50% / var(--n)); height: 1px;
}
.sentier::before { right: calc(50% / var(--n)); background: var(--trait); }
.sentier .avance { width: calc((100% - 100% / var(--n)) * var(--p, 0)); background: var(--blanc); transition: width 0.1s linear; }
.sentier button {
  position: relative; display: grid; justify-items: center; gap: 9px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 400 11px/1.15 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gris-2);
}
.sentier .court { display: none; }
.sentier button i {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid var(--gris-2); background: var(--noir);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.sentier button.sous i { width: 7px; height: 7px; margin-top: 2px; }
.sentier button:hover { color: var(--blanc); }
.sentier button.passe i { border-color: var(--blanc); background: var(--blanc); }
.sentier button.ici { color: var(--blanc); }
.sentier button.ici i { transform: scale(1.35); border-color: var(--blanc); background: var(--blanc); box-shadow: 0 0 12px rgba(255,255,255,0.6); }

/* ---------- Pilote : œuvre précédente / suivante ---------- */
.pilote {
  position: fixed; z-index: 15;
  right: var(--marge); bottom: 100px;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
}
.pilote-ligne { display: flex; align-items: center; gap: 6px; }
.pilote-ligne button {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--trait); background: rgba(0,0,0,0.35); backdrop-filter: blur(6px); cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}
.pilote-ligne button:hover { border-color: var(--blanc); background: rgba(255,255,255,0.08); }
.pilote-ligne svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pilote .lecture svg { fill: currentColor; stroke: none; }
.pilote .lecture .i-pause { display: none; }
.pilote .lecture.en-cours .i-play { display: none; }
.pilote .lecture.en-cours .i-pause { display: inline; }
.compte { min-width: 100px; text-align: center; font: 400 13px/1 var(--mono); color: var(--gris-1); letter-spacing: 0.08em; }

/* ---------- Aide (molette, glisser) ---------- */
.aide {
  position: fixed; z-index: 15; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 14px); transform: translateX(-50%);
  margin: 0; display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  font: 400 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gris-1);
  animation: aide 2.4s ease-in-out infinite;
}
.aide::before {
  content: ""; width: 14px; height: 22px; border: 1px solid currentColor; border-radius: 8px;
  background: radial-gradient(circle at 50% 30%, currentColor 1.5px, transparent 2px);
}
.aide.tactile::before { width: 16px; height: 16px; border-radius: 50%; background: none; }
@keyframes aide { 0%, 100% { opacity: 0.45; transform: translate(-50%, 0); } 50% { opacity: 1; transform: translate(-50%, -5px); } }

/* ============================================================
   PETITS ÉCRANS : le panneau passe en bas, la 3D au-dessus
   ============================================================ */
@media (max-width: 820px), (orientation: portrait) and (max-width: 1024px) {
  :root { --panneau: auto; }
  .mode-3d .contenu { left: var(--marge); right: var(--marge); width: auto; bottom: 132px; }
  .mode-3d .contenu::before {
    left: 0; right: 0; width: auto; height: 62%;
    background: linear-gradient(0deg, rgba(0,0,0,0.88), rgba(0,0,0,0.55) 55%, transparent);
  }
  .mode-3d .station h1, .mode-3d .station h2 { font-size: clamp(32px, 8.6vw, 46px); margin-bottom: 10px; }
  .mode-3d .chapo { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
  .mode-3d .station .sujets { margin-top: 10px; }
  .mode-3d .sujet h3 { font-size: 22px; }
  .mode-3d .sujet p { font-size: 14px; }
  .mode-3d .sujet .prompt { display: none; }
  .mode-3d .prix { margin-bottom: 8px; }
  .pilote { left: var(--marge); right: var(--marge); bottom: 70px; }
  .pilote-ligne { justify-content: space-between; }
  .pilote-ligne button { width: 44px; height: 44px; }
  .mode-3d .contenu { bottom: 190px; }
  /* Shorts : le texte le plus long du parcours. Sur petit écran, on garde le titre, le
     prix et le short affiché ; le chapeau et le bouton de commande (présent aussi au
     Contact) laissent la place à la vidéo. */
  .mode-3d #shorts .chapo, .mode-3d #shorts .actions { display: none; }
  /* Étape sans flèches (Contact) : le texte redescend à sa place. */
  .mode-3d body:has(#pilote[hidden]) .contenu { bottom: 76px; }
  .compte { flex: 1; font-size: 12px; }
  .sentier { bottom: max(14px, env(safe-area-inset-bottom)); }
  .sentier .nom { display: none; }
  .sentier .court { display: block; font-size: 9px; letter-spacing: 0.04em; white-space: nowrap; }
  .sentier button { gap: 7px; padding-top: 4px; }
  .aide { top: calc(max(14px, env(safe-area-inset-top)) + 64px); white-space: normal; width: max-content; max-width: calc(100% - 2 * var(--marge)); text-align: center; line-height: 1.5; }
  .ch-bas { grid-template-columns: 1fr; }
  .ch-actions { align-items: stretch; }
  .ch-entrer { justify-content: center; }
}
/* Écran court (téléphone couché) : on resserre tout. */
@media (max-height: 520px) and (orientation: landscape) {
  .mode-3d .contenu { bottom: 64px; width: min(400px, 46vw); }
  .mode-3d .chapo, .mode-3d .sujet p:not(:first-of-type), .mode-3d .sujet .prompt { display: none; }
  .mode-3d .station h1, .mode-3d .station h2 { font-size: 30px; }
  .pilote { bottom: 64px; }
  .sentier { bottom: 10px; }
  .sentier button span { display: none; }
  .aide { top: 12px; }
}

/* ============================================================
   PETIT MATIN : la forêt est claire, l'interface passe à l'encre.
   On inverse les couleurs dans le seul périmètre de l'interface de
   promenade (l'écran de chargement, lui, reste noir).
   ============================================================ */
.mode-3d .contenu, .mode-3d .tete, .mode-3d .sentier, .mode-3d .pilote, .mode-3d .aide {
  --blanc: #121314;
  --noir: #f4f4f2;
  --gris-1: #2b2d30;
  --gris-2: #54575b;
  --gris-3: #8b8e92;
  --trait: rgba(0, 0, 0, 0.2);
  color: var(--blanc);
}
.mode-3d .station h1 em, .mode-3d .station h2 em { color: var(--gris-2); }
.mode-3d .marque img { filter: invert(1); }
.mode-3d .contenu::before { background: linear-gradient(90deg, rgba(236,230,220,0.74), rgba(236,230,220,0.38) 62%, transparent); }
.mode-3d .son, .mode-3d .pilote-ligne button { background: rgba(255, 255, 255, 0.5); }
.mode-3d .compte { padding: 9px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.62); color: var(--blanc); }
.mode-3d .pilote-ligne button:hover { background: rgba(255, 255, 255, 0.8); border-color: var(--blanc); }
.mode-3d .sentier button.ici i { box-shadow: 0 0 12px rgba(0, 0, 0, 0.25); }
.mode-3d .grain { opacity: 0.05; }
@media (max-width: 820px), (orientation: portrait) and (max-width: 1024px) {
  .mode-3d .contenu::before { background: linear-gradient(0deg, rgba(236,230,220,0.88), rgba(236,230,220,0.58) 55%, transparent); }
}

.mode-3d .aide { top: calc(max(12px, env(safe-area-inset-top)) + 66px); }
.propre .ia-bouton, .propre .assistant { display: none !important; }
.mode-3d:not(.ia-prete) .assistant { display: none; } /* script de l'assistant absent : pas de bloc par-dessus la forêt */

/* Captures sans interface (images de partage et de chargement) */
.propre .tete, .propre .contenu, .propre .sentier, .propre .pilote, .propre .aide { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .mode-3d .grain, .aide { animation: none; }
  .mot { opacity: 1; transform: none; filter: none; }
  * { transition-duration: 0.01ms !important; }
}
