/* ============================================================================
   base.css — remise à zéro, typographie, accessibilité de fond.
   Propriétés LOGIQUES partout (margin-inline, padding-block…) : la page est
   prête pour une écriture de droite à gauche sans réécriture.
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* le focus ne doit jamais finir sous l'en-tête collant (WCAG 2.4.11) */
  scroll-padding-block-start: calc(var(--nav-h) + var(--space-4));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;           /* clip, jamais hidden : ne crée pas de conteneur de défilement */
}

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

/* ---- titres : Anton en display, resserré, jamais en capitales forcées
   (les capitales cassent la lecture par synthèse vocale des sigles) ---- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-wrap: balance;
  margin-block: 0 var(--space-4);
  color: var(--text-strong);
}
h1 { font-size: var(--fs-hero); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.12; }
h4 {
  font-family: var(--font-body);
  font-size: var(--fs-h4);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-block: 0 var(--space-3);
  color: var(--text);
  text-wrap: balance;
}

p { margin-block: 0 var(--space-4); max-inline-size: var(--measure); }
p:last-child { margin-block-end: 0; }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-muted);
  max-inline-size: 62ch;
}

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

small { font-size: var(--fs-small); }

ul, ol { margin-block: 0 var(--space-4); padding-inline-start: 1.35em; max-inline-size: var(--measure); }
li { margin-block-end: var(--space-2); }
li::marker { color: var(--accent); }

/* ---- liens ---- */
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--t-fast) var(--ease-out-cubic);
}
a:hover { color: var(--accent-cyan); }

/* ---- focus : anneau posé EN DEHORS de l'élément (outline-offset), donc c'est
   le fond qui sert de référence de contraste — 10.08:1, mesuré.
   Jamais de glow seul : il disparaît en couleurs forcées. ---- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-chip);
}
:where(a, button, input, select, textarea, summary):focus:not(:focus-visible) { outline: none; }

/* ---- lien d'évitement : premier élément focusable de la page ---- */
.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 999;
  padding: var(--space-3) var(--space-5);
  background: var(--surface-2);
  color: var(--text-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--t) var(--ease-out-expo);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---- contenu réservé aux technologies d'assistance ---- */
.sr-only {
  position: absolute;
  inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ---- tableaux : ils portent l'essentiel des règles, ils doivent être nets ---- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table { border-collapse: collapse; inline-size: 100%; font-size: var(--fs-small); }
caption {
  caption-side: top;
  text-align: start;
  padding: var(--space-4) var(--space-5) var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-small);
}
th, td {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  border-block-end: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  position: sticky; inset-block-start: 0;
  background: var(--surface-2);
  color: var(--text-strong);
  font-weight: 650;
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 1;
}
tbody tr:last-child th, tbody tr:last-child td { border-block-end: 0; }
tbody tr:hover { background: var(--elevation-overlay); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* ---- formulaires : la bordure d'un CONTRÔLE doit rester lisible (≥ 3:1) ---- */
label { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--text); margin-block-end: var(--space-2); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  inline-size: 100%;
  min-block-size: 44px;                 /* exigence de design : 44px */
  transition: border-color var(--t-fast) var(--ease-out-cubic), background var(--t-fast) var(--ease-out-cubic);
}
input:hover, select:hover { border-color: var(--accent); }
input:user-invalid { border-color: var(--danger); }
input::placeholder { color: var(--text-faint); opacity: 1; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-inline-end: var(--space-8);
}

/* ---- toute cible interactive : 44px, exigence de design du projet.
   Le plancher de conformité WCAG 2.2 AA (SC 2.5.8) est 24px ; 44px est
   au-dessus, c'est un choix produit, pas une lecture de la norme. ---- */
button, .btn, [role="button"] { min-block-size: 44px; min-inline-size: 44px; }

::selection { background: var(--accent-tint-strong); color: var(--text-strong); }

/* ---- barre de défilement discrète, sans casser le contraste ---- */
* { scrollbar-color: var(--surface-3) transparent; scrollbar-width: thin; }

/* Les couleurs forcées sont traitées dans `preferences.css`, chargé en dernier. */
