/* Compléments propres au blog ; tout le reste vient de site.css (copie EXACTE de assets/css/site.css du site v2, source
   unique : ne jamais la modifier ici ; npm run check échoue si elle diffère de celle du v2).
   Uniquement les tokens de site.css : couleurs, --s1…--s8, --measure, --border, --radius, --fs-*. */

/* ============ Article : en-tête ============ */
/* .post est un conteneur : les images « large » et « pleine » se calent sur sa largeur utile (cqi), sans 100vw */
.post { container-type: inline-size; }
/* Colonne unique de l'article : titres, texte, listes, couverture et images « large » partagent la même largeur.
   En rem (et non en ch) : le ch dépend du corps de chaque élément, ce qui rendait les titres plus larges que le texte.
   47.5rem = 760 px, environ 72 caractères par ligne à 19 px ; le conteneur plafonne déjà à la largeur de l'en-tête. */
.post { --measure: 47.5rem; --lh-body: 1.65; }
.post__body { font-size: 1.1875rem; }
.post__body > p { max-width: var(--measure); } /* annule le « .page p { max-width: 65ch } » de site.css */
.post__head { --od-gap: var(--s2); margin-bottom: var(--s5); max-width: var(--measure); }
.post__cat { font-size: var(--fs-small); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.post__chapo { font-size: var(--fs-lead); line-height: 1.45; }
.post__meta, .post__date { color: var(--ink-soft); font-size: var(--fs-small); }
.post__head .fig--couverture { margin-top: var(--s3); }

/* ============ Sommaire « Dans cet article » ============ */
.toc {
  max-width: var(--measure); margin-bottom: var(--s5);
  padding: var(--s3); border: var(--border); border-radius: var(--radius); background: var(--white);
}
.toc__titre { font-weight: 600; margin-bottom: var(--s1); }
.toc__list { margin: 0; padding-left: 1.4em; }
.toc__item + .toc__item { margin-top: 4px; }
.toc__item--h3 { margin-left: 1.2em; list-style-type: circle; }
.toc a { text-underline-offset: 3px; text-decoration-color: var(--terra); }

/* ============ Corps de l'article : colonne de lecture et rythme vertical ============ */
.post__body > * { max-width: var(--measure); }
.post__body > * + * { margin-top: var(--s3); }
.post__body p, .post__body li { line-height: var(--lh-body); }
.post__body > h2 { font-size: var(--fs-h3); margin-top: var(--s6); line-height: 1.05; }
.post__body > h3 { font-size: clamp(1.375rem, 1.25rem + .5vw, 1.625rem); margin-top: var(--s5); line-height: 1.1; }
.post__body > h2 + *, .post__body > h3 + * { margin-top: var(--s2); }
/* Les intertitres ne passent pas sous l'en-tête collant : scroll-padding-top de html (fin de fichier) */
.post__body :is(h2, h3)[id] { clear: both; }
.page h3 { font-size: clamp(1.375rem, 1.25rem + .5vw, 1.625rem); }
.post__body ul, .post__body ol { margin-bottom: 0; padding-left: 1.2em; }
.post__body li + li { margin-top: var(--s1); }
.post__back { margin-top: var(--s5); }
.post__retour { font-size: var(--fs-small); }

/* Liens écrits en Markdown (sans classe) : même aspect que .link de site.css */
.post__body a:not([class]) {
  font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
  text-decoration-color: var(--terra);
}
@media (hover: hover) { .post__body a:not([class]):hover { text-decoration-color: currentColor; text-decoration-thickness: 3px; } }

/* ============ Images ============ */
.fig { margin: 0; }
.fig img { width: 100%; height: auto; border-radius: var(--radius); }
.fig figcaption { margin-top: var(--s1); font-size: var(--fs-small); color: var(--ink-soft); line-height: 1.5; }
.post__body > .fig--large, .fig--couverture { max-width: min(100cqi, var(--measure)); }
.post__body > .fig--pleine { max-width: none; width: 100cqi; }
/* Flottants : uniquement sur grand écran ; empilés (ordre du code = ordre de lecture) en dessous */
@media (min-width: 64em) {
  .post__body > .fig--gauche, .post__body > .fig--droite { width: 21em; max-width: 45%; margin-top: .4em; margin-bottom: var(--s2); }
  .post__body > .fig--gauche { float: left; margin-right: var(--s3); }
  .post__body > .fig--droite { float: right; margin-left: var(--s3); }
  /* la colonne fait --measure : l'image de droite reste dans la colonne */
  .post__body > .fig--droite { margin-right: max(0px, calc(100cqi - var(--measure))); }
}
.post__body > :is(h2, h3, .galerie, .fig--large, .fig--pleine, .tableau, .cta, .aretenir, .citation) { clear: both; }

/* Galerie : 2 ou 3 images côte à côte, empilées sur mobile */
.galerie { display: grid; gap: var(--s2); }
@media (min-width: 40em) {
  .galerie--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .galerie--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============ Composants de texte ============ */
/* Citation mise en avant (pull quote) */
.post__body > .exergue {
  margin-block: var(--s5); padding-left: var(--s3); border-left: 6px solid var(--mustard);
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem); line-height: 1.1;
}
/* Citation avec source */
.citation { margin-inline: 0; }
.citation blockquote { margin: 0; padding-left: var(--s3); border-left: 4px solid var(--stone); font-style: italic; }
.citation blockquote > * + * { margin-top: var(--s2); }
.citation figcaption { margin-top: var(--s1); padding-left: var(--s3); font-size: var(--fs-small); color: var(--ink-soft); }
.citation figcaption::before { content: "— "; }
.citation cite { font-style: normal; }
/* Encadré « À retenir » */
.aretenir { padding: var(--s3); background: var(--mustard-soft); border: var(--border); border-radius: var(--radius); }
.aretenir > * + * { margin-top: var(--s2); }
.aretenir__titre { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; text-transform: uppercase; line-height: 1; }
.aretenir ul { padding-left: 1.2em; }
/* Code */
.post__body code { font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; font-size: .9em; }
.post__body :not(pre) > code { background: var(--mustard-soft); padding: .1em .3em; border-radius: 3px; }
.post__body pre {
  overflow-x: auto; padding: var(--s2) var(--s3); background: var(--ink); color: var(--paper);
  border-radius: var(--radius); line-height: 1.5; font-size: var(--fs-small);
}
/* Tableaux : div.tableau défile horizontalement sur mobile */
.tableau { overflow-x: auto; }
.post__body table { border-collapse: collapse; width: 100%; font-size: var(--fs-small); line-height: 1.45; }
.post__body caption { text-align: left; font-weight: 600; padding-bottom: var(--s1); }
.post__body th, .post__body td { padding: var(--s1) var(--s2); border-bottom: 2px solid var(--stone); text-align: left; vertical-align: top; }
.post__body thead th { border-bottom: var(--border); }
.post__body tbody th { font-weight: 600; }
/* Appel à l'action */
.cta { padding: var(--s4); background: var(--terra-soft); border: var(--border); border-radius: var(--radius); }
.cta > * + * { margin-top: var(--s2); }
.cta__titre { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h3); line-height: 1; }
.cta .btn { margin-top: var(--s1); }

