/* Orbe — démonstration « 3D au défilement » (ZataLabs, V7.7).
   Une scène WebGL collée à l'écran, cinq chapitres qui défilent devant.
   Aucun backdrop-filter au-dessus de la scène animée (coûteux sur mobile) :
   les textes reposent sur des dégradés opaques. */

:root {
  --nuit: #0b0d12;
  --nuit-2: #12151c;
  --encre: #eee8dc;
  --doux: #a9a59c;
  --laiton: #c9a063;
  --laiton-clair: #e3c28c;
  --trait: rgb(238 232 220 / .12);
  --serif: "Bodoni Moda", "Didot", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --lumiere: 0;
  --lx: 70%;
  --ly: 45%;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--nuit);
  color: var(--encre);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.05; letter-spacing: -.01em; margin: 0; }
em { font-style: italic; color: var(--laiton-clair); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--laiton-clair); outline-offset: 3px; border-radius: 4px; }

.evitement { position: absolute; left: -999px; top: .5rem; z-index: 50; padding: .6rem 1rem; background: var(--encre); color: var(--nuit); border-radius: 8px; }
.evitement:focus { left: .5rem; }

.surtitre {
  margin: 0 0 1rem;
  font: 600 .75rem/1.3 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--laiton);
}

/* ---------- En-tête ---------- */
.entete {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--trait);
}
.logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font: 500 1.35rem/1 var(--serif); letter-spacing: .02em; }
.logo svg { width: 28px; height: 28px; fill: var(--laiton); }
.entete__nav { display: flex; gap: 1.6rem; margin-left: auto; }
.entete__nav a, .entete__appel { text-decoration: none; font-size: .92rem; color: var(--doux); transition: color .2s; }
.entete__nav a:hover { color: var(--encre); }
.entete__appel {
  padding: .5rem 1rem;
  border: 1px solid var(--laiton);
  border-radius: 999px;
  color: var(--laiton-clair);
}
.entete__appel:hover { background: var(--laiton); color: var(--nuit); }
@media (max-width: 640px) {
  .entete__nav { display: none; }
  .entete__appel { margin-left: auto; }
}

