/* Charte La Chouette Veille, direction « Maison vendéenne » : source unique des jetons (voir DESIGN.md).
   Les pages secondaires la chargent par <link> ; les pages d'accueil en gardent une copie dans leur <style>
   pour l'aperçu claude.ai, que build.ps1 remplace par ce fichier. */

/* ---------- Jetons : thème clair ---------- */
:root {
  /* Marque : identiques dans tous les thèmes */
  --nuit: #14213D;
  --regard: #F59E0B;
  --regard-vif: #FBBF24;

  /* Fonds et texte */
  --bg: #FBFAF7;            /* chaux */
  --bg-alt: #EFF3F5;        /* embrun */
  --surface: #FFFFFF;
  --fg: #14213D;
  --muted: #4A5560;         /* ardoise */
  --line: #D8DFE4;
  --line-soft: #E7ECEF;

  /* Volet : couleur de structure (liens, bouton secondaire, icônes, offre mise en avant) */
  --volet: #2F5D7C;
  --volet-fonce: #234A64;
  --volet-clair: #E3EDF3;
  --ambre-txt: #A84B06;     /* l'ambre en texte, sur fond clair (≥ 5:1 sur chaux et embrun) */
  --focus: #2F5D7C;
  --ghost: #2F5D7C;         /* bouton secondaire */
  --ghost-line: #2F5D7C;

  /* Sémantique : alertes et états */
  --alert-bg: #FFF4E8;
  --alert-fg: #7C2D12;
  --alert-line: #F5C99A;
  --alert-bar: #EA580C;
  --ok: #2F6B4A;
  --ok-bg: #E6F1EA;

  /* Graphiques */
  --chart-empty: #B7C0CF;
  --chart-stay: #8FAFC4;
  --chart-band: #EEF2F5;

  /* Logo (le dessin s'inverse selon le fond) */
  --logo-corps: #14213D;
  --logo-oeil: #FFFFFF;

  /* Typographie */
  --display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --body: 'Public Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --fs-xs: 0.8125rem;   /* 13 px, plancher : légendes, mentions */
  --fs-sm: 0.9375rem;   /* 15 px */
  --fs-base: 1.0625rem; /* 17 px, texte courant */
  --fs-lg: 1.1875rem;   /* 19 px, chapeaux */
  --fs-h3: 1.3125rem;   /* 21 px */
  --fs-h2: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);
  --fs-h1: clamp(2.125rem, 1.4rem + 3.6vw, 3.5rem);

  /* Espacements, base 4 px */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --section: var(--sp-8);
  --gutter: 16px;
  --wrap: 1120px;
  --measure: 36em;      /* ≈ 70 signes en Public Sans (68ch en donnait ~90) */

  /* Formes et profondeur */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --ombre-flottante: 0 12px 32px rgba(20, 33, 61, .16);
  --t: .15s ease-out;

  color-scheme: light;
}
@media (min-width: 521px) { :root { --gutter: 24px; } }
@media (min-width: 901px) { :root { --section: var(--sp-9); } }

/* ---------- Jetons : thème sombre (réglage du système, ou choix explicite) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1829; --bg-alt: #131E33; --surface: #17233A; --fg: #E8ECF4; --muted: #A9B3C7;
    --line: #2A3854; --line-soft: #223049;
    --volet: #8DB7D4; --volet-fonce: #B5D2E6; --volet-clair: #1B2E44; --ambre-txt: #F5B547;
    --focus: #F59E0B; --ghost: #E8ECF4; --ghost-line: rgba(232, 236, 244, .45);
    --alert-bg: #3A2214; --alert-fg: #FFD7B5; --alert-line: #7A4421; --alert-bar: #F97316;
    --ok: #9BD8B3; --ok-bg: #173226;
    --chart-empty: #5B6A86; --chart-stay: #5E7FA0; --chart-band: #1E2C47;
    --logo-corps: #FFFFFF; --logo-oeil: #14213D;
    --ombre-flottante: 0 12px 32px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1829; --bg-alt: #131E33; --surface: #17233A; --fg: #E8ECF4; --muted: #A9B3C7;
  --line: #2A3854; --line-soft: #223049;
  --volet: #8DB7D4; --volet-fonce: #B5D2E6; --volet-clair: #1B2E44; --ambre-txt: #F5B547;
  --focus: #F59E0B; --ghost: #E8ECF4; --ghost-line: rgba(232, 236, 244, .45);
  --alert-bg: #3A2214; --alert-fg: #FFD7B5; --alert-line: #7A4421; --alert-bar: #F97316;
  --ok: #9BD8B3; --ok-bg: #173226;
  --chart-empty: #5B6A86; --chart-stay: #5E7FA0; --chart-band: #1E2C47;
  --logo-corps: #FFFFFF; --logo-oeil: #14213D;
  --ombre-flottante: 0 12px 32px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- Bandeau nuit : la carte de démo, le contact. Mêmes rôles, valeurs de nuit, quel que soit le thème ---------- */
