/* ── Reset + fondations ──────────────────────────────────────────────────── */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Les ancres ne doivent pas passer sous la nav fixe. */
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  min-height: 100svh;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}

/* Verrouille le scroll pendant le préchargement et quand le lightbox est ouvert. */
body[data-locked='true'] {
  overflow: hidden;
  /* Pas de `position: fixed` : ça casserait la position de scroll au déverrouillage. */
}

img,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video { height: auto; }

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button { cursor: pointer; }

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol { list-style: none; }

::selection {
  background: var(--amber);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Scrollbar discrète — cohérente avec le reste, pas invisible (accessibilité). */
@supports (scrollbar-color: red blue) {
  html {
    scrollbar-color: var(--ink-3) var(--ink);
    scrollbar-width: thin;
  }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
  background: var(--ink-3);
  border: 3px solid var(--ink);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--smoke); }

/* ── Primitives typographiques ───────────────────────────────────────────── */

.display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  /* Anton est déjà très condensée : on l'étire légèrement en hauteur pour
     l'énergie « affiche », sans la déformer au point de la rendre grasse. */
  font-synthesis: none;
}

.mono {
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

.label {
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-faint);
  font-weight: 400;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.35;
  color: var(--bone-dim);
  max-width: 46ch;
  font-weight: 400;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  padding: 0.9rem 1.4rem;
  background: var(--amber);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transform: translateY(-120%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  z-index: var(--z-content);
  padding-block: var(--section-y);
}

/* Le canvas WebGL est fixe derrière tout le contenu, plein écran. */
.stage {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
  /* Le canvas capte le pointeur uniquement là où c'est utile (cf. main.js) */
}
.stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Grain global : une seule couche, en overlay, jamais dans le canvas —
   comme ça elle reste nette quel que soit le devicePixelRatio du rendu 3D. */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 30;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: var(--grain-src);
  background-size: 180px 180px;
  will-change: transform;
  animation: grain-shift 0.7s steps(1) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-4%, 3%); }
  40% { transform: translate(3%, -5%); }
  60% { transform: translate(-2%, -3%); }
  80% { transform: translate(4%, 2%); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
}

/* Vignette + halo bas : donne de la profondeur cinéma au fond. */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 29;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 42%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, transparent 22%, transparent 78%, rgba(0, 0, 0, 0.5) 100%);
}

/* ── Révélations au scroll ───────────────────────────────────────────────── */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 900ms var(--ease-out),
    transform 900ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Variante « rideau » : le texte monte depuis sous une ligne de coupe. */
[data-reveal='mask'] {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1100ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal='mask'].is-in { clip-path: inset(0 0 -10% 0); }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; clip-path: none; }
}

/* Les lignes de titre découpées par splitLines() */
.line-wrap {
  display: block;
  overflow: hidden;
}
.line-wrap > span {
  display: block;
  transform: translate3d(0, 105%, 0);
  transition: transform 1100ms var(--ease-out);
  transition-delay: var(--line-delay, 0ms);
  will-change: transform;
}
.is-in .line-wrap > span,
.line-wrap.is-in > span { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .line-wrap > span { transform: none; }
}