/* ---------- Le récit ---------- */
.recit { position: relative; }
.scene {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(55vmax 55vmax at var(--lx) var(--ly), rgb(255 168 84 / calc(var(--lumiere) * .30)), transparent 62%),
    radial-gradient(80vmax 60vmax at 70% 110%, rgb(201 160 99 / .07), transparent 60%),
    var(--nuit);
}
.toile { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.secours {
  position: absolute;
  right: 12%;
  top: 50%;
  width: min(36vw, 340px);
  translate: 0 -50%;
  display: none;
}
.secours__abat { fill: var(--abat, #b8904f); transition: fill .4s; }
.secours__ampoule { opacity: calc(.35 + var(--lumiere) * .65); }
html:not(.avec-webgl) .secours { display: block; }
html:not(.avec-webgl) .reperes { display: none; }
@media (max-width: 760px) {
  .secours { right: 50%; top: 32%; translate: 50% -50%; width: min(58vw, 260px); }
}

/* Repères de la vue éclatée : placés par le script, sur le bord droit de
   chaque pièce. */
.reperes { position: absolute; inset: 0; pointer-events: none; }
.repere {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: .45rem;
  padding-left: 3.4rem;
  white-space: nowrap;
  font-size: .82rem;
  color: var(--encre);
  opacity: 0;
  will-change: transform, opacity;
}
.repere::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 3rem;
  height: 1px;
  background: linear-gradient(90deg, var(--laiton-clair), rgb(201 160 99 / .3));
}
.repere::after {
  content: "";
  position: absolute;
  left: -3px;
  top: calc(.62em - 3px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--laiton-clair);
  box-shadow: 0 0 0 4px rgb(227 194 140 / .18);
}
.repere b { font-weight: 600; letter-spacing: .04em; }
.repere span { color: var(--doux); }
@media (max-width: 760px) {
  .repere { padding-left: 2.2rem; font-size: .74rem; }
  .repere::before { width: 1.8rem; }
  .repere span { display: none; }
}

/* Points de navigation entre chapitres. */
.points {
  position: absolute;
  right: clamp(.8rem, 2.5vw, 2rem);
  top: 50%;
  translate: 0 -50%;
  display: grid;
  gap: .9rem;
  z-index: 3;
}
.points a {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgb(238 232 220 / .45);
  transition: background .3s, transform .3s var(--ease), border-color .3s;
}
.points a::before { content: ""; display: block; margin: -10px; width: 30px; height: 30px; } /* zone tactile */
.points a[aria-current="true"] { background: var(--laiton-clair); border-color: var(--laiton-clair); transform: scale(1.3); }

.chapitres { position: relative; z-index: 2; margin-top: -100vh; margin-top: -100svh; pointer-events: none; }
.chapitre {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 5rem clamp(1.2rem, 6vw, 6rem);
}
.chapitre__texte {
  max-width: 30rem;
  pointer-events: auto;
  opacity: .18;
  transform: translateY(1.2rem);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.chapitre.is-actif .chapitre__texte { opacity: 1; transform: none; }
.chapitre h1 { font-size: clamp(2.6rem, 6.2vw, 5.4rem); margin-bottom: 1.4rem; }
.chapitre h2 { font-size: clamp(2rem, 4.4vw, 3.6rem); margin-bottom: 1.2rem; }
.chapitre p { margin: 0 0 1rem; color: #cfc9bd; max-width: 27rem; }

.indice { display: inline-flex; align-items: center; gap: .7rem; margin-top: 1.5rem !important; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--doux) !important; }
.indice span { position: relative; width: 1px; height: 2.6rem; background: var(--trait); overflow: hidden; }
.indice span::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--laiton-clair); animation: indice 2.2s var(--ease) infinite; }
@keyframes indice { to { top: 100%; } }

/* Finitions */
.finitions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.4rem 0 0; padding: 0; border: 0; min-width: 0; }
.finitions legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.finitions label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem 1rem .55rem .6rem;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: rgb(18 21 28 / .8);
  cursor: pointer;
  font-size: .92rem;
  transition: border-color .25s, background .25s;
}
.finitions input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.finitions label:has(input:checked) { border-color: var(--laiton-clair); background: rgb(201 160 99 / .14); }
.finitions label:has(input:focus-visible) { outline: 2px solid var(--laiton-clair); outline-offset: 3px; }
.pastille { width: 1.3rem; height: 1.3rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18); }
.pastille--laiton { background: radial-gradient(circle at 35% 30%, #f1d7a3, #b8904f 55%, #6e5025); }
.pastille--ivoire { background: radial-gradient(circle at 35% 30%, #fffaf0, #e8e0cf 55%, #a79d88); }
.pastille--nuit { background: radial-gradient(circle at 35% 30%, #56627c, #1d2433 55%, #0a0d14); }

/* Interrupteur */
.interrupteur {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  margin-top: 1.2rem;
  padding: .65rem 1.2rem .65rem .7rem;
  border: 1px solid var(--laiton);
  border-radius: 999px;
  background: rgb(18 21 28 / .8);
  color: var(--encre);
  font: 500 .95rem/1 var(--sans);
  cursor: pointer;
}
.interrupteur__rail { position: relative; width: 2.6rem; height: 1.4rem; border-radius: 999px; background: #2a2e38; transition: background .3s; }
.interrupteur__rail span { position: absolute; top: 3px; left: 3px; width: calc(1.4rem - 6px); height: calc(1.4rem - 6px); border-radius: 50%; background: var(--encre); transition: transform .35s var(--ease), background .3s; }
.interrupteur[aria-pressed="true"] .interrupteur__rail { background: var(--laiton); }
.interrupteur[aria-pressed="true"] .interrupteur__rail span { transform: translateX(1.2rem); background: #fff4dd; box-shadow: 0 0 12px #ffcf8a; }

/* Mobile : la lampe occupe le haut, le texte repose en bas sur un dégradé. */
@media (max-width: 760px) {
  .chapitre { align-items: flex-end; padding: 0 0 1.2rem; }
  .chapitre__texte {
    max-width: none;
    width: 100%;
    padding: 4.5rem 1.25rem 1rem;
    background: linear-gradient(to top, var(--nuit) 58%, rgb(11 13 18 / .85) 80%, transparent);
  }
  .chapitre h1 { font-size: clamp(2.3rem, 10.5vw, 3rem); }
  .chapitre h2 { font-size: clamp(1.8rem, 8vw, 2.4rem); margin-bottom: .8rem; }
  .chapitre p { font-size: 1rem; }
  .points { top: 34%; }
  /* Au premier écran, le bandeau et l'en-tête décalent la scène : le texte
     d'ouverture remonte d'autant pour rester lisible en entier. */
  .chapitre--ouverture { padding-bottom: 10rem; }
  .chapitre--ouverture .indice { display: none; }
}

/* ---------- Sections classiques ---------- */
.enveloppe { max-width: 72rem; margin: 0 auto; padding: 0 clamp(1.2rem, 5vw, 3rem); }
.enveloppe--etroite { max-width: 38rem; }
.fiche, .atelier, .catalogue { padding: clamp(4.5rem, 11vw, 8rem) 0; border-top: 1px solid var(--trait); }
.fiche h2, .atelier h2, .catalogue h2 { font-size: clamp(2rem, 5vw, 3.6rem); margin-bottom: 2.5rem; }

.fiche__grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--trait); }
.fiche__grille div { padding: 1.3rem 1rem 1.3rem 0; border-bottom: 1px solid var(--trait); }
.fiche__grille dt { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--doux); margin-bottom: .35rem; }
.fiche__grille dd { margin: 0; font: 500 1.35rem/1.25 var(--serif); }
.fiche__prix { margin: 2rem 0 0; color: var(--doux); }
.fiche__prix strong { color: var(--laiton-clair); font: 500 1.5rem var(--serif); margin-left: .3rem; }

.etapes { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: clamp(1.5rem, 4vw, 3rem); margin: 0; padding: 0; list-style: none; }
.etapes li { padding-top: 1.4rem; border-top: 1px solid var(--laiton); }
.etapes__num { font: italic 500 1.1rem var(--serif); color: var(--laiton); }
.etapes h3 { font-size: 1.8rem; margin: .5rem 0 .7rem; }
.etapes p { margin: 0; color: #cfc9bd; }

.catalogue { text-align: center; background: radial-gradient(40rem 20rem at 50% 0%, rgb(201 160 99 / .10), transparent 70%); }
.catalogue p { color: #cfc9bd; }
.formulaire { margin-top: 2rem; text-align: left; }
.formulaire label { display: block; font-size: .85rem; color: var(--doux); margin-bottom: .45rem; }
.formulaire__ligne { display: flex; gap: .5rem; }
.formulaire input {
  flex: 1;
  min-width: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--trait);
  border-radius: 10px;
  background: var(--nuit-2);
  color: var(--encre);
  font: inherit;
  font-size: 1rem;
}
.formulaire input[aria-invalid="true"] { border-color: #ff8a7a; }
.formulaire button {
  padding: .85rem 1.4rem;
  border: 0;
  border-radius: 10px;
  background: var(--laiton);
  color: var(--nuit);
  font: 600 1rem var(--sans);
  cursor: pointer;
}
.formulaire button:hover { background: var(--laiton-clair); }
.formulaire__aide { margin: .6rem 0 0; font-size: .85rem; color: var(--doux); }
.formulaire__aide.is-erreur { color: #ff8a7a; }
.formulaire__aide.is-ok { color: var(--laiton-clair); }
@media (max-width: 420px) { .formulaire__ligne { flex-direction: column; } }

.pied { padding: 2rem 1.2rem 2.5rem; text-align: center; font-size: .85rem; color: var(--doux); border-top: 1px solid var(--trait); }

/* Animations réduites : textes visibles d'emblée, rien ne glisse. La lampe,
   elle, passe d'une pose à l'autre sans mouvement (voir script.js). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .chapitre__texte { opacity: 1; transform: none; }
}
