/* ==========================================================================
   SAÉ 512 — Espionnage LCD
   base.css — jetons de design, réinitialisation, typographie, thèmes
   Direction artistique : « laboratoire RF / signal »
   ========================================================================== */

/* --- Jetons : thème sombre par défaut ------------------------------------ */
:root {
  /* Couleurs de fond / surfaces */
  --bg:            #0a0e14;
  --bg-2:          #0d131c;
  --surface:       #121a24;
  --surface-2:     #16202c;
  --surface-3:     #1b2735;
  --border:        #24323f;
  --border-strong: #35485a;

  /* Texte */
  --text:          #e6edf3;
  --text-2:        #aebac6;
  --muted:         #7d8b99;

  /* Accents « phosphore » + cyan oscilloscope */
  --accent:        #4fe6a2;   /* vert signal */
  --accent-2:      #57b6ff;   /* cyan */
  --accent-warm:   #f3b94d;   /* ambre, usage rare */
  --accent-ink:    #04140d;   /* texte sur fond accent */

  --accent-soft:   rgba(79, 230, 162, 0.14);
  --accent-2-soft: rgba(87, 182, 255, 0.14);
  --danger:        #ff6b6b;

  /* Lignes de balayage / grille */
  --scan:          rgba(87, 182, 255, 0.05);
  --grid-line:     rgba(120, 160, 200, 0.06);

  /* Typographie */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Rythme */
  --maxw:        1180px;
  --maxw-read:   720px;
  --radius:      14px;
  --radius-sm:   9px;
  --radius-pill: 999px;
  --gap:         clamp(1rem, 2.5vw, 1.6rem);
  --pad-section: clamp(2.6rem, 6vw, 5rem);

  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5);
  --ring:     0 0 0 3px var(--accent-2-soft);

  color-scheme: dark;
}

/* --- Thème clair (automatique selon le système, sauf choix sombre) ------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:            #f5f7fa;
    --bg-2:          #eef2f6;
    --surface:       #ffffff;
    --surface-2:     #f3f6f9;
    --surface-3:     #e9eef3;
    --border:        #d8e0e8;
    --border-strong: #b9c6d3;

    --text:          #0e1620;
    --text-2:        #3c4a59;
    --muted:         #5d6b7a;

    --accent:        #067a4b;
    --accent-2:      #0862c0;
    --accent-warm:   #b7791f;
    --accent-ink:    #ffffff;

    --accent-soft:   rgba(6, 122, 75, 0.10);
    --accent-2-soft: rgba(8, 98, 192, 0.10);
    --danger:        #c23b3b;

    --scan:          rgba(10, 111, 212, 0.035);
    --grid-line:     rgba(30, 70, 120, 0.06);

    --shadow:    0 1px 2px rgba(16,32,52,.08), 0 10px 30px rgba(16,32,52,.08);
    --shadow-lg: 0 24px 60px rgba(16,32,52,.14);

    color-scheme: light;
  }
}

/* Choix explicite clair (bouton) */
:root[data-theme="light"] {
  --bg:            #f5f7fa;
  --bg-2:          #eef2f6;
  --surface:       #ffffff;
  --surface-2:     #f3f6f9;
  --surface-3:     #e9eef3;
  --border:        #d8e0e8;
  --border-strong: #b9c6d3;

  --text:          #0e1620;
  --text-2:        #3c4a59;
  --muted:         #5d6b7a;

  --accent:        #067a4b;
  --accent-2:      #0862c0;
  --accent-warm:   #b7791f;
  --accent-ink:    #ffffff;

  --accent-soft:   rgba(6, 122, 75, 0.10);
  --accent-2-soft: rgba(8, 98, 192, 0.10);
  --danger:        #c23b3b;

  --scan:          rgba(10, 111, 212, 0.035);
  --grid-line:     rgba(30, 70, 120, 0.06);

  --shadow:    0 1px 2px rgba(16,32,52,.08), 0 10px 30px rgba(16,32,52,.08);
  --shadow-lg: 0 24px 60px rgba(16,32,52,.14);

  color-scheme: light;
}

/* Choix explicite sombre (bouton) — redéclare au cas où le système est clair */
:root[data-theme="dark"] {
  --bg:            #0a0e14;
  --bg-2:          #0d131c;
  --surface:       #121a24;
  --surface-2:     #16202c;
  --surface-3:     #1b2735;
  --border:        #24323f;
  --border-strong: #35485a;
  --text:          #e6edf3;
  --text-2:        #aebac6;
  --muted:         #7d8b99;
  --accent:        #4fe6a2;
  --accent-2:      #57b6ff;
  --accent-warm:   #f3b94d;
  --accent-ink:    #04140d;
  --accent-soft:   rgba(79, 230, 162, 0.14);
  --accent-2-soft: rgba(87, 182, 255, 0.14);
  --danger:        #ff6b6b;
  --scan:          rgba(87, 182, 255, 0.05);
  --grid-line:     rgba(120, 160, 200, 0.06);
  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* --- Réinitialisation ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.68;
  color: var(--text);
  background-color: var(--bg);
  /* Lignes de balayage (défilent avec la page) */
  background-image: linear-gradient(var(--scan) 50%, transparent 50%);
  background-size: 100% 6px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: rgba(87, 182, 255, .14);
  overflow-x: clip;            /* garde-fou : ne crée pas de conteneur de défilement */
  min-height: 100vh;
}

/* Halos lumineux fixes — via un pseudo-élément fixe, compatible iOS
   (background-attachment: fixed y est ignoré et étire le dégradé). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--accent-2-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, var(--accent-soft), transparent 55%);
}

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

a { color: var(--accent-2); text-decoration-color: color-mix(in srgb, var(--accent-2) 45%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

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

::selection { background: var(--accent-2-soft); color: var(--text); }

code, kbd, samp { font-family: var(--font-mono); font-size: .9em; }

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  margin: clamp(2rem, 5vw, 3rem) 0;
}

/* --- Typographie --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.35rem); }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.1rem); margin-top: 0.4em; }
h3 { font-size: clamp(1.2rem, 1rem + 0.9vw, 1.45rem); }
h4 { font-size: 1.07rem; letter-spacing: 0; }

p { text-wrap: pretty; }

strong, b { color: var(--text); font-weight: 650; }

/* Petites capitales mono pour les sur-titres */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: .55em;
}
.eyebrow::before {
  content: "";
  width: 1.6em; height: 1px;
  background: currentColor;
  opacity: .7;
}

/* --- Utilitaires de mise en page ----------------------------------------- */
.container { width: min(100% - 2rem, var(--maxw)); margin-inline: auto; }
.container-read { width: min(100% - 2rem, var(--maxw-read)); margin-inline: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 50%; transform: translateX(-50%) translateY(-150%);
  top: .5rem; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateX(-50%) translateY(0); }

.mono { font-family: var(--font-mono); }
.text-muted { color: var(--muted); }
.center { text-align: center; }
