/* SPDX-FileCopyrightText: 2026 Open Business Foundation */
/* SPDX-License-Identifier: GPL-3.0-or-later */
/* ==========================================================================
   EC1 — socle : polices, jetons, typographie, accessibilité.

   Mise en page : une colonne de lecture (68 signes) entre le fil des
   chapitres et une marge de repères, posée sur un papier calque discret. Deux teintes
   portent le sens, comme dans l'emblème de la source : le bleu-vert de
   l'économie de la contribution (ↄ) et l'ardoise de l'économie de marché (©),
   reliées par le bleu vif des services d'information.
   ========================================================================== */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-next-italique.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("../fonts/atkinson-mono.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 500 900;
  font-stretch: 100% 125%;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------------------
   Jetons : le thème clair complet sur :root, puis les seules valeurs qui
   changent en sombre (préférence du système ou choix explicite).
   --------------------------------------------------------------------------- */
:root {
  --papier: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #e6eeec;
  --surface-3: #d6e2e0;
  --encre: #0e2129;
  --encre-2: #3c5560;
  --encre-3: #546b77;
  --trait: #c3d1d1;
  --trait-fort: #6b838c;
  --grille: rgb(14 33 41 / 0.045);

  --contribution: #08697d;
  --contribution-doux: #d6ebee;
  --contribution-fond: #0b5d6f;
  --marche: #26475a;
  --marche-doux: #dde6eb;
  --marche-fond: #23404f;
  --service: #0b7396;
  --service-vif: #14a5cf;
  --service-doux: #d4eef7;
  --seve: #2d7524;
  --seve-doux: #e0efda;
  --alerte: #a8490f;
  --alerte-doux: #f7e6d9;
  --pollen: #f1bf2a;
  --pollen-doux: #fbf1cc;
  --sur-fonce: #f3f8f8;
  /* Séries des graphiques : validées (contraste, daltonisme, saturation) contre la surface */
  --serie-1: #00809a;
  --serie-2: #b8600c;
  /* Les six mouvements, comme dans le PDF (tools/pdf/impression.css). Contraste
     vérifié : au moins 4,6:1 sur la surface, le papier et leur teinte douce. */
  --mv-comprendre: #08697d;
  --mv-planter: #2d7524;
  --mv-cultiver: #0b6f92;
  --mv-amenager: #26475a;
  --mv-polliniser: #8a6200;
  --mv-recolter: #a0450f;
  --sur-mv: #ffffff;
  --f-sur-fonce: #ffffff;

  --focus: #0b7396;
  --selection: rgb(20 165 207 / 0.22);
  --ombre-1: 0 1px 2px rgb(14 33 41 / 0.07);
  --ombre-2: 0 1px 2px rgb(14 33 41 / 0.06), 0 10px 28px -14px rgb(14 33 41 / 0.28);
  --ombre-3: 0 2px 6px rgb(14 33 41 / 0.08), 0 24px 60px -24px rgb(14 33 41 / 0.45);
  --voile: rgb(10 24 30 / 0.42);

  --police-texte: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
  --police-titre: "Archivo", "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police-code: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --echelle: 1;
  --interligne: 1.62;
  --interlettrage: 0;
  --t-xs: 0.8125rem;
  --t-s: 0.9375rem;
  --t-m: 1.125rem;
  --t-l: 1.375rem;
  --t-xl: 1.75rem;
  --t-2xl: clamp(2rem, 1.35rem + 2.4vw, 3rem);
  --t-3xl: clamp(2.4rem, 1.35rem + 4.6vw, 4.6rem);

  --e-1: 0.25rem;
  --e-2: 0.5rem;
  --e-3: 0.75rem;
  --e-4: 1rem;
  --e-5: 1.5rem;
  --e-6: 2rem;
  --e-7: 3rem;
  --e-8: 4.5rem;

  --r-1: 4px;
  --r-2: 8px;
  --r-3: 14px;
  --mesure: 68ch;
  --gouttiere: clamp(16px, 4vw, 40px);
  --barre-h: 3.75rem;
  --duree: 220ms;
  --courbe: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #0a161b;
    --surface: #0f2028;
    --surface-2: #15303a;
    --surface-3: #1d3c48;
    --encre: #e4eff1;
    --encre-2: #a9c0c7;
    --encre-3: #8ea8b1;
    --trait: #26414c;
    --trait-fort: #5f7f8a;
    --grille: rgb(228 239 241 / 0.04);
    --contribution: #55c4d8;
    --contribution-doux: #12333b;
    --contribution-fond: #0e5262;
    --marche: #a7c3d3;
    --marche-doux: #172b36;
    --marche-fond: #1c3a4a;
    --service: #47c6ee;
    --service-vif: #47c6ee;
    --service-doux: #0f3442;
    --seve: #86d06f;
    --seve-doux: #16301a;
    --alerte: #f2a165;
    --alerte-doux: #3a2416;
    --pollen: #f5cd45;
    --pollen-doux: #3a3114;
    --sur-fonce: #f3f8f8;
    --serie-1: #16a0b8;
    --serie-2: #d27a26;
    --mv-comprendre: #4fc3d6;
    --mv-planter: #86d06f;
    --mv-cultiver: #6cc0f0;
    --mv-amenager: #a7c3d3;
    --mv-polliniser: #e9b949;
    --mv-recolter: #f29b62;
    --sur-mv: #0a161b;
    --f-sur-fonce: #0a161b;
    --focus: #47c6ee;
    --selection: rgb(71 198 238 / 0.28);
    --ombre-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --ombre-2: 0 1px 2px rgb(0 0 0 / 0.35), 0 12px 30px -14px rgb(0 0 0 / 0.7);
    --ombre-3: 0 2px 6px rgb(0 0 0 / 0.4), 0 26px 60px -24px rgb(0 0 0 / 0.85);
    --voile: rgb(0 6 9 / 0.62);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #0a161b;
  --surface: #0f2028;
  --surface-2: #15303a;
  --surface-3: #1d3c48;
  --encre: #e4eff1;
  --encre-2: #a9c0c7;
  --encre-3: #8ea8b1;
  --trait: #26414c;
  --trait-fort: #5f7f8a;
  --grille: rgb(228 239 241 / 0.04);
  --contribution: #55c4d8;
  --contribution-doux: #12333b;
  --contribution-fond: #0e5262;
  --marche: #a7c3d3;
  --marche-doux: #172b36;
  --marche-fond: #1c3a4a;
  --service: #47c6ee;
  --service-vif: #47c6ee;
  --service-doux: #0f3442;
  --seve: #86d06f;
  --seve-doux: #16301a;
  --alerte: #f2a165;
  --alerte-doux: #3a2416;
  --pollen: #f5cd45;
  --pollen-doux: #3a3114;
  --sur-fonce: #f3f8f8;
  --serie-1: #16a0b8;
  --serie-2: #d27a26;
  --mv-comprendre: #4fc3d6;
  --mv-planter: #86d06f;
  --mv-cultiver: #6cc0f0;
  --mv-amenager: #a7c3d3;
  --mv-polliniser: #e9b949;
  --mv-recolter: #f29b62;
  --sur-mv: #0a161b;
  --f-sur-fonce: #0a161b;
  --focus: #47c6ee;
  --selection: rgb(71 198 238 / 0.28);
  --ombre-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --ombre-2: 0 1px 2px rgb(0 0 0 / 0.35), 0 12px 30px -14px rgb(0 0 0 / 0.7);
  --ombre-3: 0 2px 6px rgb(0 0 0 / 0.4), 0 26px 60px -24px rgb(0 0 0 / 0.85);
  --voile: rgb(0 6 9 / 0.62);
  color-scheme: dark;
}

/* Couleur du mouvement courant : tout élément marqué data-mv la transmet à ses enfants */
:root { --mv: var(--contribution); }
[data-mv="comprendre"] { --mv: var(--mv-comprendre); }
[data-mv="planter"] { --mv: var(--mv-planter); }
[data-mv="cultiver"] { --mv: var(--mv-cultiver); }
[data-mv="amenager"] { --mv: var(--mv-amenager); }
[data-mv="polliniser"] { --mv: var(--mv-polliniser); }
[data-mv="recolter"] { --mv: var(--mv-recolter); }
[data-mv] {
  --mv-doux: color-mix(in srgb, var(--mv) 9%, var(--surface));
  --mv-trait: color-mix(in srgb, var(--mv) 45%, var(--trait));
}

/* Figures du texte (texte/figures/*.svg) : leurs couleurs suivent le thème */
:root {
  --f-fond: var(--surface);
  --f-encre: var(--encre);
  --f-encre-2: var(--encre-2);
  --f-trait: var(--trait-fort);
  --f-boucle: var(--encre);
  --f-contribution: var(--contribution);
  --f-marche: var(--marche);
  --f-service: var(--service);
  --f-sol-1: var(--contribution-doux);
  --f-sol-2: var(--surface-2);
  --f-noeud: var(--surface);
}

/* Réglages de lecture (Réglages d'affichage) */
:root[data-taille="petite"] { --echelle: 0.92; }
:root[data-taille="grande"] { --echelle: 1.12; }
:root[data-taille="tres-grande"] { --echelle: 1.26; }
:root[data-interligne="aere"] { --interligne: 1.85; --interlettrage: 0.012em; }

/* ---------------------------------------------------------------------------
   Remise à plat
   --------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
html {
  font-size: calc(100% * var(--echelle));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--barre-h) + env(safe-area-inset-top, 0px) + 1rem);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--police-texte);
  font-size: var(--t-m);
  line-height: var(--interligne);
  letter-spacing: var(--interlettrage);
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
img, svg, video, canvas { display: block; max-width: 100%; }
svg { overflow: visible; }
/* Pictogrammes : à la taille du texte, sauf mention contraire du composant */
svg.icone { width: 1.2em; height: 1.2em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
::selection { background: var(--selection); }

/* ---------------------------------------------------------------------------
   Typographie
   --------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--police-titre);
  font-stretch: 112%;
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
  color: var(--encre);
}
h1 { font-size: var(--t-2xl); font-weight: 820; font-stretch: 118%; }
h2 { font-size: var(--t-xl); font-weight: 780; }
h3 { font-size: var(--t-l); font-weight: 740; font-stretch: 106%; letter-spacing: -0.006em; }
h4 { font-size: var(--t-m); font-weight: 720; font-stretch: 100%; letter-spacing: 0; }
/* Pas de césure automatique : un mot entier se reconnaît plus vite qu'un mot coupé. */
p { margin: 0; text-wrap: pretty; hyphens: manual; }
p + p { margin-top: 0.85em; }
strong, b { font-weight: 720; }
em, i { font-style: italic; }
small { font-size: var(--t-s); }
abbr[title] { text-decoration: underline dotted 1px; text-underline-offset: 0.18em; cursor: help; }
code, kbd, samp, .mono {
  font-family: var(--police-code);
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
}
kbd {
  display: inline-block;
  padding: 0.06em 0.42em 0.1em;
  border: 1px solid var(--trait-fort);
  border-bottom-width: 2px;
  border-radius: var(--r-1);
  background: var(--surface);
  line-height: 1.3;
  white-space: nowrap;
}
ul, ol { margin: 0; padding-left: 1.25em; }
li + li { margin-top: 0.4em; }
li::marker { color: var(--encre-3); }
blockquote { margin: 0; }
hr { border: 0; border-top: 1px solid var(--trait); margin: var(--e-6) 0; }
.chiffres { font-variant-numeric: tabular-nums lining-nums; }

a {
  color: var(--service);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: text-decoration-color var(--duree) var(--courbe), color var(--duree) var(--courbe);
}
a:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
a[href^="http"]:not(.sans-fleche)::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.16em;
  font-family: var(--police-titre);
  font-size: 0.78em;
  font-weight: 600;
  text-decoration: none;
  vertical-align: 0.06em;
}

/* Étiquettes en capitales espacées (rubriques, références) */
.etiquette {
  font-family: var(--police-code);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--encre-3);
}

