/* Base : remise à zéro, typographie, liens, focus, utilitaires d'accessibilité. Dépend de tokens.css.
   Aucune marge externe ici : les espaces entre blocs viennent des parents (layout.css, §4 de la charte). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--hauteur-entete) + var(--e-4));
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: var(--fs-texte);
  line-height: var(--lh-texte);
  font-weight: 400;
  font-kerning: normal;
  font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

body.is-verrouille {
  overflow: hidden;
}

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

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

button {
  cursor: pointer;
}

:where(h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, dl, dd) {
  margin: 0;
}

:where(ul[class], ol[class]) {
  list-style: none;
  padding: 0;
}

/* Titres : Newsreader, 400 en affichage, jamais en capitales ni en italique d'accent */
h1,
h2,
h3,
h4,
.titre-affiche,
.titre-2 {
  font-family: var(--police-titre);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: var(--lh-titre);
  text-wrap: balance;
}
h1 {
  font-size: var(--fs-h1);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.titre-affiche {
  font-size: var(--fs-affiche);
  font-weight: 380;
  line-height: 1.04;
  letter-spacing: -0.012em;
  max-width: var(--mesure-titre);
}
h2,
.titre-2 {
  font-size: var(--fs-h2);
  letter-spacing: -0.005em;
}
h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
}
h4 {
  font-family: var(--police-texte);
  font-size: var(--fs-texte);
  font-weight: 600;
  line-height: 1.4;
}

p,
li {
  text-wrap: pretty;
}

.chapo {
  font-size: var(--fs-chapo);
  line-height: 1.55;
  color: var(--texte-2);
  max-width: 44ch;
}

/* Texte long : la seule exception à la règle des piles, les paragraphes d'un même texte s'espacent entre eux */
.texte {
  max-width: var(--mesure);
}
.texte > * + * {
  margin-top: var(--e-4);
}

code,
kbd {
  font-family: var(--police-texte);
  font-variant-numeric: tabular-nums;
}

small,
.petit {
  font-size: var(--fs-petit);
  line-height: 1.5;
}

.discret {
  color: var(--texte-2);
}

strong,
b {
  font-weight: 600;
}

/* Liens : soulignés fins décalés, épaissis au survol (§6) */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness var(--duree-retour) var(--courbe), color var(--duree-retour) var(--courbe);
}
a:hover {
  text-decoration-thickness: 2px;
}
.lien {
  color: var(--lien);
  font-weight: 500;
}

/* Focus visible partout : anneau de 2 px décalé de 2 px, couleur selon le ton */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: var(--sapin);
  color: var(--platre);
}

hr {
  border: 0;
  border-top: 1px solid var(--trait);
  margin: 0;
}

/* Accessibilité */
.visuellement-cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.evitement {
  position: fixed;
  top: var(--e-3);
  left: var(--e-3);
  z-index: var(--z-evitement);
  padding: var(--e-3) var(--e-5);
  border-radius: var(--r-pilule);
  background: var(--sapin);
  color: var(--platre);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duree-etat) var(--courbe);
}
.evitement:focus-visible {
  transform: none;
  outline-color: var(--chene);
}

[hidden] {
  display: none !important;
}

/* Mouvement réduit : on coupe tout, seuls les changements d'état restent */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