/* ============ Fin d'article : sources, précédent/suivant, articles liés ============ */
.post__sources, .post__nav, .post__lies { max-width: var(--measure); margin-top: var(--s6); }
.post__sources h2, .post__lies h2 { font-size: var(--fs-h3); }
.post__sources ul { margin: var(--s2) 0 0; padding-left: 1.2em; }
.post__sources li + li { margin-top: var(--s1); }
.post__nav-list { list-style: none; margin: 0; padding: var(--s3) 0 0; border-top: 2px solid var(--stone); display: grid; gap: var(--s3); }
@media (min-width: 40em) { .post__nav-list { grid-template-columns: 1fr 1fr; } .post__nav-suiv { grid-column: 2; text-align: right; } }
.post__nav-label { display: block; font-size: var(--fs-small); color: var(--ink-soft); }

/* ============ Liste des articles (accueil, pages 2+, catégories) : « À la une » + grille ============ */
/* Une seule liste : la une (page 1 et catégories) occupe toute la largeur, les autres articles en 2 colonnes dès 1000 px.
   Chaque carte : un seul lien (le titre), étendu à toute la carte par son ::after ; focus : anneau terracotta du titre
   (:focus-visible de site.css) + contour encre de la carte. Survol : soulignement du titre, sans transition.
   Remplaçants de la maquette : --paper2 -> --white, --line -> --stone (aucune couleur nouvelle). */
