/* =============================================================
   Base — reset moderne, typographie globale, focus accessible
   -------------------------------------------------------------
   Charge _tokens.css en amont.
   Hypothèse : ce fichier est servi en deuxième position
   (après _tokens.css, avant _components.css).
   ============================================================= */

/* -------------------------------------------------------------
   Polices Inter — AUTO-HÉBERGÉES (assets/fonts/), servies same-origin.
   La CSP (bootstrap.php : font-src 'self') interdit fonts.gstatic.com :
   Inter n'était donc jamais chargée en prod (fallback système silencieux).
   Ici woff2 variable (l'axe de graisse couvre 400/500/600 avec un seul
   fichier par sous-ensemble). font-display: swap = texte immédiat en
   fallback le temps du téléchargement. Précachées par le service worker.
   ------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* -------------------------------------------------------------
   Reset minimal — sans normalize.css. On ne touche qu'aux
   défauts qui gênent vraiment.
   ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;
  tab-size: 4;
  height: 100%;
}

/* App shell — le document ne défile jamais : c'est <main class="shell">
   qui porte le scroll (voir _components.css). Résultat : la navbar reste
   immobile pendant le rebond élastique iOS ; l'étirement se produit dans
   la zone sous elle. overscroll-behavior coupe le rebond résiduel du
   document lui-même (Safari 16+). */
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior-y: none;
  display: flex;
  flex-direction: column;
  /* brand-900 et non neutral-50 : le fond du body n'apparaît que dans les
     recoins (bande libérée quand la navbar s'efface clavier ouvert, reveals
     de pan WebKit) — en sombre, ces zones se fondent dans le chrome au lieu
     de flasher en clair. Les surfaces réelles sont peintes par .nav/.shell. */
  background: var(--brand-900);
  color: var(--neutral-900);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------
   Typographie globale.
   Les titres restent serrés (leading-tight) pour la densité.
   ------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--neutral-900);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5, h6 { font-size: var(--text-base); }

p {
  margin: 0;
}

p + p {
  margin-top: var(--space-3);
}

small {
  font-size: var(--text-xs);
}

strong {
  font-weight: var(--weight-semibold);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

a {
  color: var(--brand-800);
  text-decoration: none;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  border-top: var(--border-subtle);
  margin: var(--space-6) 0;
}

/* -------------------------------------------------------------
   Focus accessible.
   Stratégie : on retire l'outline natif et on impose un ring
   `box-shadow` brand-100, posé exclusivement sur :focus-visible
   (clavier / lecteur d'écran), pas sur clic souris.
   WCAG 2.4.7 — focus visible.
   ------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--brand-900);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Sur les éléments form qui ont déjà leur propre traitement
   (border + ring), le focus-visible est piloté par le composant. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* -------------------------------------------------------------
   Sélection texte — teinte brand discrète.
   ------------------------------------------------------------- */
::selection {
  background: var(--brand-100);
  color: var(--brand-900);
}

/* -------------------------------------------------------------
   Scrollbar discrète.
   Firefox via scrollbar-* ; WebKit via pseudo-éléments.
   ------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--neutral-300);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--neutral-500);
  background-clip: content-box;
}

/* -------------------------------------------------------------
   Mouvement réduit — respect des préférences système.
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------
   Mobile — éviter le zoom iOS au focus.
   16px sur les inputs sous 1024px (le brief desktop garde 15px).
   ------------------------------------------------------------- */
@media (max-width: 1023.98px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}
