/* ─────────────────────────────────────────────────────────
   Émotivance · Design system — Base
   Reset, typographie de fond, primitives de mise en page.
   Dépend de tokens.css.
   ───────────────────────────────────────────────────────── */

/* ═══ Reset ═══════════════════════════════════════════ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  font-weight: 400;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button, input, select, textarea { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }

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

/* Le kit s'appuie sur la taille, jamais sur une fausse graisse :
   Hedvig Letters Serif n'existe qu'en 400. */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--t-h1); line-height: var(--lh-display); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); }
h4 { font-size: var(--t-h4); }
h5 { font-size: var(--t-h5); }
h6 { font-size: var(--t-base); }

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

/* Le retrait par défaut de <dd> (40px) est un héritage des navigateurs :
   dans une grille de couples intitulé / valeur, il décalait la valeur
   sous son intitulé et faisait passer un tableau propre pour un
   alignement raté. */
dl, dd { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent-text); }

::selection { background: var(--accent-15); color: var(--ink); }

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


/* ═══ Échelle typographique utilitaire ════════════════ */

.display   { font-family: var(--font-heading); font-weight: 400; letter-spacing: var(--tracking-tight); line-height: var(--lh-display); color: var(--ink); }
.t-display { font-size: var(--t-display); }
.t-h1      { font-size: var(--t-h1); }
.t-h2      { font-size: var(--t-h2); }
.t-h3      { font-size: var(--t-h3); }
.t-h4      { font-size: var(--t-h4); }
.t-h5      { font-size: var(--t-h5); }

.lede    { font-size: var(--t-lg); line-height: var(--lh-body); color: var(--ink-2); }
.body    { font-size: var(--t-base); line-height: var(--lh-body); color: var(--ink-2); }
.body-md { font-size: var(--t-md);  line-height: var(--lh-body); color: var(--ink-2); }
.body-sm { font-size: var(--t-sm);  line-height: var(--lh-body); color: var(--ink-2); }
.body-xs { font-size: var(--t-xs);  line-height: var(--lh-snug); color: var(--ink-3); }

.text-ink    { color: var(--ink); }
.text-accent { color: var(--accent-text); }
.text-muted  { color: var(--ink-3); }

/* Mise en avant à l'intérieur d'un titre. Le titre est déjà en
   bleu pétrole : l'emphase se détache par une déclinaison plus
   claire du même bleu (4,09:1), jamais par le doré — qui ne
   tient que 2,03:1 sur fond clair. */
.display em,
.em {
  font-style: italic;
  color: var(--accent-light);
}


/* Largeur de lecture confortable pour la prose longue. */
.measure    { max-width: 68ch; }
.measure-sm { max-width: 52ch; }


/* ═══ Mise en page ════════════════════════════════════ */

.container,
.container-md,
.container-prose {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container       { max-width: var(--container); }
.container-md    { max-width: var(--container-md); }
.container-prose { max-width: var(--container-prose); }

.section     { padding-block: var(--section-y); }
.section-sm  { padding-block: var(--section-y-sm); }
.section-top { padding-top: var(--section-y); }
.section-bot { padding-bottom: var(--section-y); }

/* Couture entre deux fonds — deux sections qui se suivent en changeant
   de dalle. Les deux respirations pleines s'additionnent (≈ 340 px sur
   un écran large) et creusent une bande vide où il n'y a rien à lire,
   alors que le changement de fond sépare déjà à lui seul. Les deux
   côtés de la couture passent donc à `--section-y-seam` (≈ 200 px au
   total). Entre deux sections de même fond, rien ne change : le blanc
   y est le seul séparateur et garde sa pleine valeur. */
.section:not(:is(.slab, .slab-ivory, .slab-white, .slab-ink)):has(+ .section:is(.slab, .slab-ivory, .slab-white, .slab-ink)),
.section:is(.slab, .slab-ivory, .slab-white, .slab-ink):has(+ .section:not(:is(.slab, .slab-ivory, .slab-white, .slab-ink))) {
  padding-block-end: var(--section-y-seam);
}
.section:not(:is(.slab, .slab-ivory, .slab-white, .slab-ink)) + .section:is(.slab, .slab-ivory, .slab-white, .slab-ink),
.section:is(.slab, .slab-ivory, .slab-white, .slab-ink) + .section:not(:is(.slab, .slab-ivory, .slab-white, .slab-ink)) {
  padding-block-start: var(--section-y-seam);
}

/* Dalles de couleur pleine largeur — la respiration principale
   du kit entre deux sections typographiques. */
.slab        { background: var(--surface); }
.slab-ivory  { background: var(--primary-4); }
.slab-white  { background: var(--white); }

/* Dalle bleu nuit à contenu champagne — c'est le sens imposé par la
   direction artistique : le champagne se pose SUR le bleu, jamais
   l'inverse. Texte champagne : 5,38:1. */
.slab-ink   { background: var(--slab-ink); }
.slab-ink,
.slab-ink :is(h1, h2, h3, h4, h5, p, span, li, .body, .lede) { color: var(--on-slab-ink); }
.slab-ink .badge {
  background: transparent;
  border: 1px solid var(--on-slab-ink);
  color: var(--on-slab-ink);
}
.slab-ink .badge::before { background: var(--on-slab-ink); }
.slab-ink .display em { color: var(--white); }

/* Dalle arrondie détachée des bords, façon Dermato
   (`lg:px-12.5` + `rounded-4xl`). */
.slab-inset {
  margin-inline: clamp(10px, 1rem + 1.5vw, 50px);
  border-radius: var(--r-2xl);
  overflow: hidden;
}
/* Dernière dalle de la page : le footer porte le même retrait et les
   mêmes coins arrondis, les deux se collaient donc bord à bord et se
   lisaient comme un seul pavé. Une respiration courte les décolle —
   le même écart que sur les pages sans dalle finale. */
main > .slab-inset:last-child { margin-block-end: var(--sp-7); }

.stack   { display: flex; flex-direction: column; }
.row     { display: flex; flex-direction: row; }
.wrap    { flex-wrap: wrap; }
.center  { align-items: center; }
.between { justify-content: space-between; }
.jcenter { justify-content: center; }
.tcenter { text-align: center; }

.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.gap-7 { gap: var(--sp-7); }
.gap-8 { gap: var(--sp-8); }

.grid    { display: grid; gap: var(--sp-5); }
.grid-2  { grid-template-columns: 1fr; }
.grid-3  { grid-template-columns: 1fr; }
.grid-4  { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Contenu large qui ne doit jamais faire déborder la page. */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

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


/* ═══ Mouvement ═══════════════════════════════════════ */

@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;
  }
}
