/* ============================================================
   Socle : remise à zéro, typographie, accessibilité
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  font-family: var(--f-texte);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--encre);
  background: var(--pays-bg);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
:where(h1, h2, h3, h4) { font-family: var(--f-titre); font-weight: 700; line-height: 1.08; letter-spacing: -0.015em; text-wrap: balance; }
:where(p, li) { text-wrap: pretty; max-width: 68ch; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }
small { font-size: var(--t-sm); }
strong { font-weight: 700; }
em { font-style: italic; }
sup, sub { font-size: .7em; line-height: 0; }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; }
math { font-size: 1.12em; font-family: "Bricolage", "STIX Two Math", "Cambria Math", "Latin Modern Math", math; }
::selection { background: var(--astuce); color: var(--encre); }

/* Focus visible, toujours */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--encre);
  outline-offset: 3px;
  border-radius: 6px;
  box-shadow: 0 0 0 6px var(--astuce);
}

.skip-link {
  position: fixed; top: .5rem; left: .5rem; z-index: 100;
  padding: .6rem 1rem; background: var(--encre); color: #fff; border-radius: var(--r-ctrl);
  transform: translateY(-200%); transition: transform var(--d-rapide) var(--ease);
}
.skip-link:focus { transform: none; }

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

.wrap { width: min(100% - 2 * var(--gouttiere), var(--largeur)); margin-inline: auto; }

/* — La feuille Seyès : 8 mm de grand carreau, 2 mm d'interligne, marge rouge — */
.seyes {
  --seyes-ligne: 143 127 209;
  --carreau: 32px;
  background-color: var(--feuille);
  background-image:
    linear-gradient(to bottom, transparent calc(var(--carreau) - 1px), rgb(var(--seyes-ligne) / calc(.5 * var(--seyes-force, 1))) calc(var(--carreau) - 1px)),
    linear-gradient(to right, transparent calc(var(--carreau) - 1px), rgb(var(--seyes-ligne) / calc(.34 * var(--seyes-force, 1))) calc(var(--carreau) - 1px)),
    repeating-linear-gradient(to bottom, transparent 0 7px, rgb(var(--seyes-ligne) / calc(.16 * var(--seyes-force, 1))) 7px 8px);
  background-size: 100% var(--carreau), var(--carreau) 100%, 100% var(--carreau);
  background-position: 0 6px;
}
.seyes--marge {
  position: relative;
  padding-left: clamp(2.1rem, 5.2vw, 3.8rem) !important;
}
.seyes--marge::before {
  content: ""; position: absolute; inset-block: 0; left: clamp(1rem, 3vw, 2.2rem);
  width: 3px; background: #E0475B; opacity: .45; border-radius: 2px; pointer-events: none;
}

/* Confort de lecture */
[data-confort="lecture"] body { line-height: 1.8; letter-spacing: .012em; word-spacing: .06em; }
[data-confort="lecture"] .seyes { background-image: none; }

/* Mouvement réduit (préserve toujours le cycle d'animation de la mascotte Fenn) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *:not(.fenn):not(.fenn *):not(.fenn-feuille-2d), *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
[data-confort="lecture"] *:not(.fenn):not(.fenn *):not(.fenn-feuille-2d), [data-confort="lecture"] *::before, [data-confort="lecture"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
}

/* Contraste forcé (Windows High Contrast) */
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
  .btn, .btn-rond, .ticket, .tuile, .pastille, .mot, .part, .relie, .op, .champ, .carte, .feuille, .cours, .bloc, .boite {
    border: 2px solid ButtonText;
  }
  .btn:disabled, button:disabled {
    border-color: GrayText;
  }
}


/* L attribut hidden doit toujours gagner sur un display: grid / flex. */
[hidden] { display: none !important; }
