/*
 * GOODEV — jetons de design (direction « Dossier »).
 * Seul fichier du système où une couleur littérale est permise :
 * partout ailleurs, on passe par ces variables.
 * Les couleurs sont écrites en hexadécimal pour être lues par tous les
 * navigateurs, anciens téléphones compris (elles ont été composées en OKLCH).
 */

:root {
  color-scheme: light;

  /* Couleurs — thème clair */
  --paper: #f8fafc;
  --paper-sunk: #f0f3f5;
  --surface: #ffffff;
  --ink: #121a2b;
  --ink-soft: #464d5b;
  --ink-faint: #636975;
  --rule: #d8dbe0;
  --rule-strong: #121a2b;
  --accent: #007463;
  --accent-wash: #dbf6ed;
  --focus: #008e74;

  /* Bandeau inversé (encre sur le thème clair) */
  --band-bg: #080f1c;
  --band-surface: #111826;
  --band-fg: #f2f6f8;
  --band-muted: #afb8c4;
  --band-rule: #2a3342;
  --band-accent: #50e8c0;
  --band-grid: rgba(242, 246, 248, 0.06);
  --band-halo: rgba(80, 232, 192, 0.12);

  /* Quadrillage du papier millimétré */
  --grid-line: rgba(18, 26, 43, 0.07);

  /* Zone de signature : toujours encre sombre sur blanc, pour que l'image s'imprime bien */
  --sig-paper: #ffffff;
  --sig-ink: #121a2b;

  /* Aplat d'accent (survol des lignes, surlignage) et son texte */
  --accent-fill: #50e8c0;
  --on-accent-fill: #080f1c;

  /* Bouton principal */
  --btn-bg: #121a2b;
  --btn-fg: #f8fafc;
  --btn-bg-hover: #007463;
  --btn-fg-hover: #ffffff;

  /* Sémantique */
  --ok: #1f6f3d;
  --ok-wash: #dcf7e2;
  --warn: #8a5600;
  --warn-wash: #feedc9;
  --danger: #b32322;
  --danger-wash: #ffe7e4;

  /* Typographie */
  --font-sans: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.375rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.625rem);
  --text-2xl: clamp(1.75rem, 1.45rem + 1.4vw, 2.625rem);
  --text-3xl: clamp(2rem, 1.55rem + 2vw, 3rem);
  --text-poster: clamp(2.375rem, 1.6rem + 3vw, 4rem);
  --font-display: "Instrument Serif", "Instrument Fallback", Georgia, "Times New Roman", serif;

  --leading-tight: 1.08;
  --leading-snug: 1.25;
  --leading-body: 1.6;

  --tracking-tight: -0.022em;
  --tracking-tighter: -0.034em;
  --tracking-label: 0.08em;

  /* Espace — base 4 px */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --gutter: clamp(1rem, 0.4rem + 3vw, 2.5rem);
  --section-gap: clamp(2.5rem, 1.8rem + 3.5vw, 4.5rem);
  --page-max: 72rem;
  --measure: 62ch;

  /* Formes */
  --radius-sm: 2px;
  --radius: 4px;
  --rule-w: 1px;
  --shadow-pop: 0 8px 24px rgba(18, 26, 43, 0.12);

  /* Mouvement */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.05, 0.7, 0.1, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-long: 500ms;
  --dur-reveal: 900ms;
  --header-h: 3.5rem;

  /* Plans */
  --z-header: 10;
  --z-overlay: 100;
}

/* Thème sombre : choisi par le visiteur… */
:root[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0d121b;
  --paper-sunk: #141a24;
  --surface: #181e2a;
  --ink: #e7ecf0;
  --ink-soft: #b1b8c1;
  --ink-faint: #8b939d;
  --rule: #2d333d;
  --rule-strong: #e7ecf0;
  --accent: #57d8b4;
  --accent-wash: #0e2f2a;
  --focus: #57d8b4;

  --band-bg: #040811;
  --band-surface: #0d121b;
  --band-fg: #f2f6f8;
  --band-muted: #afb8c4;
  --band-rule: #272e3b;
  --band-accent: #50e8c0;
  --band-grid: rgba(242, 246, 248, 0.05);
  --band-halo: rgba(80, 232, 192, 0.1);
  --grid-line: rgba(231, 236, 240, 0.06);

  --btn-bg: #e7ecf0;
  --btn-fg: #0d121b;
  --btn-bg-hover: #57d8b4;
  --btn-fg-hover: #0d121b;

  --ok: #72cf8e;
  --ok-wash: #172c1d;
  --warn: #edbb64;
  --warn-wash: #332710;
  --danger: #f98f87;
  --danger-wash: #3e1e1c;

  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* … ou par le réglage de l'appareil quand le script n'a pas tourné. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;

    --paper: #0d121b;
    --paper-sunk: #141a24;
    --surface: #181e2a;
    --ink: #e7ecf0;
    --ink-soft: #b1b8c1;
    --ink-faint: #8b939d;
    --rule: #2d333d;
    --rule-strong: #e7ecf0;
    --accent: #57d8b4;
    --accent-wash: #0e2f2a;
    --focus: #57d8b4;

    --band-bg: #040811;
    --band-surface: #0d121b;
    --band-fg: #f2f6f8;
    --band-muted: #afb8c4;
    --band-rule: #272e3b;
    --band-accent: #50e8c0;
    --band-grid: rgba(242, 246, 248, 0.05);
    --band-halo: rgba(80, 232, 192, 0.1);
    --grid-line: rgba(231, 236, 240, 0.06);

    --btn-bg: #e7ecf0;
    --btn-fg: #0d121b;
    --btn-bg-hover: #57d8b4;
    --btn-fg-hover: #0d121b;

    --ok: #72cf8e;
    --ok-wash: #172c1d;
    --warn: #edbb64;
    --warn-wash: #332710;
    --danger: #f98f87;
    --danger-wash: #3e1e1c;

    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

/*
 * Marque Accueil IA (une marque de GOODEV), sur les documents client qui la portent :
 * mêmes composants, autres jetons. La marque impose le thème clair.
 */
[data-brand="accueil_ia"] {
  color-scheme: light;

  --paper: #fdf6f0;
  --paper-sunk: #f5ece2;
  --surface: #ffffff;
  --ink: #1f1612;
  --ink-soft: #5c4a3f;
  --ink-faint: #806a5d;
  --rule: #e2d2c2;
  --rule-strong: #1f1612;
  --accent: #b9502f;
  --accent-wash: #fbe4dc;
  --focus: #b9502f;
  --grid-line: rgba(31, 22, 18, 0.06);

  --band-bg: #2a1d17;
  --band-surface: #36261e;
  --band-fg: #fdf6f0;
  --band-muted: #d9c7b8;
  --band-rule: #4a362b;
  --band-accent: #f08b6f;
  --band-grid: rgba(253, 246, 240, 0.06);

  --accent-fill: #e76f51;
  --on-accent-fill: #1f1612;

  --btn-bg: #1f1612;
  --btn-fg: #fdf6f0;
  --btn-bg-hover: #b9502f;
  --btn-fg-hover: #ffffff;

  --ok: #1f6f55;
  --ok-wash: #e3f1ec;
  --warn: #8a5a12;
  --warn-wash: #f8ecd6;
  --danger: #a8382b;
  --danger-wash: #f8e2de;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}