.articles { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: 40px; }
.carte { position: relative; display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: var(--s3); align-items: start; }
.carte__texte { --od-gap: var(--s1); }
.page .carte__titre { margin-top: 0; font-size: 1.75rem; line-height: 1.05; }
.page .carte__extrait { font-size: var(--fs-body); max-width: none; }
.carte__lien::after { content: ""; position: absolute; inset: 0; }
.carte__lien:focus-visible::after { outline: 2px solid var(--ink); outline-offset: 8px; border-radius: 10px; }
@media (hover: hover) { .carte:hover .carte__lien { text-decoration-color: currentColor; text-decoration-thickness: 3px; } }

/* Images : carré de 160 px (grille) ou 4/3 (une), recadrées par object-fit (déjà au bon format : shortcode vignette) */
.carte__media picture { display: block; }
.carte__media img, .carte__remplacement {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border: 2px solid var(--ink); border-radius: 8px;
}
/* Sans couverture : fond blanc, filet pierre intérieur, nom de la catégorie (décoratif, aria-hidden) */
.carte__remplacement {
  display: flex; align-items: center; justify-content: center; padding: var(--s2);
  background: var(--white); box-shadow: inset 0 0 0 6px var(--white), inset 0 0 0 8px var(--stone);
  color: var(--ink-soft); font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; line-height: 1;
  text-transform: uppercase; text-align: center; overflow-wrap: anywhere;
}

/* La une : couverture 4/3 (rayon 10) au-dessus du texte, puis à gauche (3fr / 2fr) dès 760 px ; filet encre dessous.
   Titre : 40 px, puis 56 px dès 1000 px */
.carte--une { grid-template-columns: minmax(0, 1fr); padding-bottom: 40px; border-bottom: 2px solid var(--ink); }
.carte--une .carte__media img, .carte--une .carte__remplacement { aspect-ratio: 4 / 3; border-radius: 10px; }
.carte--une .carte__remplacement { font-size: 2.5rem; box-shadow: inset 0 0 0 10px var(--white), inset 0 0 0 12px var(--stone); }
.page .carte--une .carte__titre { font-size: 2.5rem; }
@media (min-width: 47.5em) {
  .carte--une { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 40px; align-items: center; }
}
/* Grille en 2 colonnes et titre de la une en 56 px dès 1000 px seulement : entre 760 et 999 px, le texte à côté d'une
   vignette ne ferait que 146 à 250 px et le titre de la une 5 lignes (choix validé par Ben, maquette : 760 px) */
@media (min-width: 62.5em) {
  .articles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .carte--une { grid-column: 1 / -1; }
  .page .carte--une .carte__titre { font-size: 3.5rem; }
}
/* Moins de 480 px : vignette (toujours 160 px) au-dessus du texte */
@media (max-width: 29.99em) { .carte--grille { grid-template-columns: minmax(0, 1fr); } .carte--grille .carte__media { width: 160px; } }