.nuit {
  --bg: #14213D; --bg-alt: #1A2A4A; --surface: #1C2C4B; --fg: #F1F3F7; --muted: #C3CBDB;
  --line: #33456A; --line-soft: #2A3A5C;
  --volet: #9CC3DD; --volet-fonce: #C2DAEA; --volet-clair: #23395A; --ambre-txt: #F5B547;
  --focus: #F59E0B; --ghost: #FFFFFF; --ghost-line: rgba(255, 255, 255, .45);
  --alert-bg: #3A2214; --alert-fg: #FFD7B5; --alert-line: #7A4421; --alert-bar: #F97316;
  --ok: #9BD8B3; --ok-bg: #173226;
  --chart-empty: #5B6A86; --chart-stay: #6F90B0; --chart-band: #22345A;
  --logo-corps: #FFFFFF; --logo-oeil: #14213D;
  background: var(--bg);
  color: var(--fg);
  color-scheme: dark;
}
/* En thème sombre, la nuit s'éclaircit d'un cran pour rester un bandeau distinct du fond de page */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nuit { --bg: #1A2A4A; --bg-alt: #213357; --surface: #22365C; --line: #3A4E78; --line-soft: #30436A; --chart-band: #2A3F66; }
}
:root[data-theme="dark"] .nuit { --bg: #1A2A4A; --bg-alt: #213357; --surface: #22365C; --line: #3A4E78; --line-soft: #30436A; --chart-band: #2A3F66; }

/* ---------- Socle ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--fs-base)/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--regard); color: var(--nuit); }
a { color: var(--volet); text-decoration-thickness: 1px; text-underline-offset: .18em; transition: color var(--t), text-decoration-thickness var(--t); }
a:hover { color: var(--volet-fonce); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
p, li, dd { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; text-wrap: balance; color: var(--fg); }
h1 { font-size: var(--fs-h1); line-height: 1.08; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-h3); line-height: 1.25; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
/* Chiffres dans le texte (prix, quantités) : chiffres tabulaires de la police du texte. Plex Mono (var(--mono)) reste
   réservée aux relevés d'appareil : axes de graphique, horodatages d'alerte. */
.mono { font-family: inherit; font-variant-numeric: tabular-nums lining-nums; font-weight: 600; }
/* Petit libellé au-dessus d'un titre : texte gardé, mais en voix basse (ni majuscules ni pastille) */
.eyebrow { font: 600 var(--fs-sm)/1.3 var(--body); color: var(--volet); letter-spacing: 0; text-transform: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 22px; border-radius: var(--r-md);
  font: 600 1rem/1.1 var(--body); text-decoration: none; text-align: center; cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}
.btn-primary, .btn-primary:hover { color: var(--nuit); }
.btn-primary { background: var(--regard); }
.btn-primary:hover { background: var(--regard-vif); }
.btn-ghost { background: transparent; color: var(--ghost); border-color: var(--ghost-line); }
.btn-ghost:hover { color: var(--ghost); border-color: var(--ghost); background: color-mix(in srgb, var(--ghost) 8%, transparent); }
.btn:focus-visible { outline-color: var(--focus); }

/* ---------- Logo (SVG en ligne : fill="var(--logo-corps)" / "var(--logo-oeil)") ---------- */
.brand { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; color: var(--fg); }
.brand:hover { color: var(--fg); }
.brand-ic { flex: none; }
.brand-txt { display: flex; flex-direction: column; gap: 4px; line-height: 1; }
.brand-nom { font-family: var(--display); font-weight: 600; font-size: 1.4375rem; white-space: nowrap; }
.brand-nom b { color: var(--ambre-txt); font-weight: 600; }
.brand-sig { font: 500 var(--fs-xs)/1 var(--body); color: var(--muted); white-space: nowrap; }

/* ---------- Champs de formulaire ---------- */
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f label { font: 600 var(--fs-sm)/1.3 var(--body); }
.f input, .f select, .f textarea {
  font: 400 1rem/1.4 var(--body); color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; min-height: 48px; width: 100%;
  transition: border-color var(--t);
}
.nuit .f input, .nuit .f select, .nuit .f textarea { background: var(--bg); }
.f input:hover, .f select:hover, .f textarea:hover { border-color: var(--muted); }
.f input:focus, .f select:focus, .f textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.f .hint { font-size: var(--fs-xs); color: var(--muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--volet); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
