/* =====================================================================
   BASE: reset, typography, focus, application structure
   No hard-coded colour or size: tokens only.
   ===================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: var(--taille-m);
  line-height: var(--interligne);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--structure); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
[hidden] { display: none !important; }

/* Visible focus everywhere, keyboard only */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-anneau); border-radius: var(--rayon-s); }

.visuellement-cache {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.lien-evitement {
  position: absolute; left: var(--esp-3); top: var(--esp-3); z-index: 100;
  transform: translateY(-200%);
  background: var(--surface); color: var(--texte); padding: var(--esp-2) var(--esp-3);
  border: var(--trait-fin) solid var(--focus); border-radius: var(--rayon-s);
}
.lien-evitement:focus { transform: none; }

.icone { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icone--petite { width: 14px; height: 14px; }
.icone--grande { width: 24px; height: 24px; }

.chiffres { font-variant-numeric: tabular-nums; }
.doux { color: var(--texte-doux); }
.mono { font-family: var(--police-mono); font-size: var(--taille-s); }

/* ---------------------------------------------------------------------
   Application structure
   --------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--larg-menu) minmax(0, 1fr);
  min-height: 100vh;
}

.app__principal { display: flex; flex-direction: column; min-width: 0; }
.app--plein { grid-template-columns: minmax(0, 1fr); }

.page {
  width: 100%;
  max-width: var(--larg-contenu-max);
  padding: var(--esp-5) var(--esp-6) var(--esp-7);
  display: flex; flex-direction: column; gap: var(--esp-5);
}
.page--pleine { max-width: none; }

.page__entete {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--esp-3) var(--esp-5);
}
.page__titres { flex: 1 1 320px; min-width: 0; }
.page__titre {
  font-size: var(--taille-2xl); font-weight: var(--graisse-forte);
  line-height: var(--interligne-serre); letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.page__sous-titre { margin-top: var(--esp-1); color: var(--texte-doux); }
.page__actions { display: flex; flex-wrap: wrap; gap: var(--esp-2); }

.section { display: flex; flex-direction: column; gap: var(--esp-3); }
.section__titre {
  font-size: var(--taille-l); font-weight: var(--graisse-moyenne);
  display: flex; align-items: center; gap: var(--esp-2); flex-wrap: wrap;
}
.section__titre .lien-section { margin-left: auto; font-size: var(--taille-s); font-weight: var(--graisse-normale); }

/* Layout helpers */
.grille { display: grid; gap: var(--esp-4); grid-template-columns: repeat(auto-fill, minmax(var(--min, 280px), 1fr)); }
.pile { display: flex; flex-direction: column; gap: var(--esp, var(--esp-3)); }
.rangee { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp, var(--esp-2)); }
.rangee--espace { justify-content: space-between; }
.pousse { margin-left: auto; }
.colonnes { display: grid; gap: var(--esp-5); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

@media (max-width: 1100px) {
  .colonnes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .page { padding: var(--esp-4) var(--esp-4) var(--esp-6); gap: var(--esp-4); }
  .page__titre { font-size: var(--taille-xl); }
}