/* ============ Articles liés (fin d'article) et filtres de catégorie ============ */
.post-list { list-style: none; margin: var(--s4) 0 0; padding: 0; max-width: var(--measure); }
.post-list__item { --od-gap: var(--s1); }
.post-list__item + .post-list__item { margin-top: var(--s5); }
.post-list h2, .post-list h3 { margin-top: 0; }
.cats__list { list-style: none; margin: 0; padding: 0; --od-gap: var(--s3); }
.cats a[aria-current="page"] { text-decoration-thickness: 4px; }

/* ============ Repère de statut (test local uniquement : brouillon, masqué) ============ */
.repere-statut {
  display: inline-block; padding: 4px 10px; background: var(--mustard); color: var(--ink);
  border: var(--border); border-radius: var(--radius); font-weight: 800; letter-spacing: .04em;
}

/* ============ Navigation : lien « Blog » ============ */
/* site.css souligne déjà aria-current="true" (rubrique courante) ; même repère pour la page /blog/ elle-même */
.nav__link[aria-current="page"]::after { transform: scaleX(1); }
/* Écart avant « Me contacter », interlignages du menu entre 900 et 1199 px et bouton « Menu » : règles d'en-tête
   communes, dans site.css (copie exacte de celui du site v2, source unique ; contrôlée par npm run check). */

/* ============ Défilement : en-tête collant en haut, lien « Haut de page » en bas ============ */
/* WCAG 2.4.11 : un élément qui reçoit le focus ou une ancre visée ne finit jamais sous l'en-tête collant (76 px et
   plus) ni sous le lien flottant (48 px + marge). Remplace les scroll-margin-top: 88px de site.css (sinon cumulés). */
html { scroll-padding-top: 88px; scroll-padding-bottom: calc(48px + 2 * var(--s2)); }
section[id], .card[id] { scroll-margin-top: 0; }

/* ============ Lien flottant « Haut de page » ============ */
/* Ancre vers #haut (body), sans JavaScript ; cible de 48 px ; dernier élément du parcours clavier.
   Fond moutarde + bordure encre (15:1 sur papier, 8:1 sur le pied sombre). Focus : anneau terracotta de la charte,
   séparé du bouton par un halo papier, visible aussi sur le pied de page sombre (terracotta/encre = 2,99:1 seul). */
.haut-de-page {
  position: fixed; right: var(--s2); bottom: var(--s2); z-index: 40;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-width: 48px; min-height: 48px; padding: 0 var(--s2);
  background: var(--mustard); color: var(--ink); border: var(--border); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 700; font-size: var(--fs-small); line-height: 1.2; text-decoration: none;
}
.haut-de-page:focus-visible { outline: 3px solid var(--terra); outline-offset: 3px; box-shadow: 0 0 0 3px var(--paper); }
.haut-de-page__icone { width: 16px; height: 16px; flex: none; }
@media (hover: hover) { .haut-de-page:hover { background: var(--mustard-soft); } }
/* Écran étroit : flèche seule (le texte reste le nom du lien), pour masquer le moins de texte possible */
@media (max-width: 39.99em) {
  .haut-de-page { padding: 0; }
  .haut-de-page__texte { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
/* Le bas du pied de page n'est jamais caché par le lien flottant */
.footer { padding-bottom: calc(var(--s5) + 48px + var(--s2)); }

/* ============ Pagination de la liste des articles ============ */
.pagination { margin-top: var(--s6); max-width: var(--measure); }
.pagination__liste { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
.pagination__lien {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); min-width: 48px; min-height: 48px; padding: 0 var(--s2);
  background: var(--white); color: var(--ink); border: var(--border); border-radius: var(--radius);
  font-weight: 700; text-decoration: none;
}
/* Page courante : fond encre (et aria-current, annoncé), non soulignable : on y est déjà */
.pagination__lien[aria-current="page"] { background: var(--ink); color: var(--white); }
@media (hover: hover) { .pagination__lien:not([aria-current]):hover { background: var(--mustard-soft); } }
.pagination__item--ellipse { min-width: 24px; text-align: center; font-weight: 700; }
