/* ==========================================================================
   CQR — BASE
   Reset, typographie, grille, plancher d'accessibilité.
   Aucune valeur en dur : tout vient de tokens.css.
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* 'clip' plutôt que 'hidden' : empêche le débordement horizontal des halos
     sans créer de conteneur de défilement, ce qui casserait la nav sticky. */
  overflow-x: clip;
}

body {
  background: var(--c-background);
  color: var(--c-text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}

::selection { background: var(--c-primary); color: var(--c-text-hi); }

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

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

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* --------------------------------------------------------------------------
   Focus visible — plancher d'accessibilité, non négociable
   -------------------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-accent-text-hi);
  outline-offset: 3px;
  border-radius: var(--sp-1);
}

.skip-link {
  position: absolute; left: var(--sp-8); top: calc(-1 * var(--sp-12));
  z-index: 200;
  background: var(--c-background);
  border: 1px solid var(--b-3);
  border-radius: var(--r-full);
  padding: var(--sp-4) var(--sp-7);
  font-size: var(--fs-small);
  transition: top var(--dur-1) var(--ease);
}
.skip-link:focus-visible { top: var(--sp-6); }

/* --------------------------------------------------------------------------
   Champ WebGL + trame de fond
   -------------------------------------------------------------------------- */
.field {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: var(--field-opacity);
  mix-blend-mode: screen;
}
/* repli DOM si WebGL indisponible */
.field-fallback {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  opacity: calc(var(--field-opacity) * 0.7);
  background-image: radial-gradient(circle at center, var(--c-primary) 1px, transparent 1.4px);
  background-size: var(--field-spacing) var(--field-spacing);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 20%, transparent 75%);
}

.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, rgba(0,0,0,0) 1px),
    linear-gradient(90deg, var(--grid-line) 1px, rgba(0,0,0,0) 1px);
  background-size: var(--grid-size) var(--grid-size);
}

/* tout le contenu passe au-dessus du fond */
.page { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Structure — full bleed encadré
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--section-padding);
}
@media (max-width: 640px) {
  .wrap { padding-inline: var(--sp-6); }
}

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(40px, 6vw, 80px); }

.rule {
  height: 1px; border: 0;
  background: linear-gradient(to right, rgba(0,0,0,0), var(--b-2), rgba(0,0,0,0));
}

/* --------------------------------------------------------------------------
   Typographie
   -------------------------------------------------------------------------- */
.display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  font-weight: 400;
  text-wrap: balance;
}
.h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
  font-weight: 400;
  text-transform: uppercase;
  text-wrap: balance;
}
.h3 {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h3);
  font-weight: 500;
  text-wrap: balance;
}
.h4 {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.eyebrow {
  display: block;
  font-size: var(--fs-eyebrow);
  line-height: var(--lh-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  font-weight: 500;
  color: var(--c-accent-text);
}
.eyebrow--muted { color: var(--c-faint); }

.lead {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--c-muted);
  max-width: var(--maxw-text);
}
.lead strong, .body strong { color: var(--c-text); font-weight: 600; }

.body { color: var(--c-muted); max-width: var(--maxw-text); }
.body + .body { margin-top: var(--sp-6); }

.small { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-faint); }
.accent { color: var(--c-accent-text-hi); }

/* liens dans le corps de texte */
.body a, .lead a, .small a { color: var(--c-accent-text); text-decoration: underline; text-underline-offset: 3px; }
.body a:hover, .lead a:hover, .small a:hover { color: var(--c-accent-text-hi); }

/* --------------------------------------------------------------------------
   Révélations au scroll — mouvement modéré, 300ms, ease-out
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

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

/* utilitaires */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.stack-6 > * + * { margin-top: var(--sp-6); }
.stack-7 > * + * { margin-top: var(--sp-7); }
.stack-8 > * + * { margin-top: var(--sp-8); }