/* ---------------------------------------------------------------------------
   Accessibilité
   --------------------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-1);
}
/* Titres et sections atteints par programme (changement de page, sommaire) : pas de cadre */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.evitement {
  position: absolute;
  left: var(--e-4);
  top: -100px;
  z-index: 100;
  padding: var(--e-2) var(--e-4);
  background: var(--encre);
  color: var(--papier);
  border-radius: var(--r-2);
  font-weight: 700;
  text-decoration: none;
}
.evitement:focus { top: calc(env(safe-area-inset-top, 0px) + var(--e-2)); }
.visuellement-cache,
.annonces {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
:root[data-mouvement="reduit"] *,
:root[data-mouvement="reduit"] *::before,
:root[data-mouvement="reduit"] *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

.sans-script {
  max-width: var(--mesure);
  margin: var(--e-8) auto;
  padding-inline: var(--gouttiere);
}
.sans-script p { margin-top: var(--e-4); }

/* Page introuvable (404.html, servie par le serveur pour une adresse inconnue) */
body.page-introuvable { background: var(--papier); color: var(--encre); font-family: var(--police-texte); line-height: var(--interligne); }
.introuvable { margin-block: clamp(3rem, 14vh, 8rem); }
.introuvable-marque { display: flex; align-items: center; gap: var(--e-3); font: 800 var(--t-s)/1 var(--police-titre); letter-spacing: 0.08em; text-transform: uppercase; color: var(--contribution); }
.introuvable-marque img { width: 2.5rem; height: 2.5rem; }
.introuvable h1 { font: 800 var(--t-2xl)/1.08 var(--police-titre); margin: var(--e-6) 0 0; }
.introuvable-actions { display: flex; flex-wrap: wrap; gap: var(--e-3); margin-top: var(--e-6); }
