/* ==========================================================================
   TOKENS — source de vérité visuelle
   Palette : encre / papier / acide. Rien d'autre au niveau marque.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800;900&family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&family=Sacramento&display=swap');

:root {
  /* --- Encre ------------------------------------------------------------ */
  --ink-900: #08090a;
  --ink-850: #0b0d0e;
  --ink-800: #101314;
  --ink-700: #181c1e;
  --ink-600: #23282b;
  --ink-500: #343a3e;

  /* --- Papier ----------------------------------------------------------- */
  --paper-100: #f4f3ee;
  --paper-200: #eae8df;
  --paper-300: #d8d5c8;

  /* --- Acide (accent unique de marque) ---------------------------------- */
  --acid: #cdff3e;
  --acid-deep: #a4cf28;
  --acid-wash: rgba(205, 255, 62, 0.12);

  /* --- Rôles sémantiques (thème sombre par défaut) ---------------------- */
  --bg: var(--ink-900);
  --bg-raised: var(--ink-800);
  --bg-sunken: #030405;
  --fg: var(--paper-100);
  --fg-muted: #8d9295;
  --fg-faint: #787f82;
  --line: rgba(244, 243, 238, 0.13);
  --line-strong: rgba(244, 243, 238, 0.28);
  --on-accent: var(--ink-900);
  --ring: var(--acid);

  /* --acid  = l'aplat de marque : réservé aux fonds, jamais au petit texte clair
     --accent = la déclinaison lisible : c'est elle qui colore texte et filets.
     Sur papier, l'acide tombe à 1,05:1 — d'où la bascule dans .section--paper. */
  --accent: var(--acid);
  --danger: #ff8577;

  /* Section « papier » — inversion contrôlée, pas un dark-mode inversé */
  --paper-bg: var(--paper-100);
  --paper-fg: var(--ink-900);
  --paper-muted: #575d55;
  --paper-faint: #5b615c;
  --paper-accent: #3f6600;
  --paper-line: rgba(8, 9, 10, 0.16);

  /* --- Jauges ECO RACE (palette fonctionnelle du jeu, pas de la marque) -- */
  --g-temps: #5ec8f5;
  --g-budget: #f5c542;
  --g-eco: #cdff3e;
  --g-pmr: #ff7a5a;

  /* --- Typographie ------------------------------------------------------ */
  --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-script: 'Sacramento', 'Segoe Script', cursive;

  /* calibré pour que trois lignes de manifeste tiennent dans 100svh sur un
     portable 1440×900, sans jamais pousser l'indicateur de scroll sous la ligne de flottaison */
  --fs-mega: clamp(3rem, 9.5vw, 9.5rem);
  --fs-display: clamp(2.6rem, 8.5vw, 8.5rem);
  --fs-h1: clamp(2.25rem, 6vw, 5.5rem);
  --fs-h2: clamp(1.75rem, 4vw, 3.5rem);
  --fs-h3: clamp(1.3rem, 2.1vw, 2rem);
  --fs-lead: clamp(1.0625rem, 1.5vw, 1.4rem);
  --fs-body: clamp(1rem, 0.95vw, 1.0625rem);
  --fs-small: 0.875rem;
  --fs-label: 0.6875rem;

  /* --- Rythme (base 4) --------------------------------------------------- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-24: 6rem;
  --s-32: 8rem;
  --section: clamp(5rem, 12vh, 10rem);
  --section-lg: clamp(7rem, 18vh, 15rem);

  /* --- Structure -------------------------------------------------------- */
  --gutter: clamp(1.25rem, 4.5vw, 5rem);
  --max: 1680px;
  --radius: 2px;
  --radius-lg: 4px;

  /* --- Mouvement -------------------------------------------------------- */
  --dur-fast: 160ms;
  --dur: 260ms;
  --dur-slow: 420ms;
  --dur-reveal: 900ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);

  /* --- Couches ---------------------------------------------------------- */
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 20;
  --z-overlay: 40;
  --z-cursor: 100;
  --z-loader: 1000;
}

/* ==========================================================================
   RESET
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg,
video,
canvas { 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;
  padding: 0;
}

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

/* Focus : jamais supprimé, toujours lisible sur encre ET papier */
:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
  border-radius: var(--radius);
}
:focus:not(:focus-visible) { outline: none; }

/* ==========================================================================
   TYPOGRAPHIE DE BASE
   ========================================================================== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.02em; line-height: 1.05; }

p { text-wrap: pretty; }

strong { font-weight: 600; color: var(--fg); }

/* --- Utilitaires typographiques --------------------------------------- */

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

.u-script {
  font-family: var(--font-script);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
  color: var(--accent);
}

.u-lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--fg);
  max-width: 34ch;
}

.u-measure { max-width: 62ch; }
.u-measure-tight { max-width: 46ch; }

.u-muted { color: var(--fg-muted); }

.u-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Lecture seule pour lecteurs d'écran */
.u-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   STRUCTURE
   ========================================================================== */

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

.grid12 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-6) var(--gutter);
}

@media (min-width: 768px) {
  .grid12 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .grid12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

.section { padding-block: var(--section); }
.section--lg { padding-block: var(--section-lg); }

.section--paper {
  background: var(--paper-bg);
  color: var(--paper-fg);
  --fg: var(--paper-fg);
  --fg-muted: var(--paper-muted);
  --fg-faint: var(--paper-faint);
  --accent: var(--paper-accent);
  --danger: #a32d1a;
  --line: var(--paper-line);
  --line-strong: rgba(8, 9, 10, 0.4);
  /* les surfaces creusées/surélevées suivent le papier, sinon un en-tête de
     tableau resterait noir avec du texte gris dessus */
  --bg-sunken: var(--paper-200);
  --bg-raised: var(--paper-200);
}

.section--paper ::selection {
  background: var(--ink-900);
  color: var(--acid);
}

/* ==========================================================================
   MOUVEMENT RÉDUIT — non négociable
   ========================================================================== */

@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;
    scroll-behavior: auto !important;
  }
}
