/* ============================================================
   tokens.css v2 — Fusion Letter (DESIGN 1.md) + Superhuman (DESIGN.md)
   Sombre (défaut) : corps Letter — vault ink #191b1f, murs teintés,
                    CTA teal #186f64, liens violet.
   Clair           : corps Superhuman — parchment #f2f0eb, cartes blanches,
                     liens Royal Violet #714cb6 (CTA wine retiré — CTA = palette nuit).
   Hero + bande + footer : identiques dans les 2 thèmes (navires éditoriaux).
   ============================================================ */

:root {
  color-scheme: dark;

  /* — Typographie — */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --font-serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman",
    serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, monospace;

  /* Échelle Letter : display 80 / heading 46 / subhead 22 / body 16 / caption 13 */
  --text-display: clamp(2.6rem, 7vw, 5rem);   /* ~42–80px  */
  --text-h1: clamp(2.1rem, 5.4vw, 4rem);
  --text-h2: clamp(1.75rem, 3.6vw, 2.875rem); /* ~28–46px  */
  --text-h3: clamp(1.35rem, 2.4vw, 1.75rem);  /* ~22–28px  */
  --text-h4: 1.375rem;                        /* 22px subhead serif */
  --text-body-lg: 1.125rem;
  --text-body: 1rem;
  --text-body-sm: 0.9375rem;
  --text-caption: 0.8125rem;                  /* 13px */
  --text-label: 0.75rem;                      /* 12px */

  --leading-display: 1.1;
  --tracking-display: 0.02em;   /* tracking positif signature Letter */
  --tracking-tight: -0.02em;
  --tracking-mono: 0.08em;

  /* — Espacements (base 4px) — */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --section-gap: 96px;
  --page-max: 1200px;
  --nav-height: 64px;

  /* — Rayons : Letter 2px (boutons/tags) + Superhuman 16px (cartes) + Lusion 100px — */
  --r-sm: 2px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-gallery: 100px;
  --r-full: 999px;

  /* — Navires éditoriaux (identiques sombre/clair) — */
  --hero-bg: #191b1f;                 /* Letter — Vault Ink */
  --hero-text: #ffffff;
  --hero-muted: rgba(255, 255, 255, 0.72);
  --hero-hairline: rgba(255, 255, 255, 0.16);
  /* Atmosphère héro (toujours sur ink) : lueurs violet / teal / wine + vignette */
  --hero-glow-violet: rgba(83, 110, 255, 0.3);
  --hero-glow-teal: rgba(24, 111, 100, 0.26);
  --hero-glow-wine: rgba(129, 54, 71, 0.3);
  --hero-vignette: rgba(5, 6, 8, 0.55);
  --band-bg: #0c4243;                 /* Superhuman — Deep Lagoon */
  --band-text: #ffffff;
  --band-muted: rgba(255, 255, 255, 0.76);
  --band-accent: #d4c7ff;             /* Superhuman — Lilac Mist */
  --band-hairline: rgba(255, 255, 255, 0.18);
  --footer-bg: #101114;               /* nuit neutre — compatible des 2 thèmes */
  --footer-text: #ffffff;
  --footer-muted: rgba(255, 255, 255, 0.7);

  /* — Actions partagées — */
  --cta-teal: #186f64;                /* Letter — Deep Teal */
  --cta-teal-hover: #135a51;
  --on-teal: #ffffff;
  --cta-lilac: #d4c7ff;               /* Superhuman — bouton secondaire */
  --cta-lilac-hover: #c3b3fc;

  /* — Sémantiques — */
  --success: #2f9c8d;
  --danger: #eb5757;

  /* — Mouvement — */
  --ease: cubic-bezier(0.25, 0.6, 0.3, 1);
  --dur: 220ms;
}

/* ============================================================
   Thème SOMBRE (défaut) — corps Letter « vault ink »
   ============================================================ */
