/* ═══════════════════════════════════════════════════════════════════
   Reset et fondations typographiques
   ═══════════════════════════════════════════════════════════════════ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--font-texte);
  font-size: var(--texte-base);
  line-height: var(--interligne-texte);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

/* Les attributs width/height servent à réserver la place au chargement.
   Sans ceci, height="…" fixe une hauteur en pixels qui écrase les
   aspect-ratio du CSS et déforme les cadrages (images étirées puis rognées). */
img { height: auto; }

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

button { cursor: pointer; }

p,
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* ── Titres ───────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--interligne-titre);
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

h1 { font-size: var(--titre-md); line-height: var(--interligne-serre); }
h2 { font-size: var(--titre-sm); }
h3 { font-size: var(--texte-xl); }
h4 { font-size: var(--texte-lg); }

a {
  color: inherit;
  text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
  text-underline-offset: 0.22em;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--vert-600);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--or-500);
  color: var(--encre-900);
}

/* ── Barre de défilement ──────────────────────────────────────── */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--papier-alt); }
::-webkit-scrollbar-thumb {
  background: var(--encre-200);
  border: 3px solid var(--papier-alt);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--vert-500); }

/* ═══════════════════════════════════════════════════════════════
   Primitives de mise en page
   ═══════════════════════════════════════════════════════════════ */

.enveloppe {
  width: 100%;
  max-width: var(--largeur-max);
  margin-inline: auto;
  padding-inline: var(--gouttiere);
}

.enveloppe--etroite { max-width: 880px; }

.section { padding-block: var(--section); }
.section--serre { padding-block: calc(var(--section) * 0.62); }
.section--alt { background: var(--fond-alt); }

.pile > * + * { margin-top: var(--gap-md); }
.pile-sm > * + * { margin-top: var(--gap-sm); }

.saut-lien {
  position: absolute;
  left: -9999px;
  z-index: var(--z-lightbox);
  padding: 0.75rem 1.25rem;
  background: var(--encre-900);
  color: var(--sur-fonce);
  font-weight: 700;
}
.saut-lien:focus { left: 1rem; top: 1rem; }

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

/* ═══════════════════════════════════════════════════════════════
   Signature graphique : le triband du drapeau
   ═══════════════════════════════════════════════════════════════ */

.triband {
  display: block;
  height: 4px;
  width: 84px;
  background: linear-gradient(
    to right,
    var(--vert-600) 0 33.33%,
    var(--rouge-600) 33.33% 66.66%,
    var(--or-500) 66.66% 100%
  );
}

.triband--pleine { width: 100%; height: 3px; }
.triband--fine { height: 2px; }

/* Étoile du drapeau, utilisée en puce et en filigrane */
.etoile {
  display: inline-block;
  color: var(--or-600);
  font-size: 0.7em;
  vertical-align: 0.15em;
}

/* ── Texture de fond : grain de papier très discret ───────────── */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════════════════════════
   Accessibilité : mouvement réduit
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveler { opacity: 1 !important; transform: none !important; }
}

/* ── Révélation au défilement ─────────────────────────────────────
   Amélioration progressive : sans JavaScript, la classe `js` n'est
   jamais posée sur <html> et le contenu reste simplement visible. */
.js .reveler {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity var(--duree-lente) var(--sortie),
    transform var(--duree-lente) var(--sortie);
}

.js .reveler.est-visible {
  opacity: 1;
  transform: none;
}