[data-theme="dark"] {
  color-scheme: dark;

  --canvas: #101114;
  --surface-1: #191b1f;
  --surface-2: #1f2227;
  --surface-3: #262a31;
  --surface-hover: #1f2227;

  --border: #2a2e35;
  --border-strong: #3a3f48;
  --ring: rgba(143, 155, 255, 0.55);

  --text-1: #ffffff;
  --text-2: #d4d7dc;
  --text-3: #9fabad;              /* Letter — Fog Gray */
  --text-4: #6f7679;

  --accent-text: #8f9bff;           /* violet lisible sur ink (Letter Electric Violet) */
  --accent-soft: rgba(83, 110, 255, 0.14);
  --accent-border: rgba(143, 155, 255, 0.4);

  /* Murs de galerie Letter — variantes sombres */
  --wall-peach: #2a221b;
  --wall-mint: #1a2a23;
  --wall-lavender: #241f33;
  --wall-border: rgba(255, 255, 255, 0.07);
  --wall-text-2: #cfd2d7;

  /* Surfaces de contrôle */
  --field-bg: rgba(255, 255, 255, 0.03);
  --field-border: rgba(255, 255, 255, 0.12);
  --pill-bg: rgba(255, 255, 255, 0.06);
  --pill-bg-hover: rgba(255, 255, 255, 0.11);
  --chip-active-bg: var(--cta-teal);
  --chip-active-text: var(--on-teal);
  --nav-scrolled-bg: rgba(16, 17, 20, 0.84);
  --nav-scrolled-border: rgba(255, 255, 255, 0.1);
  --nav-text: #ffffff;
  --backdrop: rgba(0, 0, 0, 0.66);
  --code-bg: rgba(255, 255, 255, 0.05);
  --cover-grid: rgba(255, 255, 255, 0.06);
  --eyebrow: #58c7b6;                /* teal éclairci pour lisible sur ink */

  /* Lueurs d'ambiance derrière les sections (fonds enrichis) */
  --section-glow-a: rgba(83, 110, 255, 0.07);   /* violet électrique */
  --section-glow-b: rgba(24, 111, 100, 0.08);   /* teal Letter */
  --section-glow-c: rgba(168, 80, 122, 0.08);   /* wine Superhuman */

  /* Boutons */
  --cta-2-bg: transparent;
  --cta-2-text: #ffffff;
  --cta-2-border: rgba(255, 255, 255, 0.32);
  --cta-2-bg-hover: rgba(255, 255, 255, 0.08);

  /* Ombres (rares : la profondeur vient des murs et des rendus 3D) */
  --shadow-card: inset 0 0 0 1px var(--wall-border);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.55);
}

/* ============================================================
   Thème CLAIR — corps Superhuman « warm parchment »
   ============================================================ */
[data-theme="light"] {
  color-scheme: light;

  --canvas: #f2f0eb;                /* Superhuman — Warm Parchment */
  --surface-1: #ffffff;             /* cartes papier */
  --surface-2: #eae7e0;
  --surface-3: #e3e3e2;             /* Superhuman — Soft Mist */
  --surface-hover: #eae7e0;

  --border: #e3e3e2;
  --border-strong: #cfcdc7;
  --ring: rgba(66, 29, 36, 0.55);

  --text-1: #292827;                /* Superhuman — Ink Charcoal */
  --text-2: #4a4744;
  --text-3: #666666;                /* Superhuman — Stone Gray */
  --text-4: #8f8d87;

  --accent-text: #714cb6;           /* Superhuman — Royal Violet (liens seuls) */
  --accent-soft: rgba(212, 199, 255, 0.5);
  --accent-border: rgba(113, 76, 182, 0.4);

  /* Murs de galerie Letter — teintes d'origine */
  --wall-peach: #fcede1;
  --wall-mint: #eefcef;
  --wall-lavender: #e6def0;
  --wall-border: rgba(41, 40, 39, 0.07);
  --wall-text-2: #4a4744;

  /* Surfaces de contrôle */
  --field-bg: #ffffff;
  --field-border: #e3e3e2;
  --pill-bg: rgba(41, 40, 39, 0.05);
  --pill-bg-hover: rgba(41, 40, 39, 0.1);
  --chip-active-bg: var(--cta-teal);
  --chip-active-text: var(--on-teal);
  --nav-scrolled-bg: rgba(242, 240, 235, 0.84);
  --nav-scrolled-border: #e3e3e2;
  --nav-text: #ffffff;
  --backdrop: rgba(41, 40, 39, 0.42);
  --code-bg: rgba(41, 40, 39, 0.05);
  --cover-grid: rgba(255, 255, 255, 0.08);
  --eyebrow: #186f64;                /* teal Letter sur parchment : ~5.2:1 */

  /* Lueurs d'ambiance derrière les sections (parchment enrichi) */
  --section-glow-a: rgba(113, 76, 182, 0.06);   /* Royal Violet */
  --section-glow-b: rgba(24, 111, 100, 0.07);   /* teal Letter */
  --section-glow-c: rgba(168, 80, 122, 0.06);   /* wine Superhuman */

  /* Boutons secondaires (ghost hairline) */
  --cta-2-bg: transparent;
  --cta-2-text: var(--text-1);
  --cta-2-border: var(--border-strong);
  --cta-2-bg-hover: rgba(41, 40, 39, 0.05);

  --shadow-card: inset 0 0 0 1px var(--border);
  --shadow-pop: 0 24px 64px rgba(41, 40, 39, 0.18);
}
