/*
 * Page de lecture d'un article sur ordinateur (templates/blog_post.html ; le gabarit mobile n'est pas concerné).
 *
 * Un seul axe de lecture, centré : fil d'Ariane, titre, chapeau, date, événement, texte et fin d'article partagent le
 * même bord gauche ; seule la couverture, centrée sur le même axe, peut être plus large que le texte. Aucune colonne
 * latérale, rien de collant hors la fine barre de progression (CSS seul, navigateurs qui la gèrent).
 *
 * Mesure : la taille du texte grandit avec l'écran (18 px à 1024, 20 px à 1440, 21 px à 1920, 22 px au-delà de 2200)
 * et la colonne avec elle (40 fois la taille du texte, 64 à 72 signes par ligne) : la page respire sur un grand écran
 * sans allonger les lignes. Texte et intertitres plus clairs que le gris des autres pages, comme sur mobile.
 *
 * Classes posées à l'affichage par markdown_render.desktop_article (jamais dans le HTML enregistré) : chapeau
 * (.post-lead), introduction (.prose-intro), questions d'entretien (.is-question), intertitres en gras (.is-subhead),
 * figures (.prose-figure), listes écrites en paragraphes (.prose-list--emoji), suites de liens (.prose-links), liens
 * écrits en adresse (.is-url), tweets (.is-tweet), séparateurs (.prose-sep), signature (.is-signoff).
 * Toutes les règles sont limitées à .post-page : la liste des actualités, l'accueil et le mobile ne changent pas.
 */

.post-page {
  --read: clamp(18px, calc(12.5px + .52vw), 21px);
  --measure: calc(var(--read) * 40);
  --wide: min(calc(var(--measure) * 1.3), 1080px);
  --ink: rgba(255, 255, 241, .80);
  --ink-strong: rgba(255, 255, 241, .92);
  --rule: rgba(255, 255, 241, .10);
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  --card-bg: linear-gradient(145deg, rgba(255, 255, 241, .07), rgba(255, 255, 241, .025));
  --card-x: 24px; /* marge intérieure gauche commune aux cartes (événement, tweet, fin d'article) */
}
@media (min-width: 2200px) { .post-page { --read: 22px; } }
.post-page .wrap.narrow { max-width: calc(var(--measure) + 2 * var(--gutter)); }

/* ---------- Barre de progression : seul élément fixe, CSS seul (sans script, sans stockage) ---------- */
.post-progress {
  display: none;
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 70;
  height: 2px;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(23, 141, 255, .45);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .post-progress { display: block; animation: post-progress linear both; animation-timeline: scroll(root); }
}
@keyframes post-progress { to { transform: scaleX(1); } }

/* ---------- En-tête ---------- */
/* Au-dessus de la couverture : le menu « Ajouter à mon agenda » de l'événement s'ouvre par-dessus. */
.post-page .post-hero { position: relative; z-index: 2; padding: clamp(136px, 10.5vw, 176px) 0 clamp(44px, 3.6vw, 60px); }

.post-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 clamp(22px, 1.9vw, 30px);
  font: 500 12px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.post-kicker .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font: inherit;
  letter-spacing: inherit;
  transition: color .18s ease;
}
.post-kicker .back-link span { display: inline-block; transition: transform .18s ease; }
.post-kicker .back-link:hover { color: var(--text); }
.post-kicker .back-link:hover span { transform: translateX(-3px); }
.post-kicker .back-link:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; border-radius: 4px; }
/* Boutons (S'inscrire, Parlons-en) : anneau de focus clavier visible, comme le menu agenda. */
.post-page .btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.post-kicker__sep { width: 1px; height: 12px; background: var(--line-strong); }
.post-kicker__cat { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.post-kicker__cat::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 14px var(--accent-2);
}

/* Titre : taille selon sa longueur (markdown_render.title_size), lignes équilibrées, jamais coupé dans un mot. */
.post-page .post-hero h1 {
  max-width: none;
  margin: 0;
  color: var(--text);
  font-weight: 700;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: manual;
}
.post-page .post-hero h1.post-title--xl { font-size: clamp(56px, 5.6vw, 88px); line-height: 1; letter-spacing: -.042em; }
.post-page .post-hero h1.post-title--l { font-size: clamp(48px, 4.5vw, 68px); line-height: 1.04; letter-spacing: -.038em; }
.post-page .post-hero h1.post-title--m { font-size: clamp(42px, 3.7vw, 56px); line-height: 1.08; letter-spacing: -.032em; }
.post-page .post-hero h1.post-title--s { font-size: clamp(36px, 3vw, 46px); line-height: 1.12; letter-spacing: -.026em; }

/* Chapeau : toujours plus grand et plus clair que le texte. */
.post-page .post-hero .post-lead {
  max-width: none;
  margin: clamp(20px, 1.7vw, 28px) 0 0;
  padding: 0;
  color: rgba(255, 255, 241, .86);
  font-size: calc(var(--read) * 1.18);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -.008em;
  text-wrap: pretty;
}
.post-page .post-hero .post-lead--long { font-size: calc(var(--read) * 1.08); line-height: 1.55; }
.post-page .post-hero .post-lead :is(strong, b) { color: var(--text); font-weight: 600; }
.post-page .post-hero .post-lead a { color: #5AAEFF; text-decoration: underline; text-decoration-color: rgba(23, 141, 255, .45); text-underline-offset: .2em; }

.post-page .post-hero .post-byline {
  display: block;
  margin: clamp(26px, 2.2vw, 34px) 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

/* ---------- Événement : carte sur la largeur du texte ---------- */
.post-page .post-hero .post-ev {
  margin-top: 24px;
  padding: 22px var(--card-x);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: 0 12px 60px rgba(0, 0, 0, .18);
}
.post-page .post-hero .post-ev:not(.is-past) {
  border-color: rgba(23, 141, 255, .28);
  background: radial-gradient(120% 140% at 0% 0%, rgba(71, 15, 244, .2), transparent 55%), var(--card-bg);
  box-shadow: var(--shadow);
}
.post-page .post-hero .post-ev.is-past { padding: 16px var(--card-x); }
.post-page .post-hero .post-ev.is-past .post-ev__recap { color: rgba(255, 255, 241, .78); font-size: 16px; }
.post-page .post-hero .post-ev__actions { margin-top: 20px; }
.post-page .post-hero .post-ev__actions .btn,
.post-page .post-hero .post-ev .cal-menu:not(.cal-menu--icon) .cal-menu__toggle { min-height: 46px; }

/* ---------- Couverture : image entière, à sa taille naturelle, centrée sur l'axe de lecture ---------- */
.post-cover {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto clamp(48px, 4.4vw, 72px);
  padding: 0 var(--gutter);
}
.post-cover img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72vh, 640px);
  margin-inline: auto;
  border-radius: 20px;
  background: rgba(255, 255, 241, .03);
  box-shadow: 0 0 0 1px rgba(255, 255, 241, .10), 0 34px 90px -28px rgba(0, 0, 0, .75);
}
.post-page.post--short .post-cover img { max-height: min(56vh, 520px); }
/* Couverture en hauteur (portrait) : plus basse, le texte commence plus tôt. */
.post-page .post-cover--portrait img { max-height: min(58vh, 520px); }
@media (max-height: 820px) and (min-width: 1021px) {
  .post-cover img { max-height: min(64vh, 560px); }
  .post-page .post-hero { padding-top: clamp(116px, 9vw, 140px); }
}

/* ---------- Texte ---------- */
.post-page .prose {
  --code-size: clamp(14px, .74em, 15.5px);
  color: var(--ink);
  font-family: var(--sans), 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji';
  font-size: var(--read);
  font-kerning: normal;
  line-height: 1.7;
}
/* Le gris des paragraphes des autres pages (p { color: var(--muted) }) ne s'applique pas au texte d'un article. */
.post-page .prose :is(p, li, dd, td) { color: inherit; }
.post-page .prose > :first-child { margin-top: 0; }
.post-page .prose > :last-child { margin-bottom: 0; }
.post-page .prose p { max-width: none; margin: 0 0 1.15em; padding: 0; text-wrap: pretty; }
.post-page .prose :is(strong, b) { color: var(--text); font-weight: 600; }
.post-page .prose em { color: var(--ink-strong); }

/* Introduction : premier paragraphe quand l'article n'a pas de chapeau, ou intertitre-phrase d'ouverture. */
.post-page .prose > p.prose-intro { color: var(--ink-strong); font-size: 1.12em; line-height: 1.6; }

.post-page .prose :is(h1, h2, h3, h4) { color: var(--text); font-weight: 600; text-wrap: balance; overflow-wrap: break-word; }
.post-page .prose h1 { margin: 2.2em 0 .6em; font-size: 1.9em; line-height: 1.15; letter-spacing: -.025em; }
.post-page .prose h2 { margin: 2.1em 0 .6em; font-size: 1.5em; line-height: 1.22; letter-spacing: -.022em; }
.post-page .prose h3 { margin: 1.9em 0 .5em; font-size: 1.22em; line-height: 1.32; letter-spacing: -.015em; }
.post-page .prose h4 { margin: 1.8em 0 .4em; font-size: 1.05em; line-height: 1.4; letter-spacing: -.01em; }
/* Intertitre d'ouverture resté dans le texte (l'article a son propre chapeau) : sous-titre discret. */
.post-page .prose > :is(h2, h3):first-child {
  margin: 0 0 1em;
  color: var(--ink-strong);
  font-size: 1.25em;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -.012em;
}

/* Entretien : chaque question ouvre un temps de lecture (filet dégradé, texte blanc), la réponse suit de près. */
.post-page .prose p.is-question { margin: 2.2em 0 .6em; color: var(--text); font-weight: 600; line-height: 1.55; }
.post-page .prose p.is-question::before {
  content: "";
  display: block;
  width: 28px;
  height: 2px;
  margin-bottom: .9em;
  border-radius: 2px;
  background: var(--grad);
}
.post-page .prose p:is(.is-question, .is-subhead) :is(strong, b) { color: inherit; font-weight: inherit; }
.post-page .prose p.is-subhead { margin: 2em 0 .5em; color: var(--text); font-size: 1.1em; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.post-page .prose > p:is(.is-question, .is-subhead):first-child { margin-top: 0; }
.post-page .prose p.is-signoff { margin-top: 1.6em; color: var(--muted); }

/* Fin du texte : petit carré dégradé après le dernier paragraphe (avant la signature s'il y en a une). */
.post-page .prose > p:last-child:not(.is-signoff)::after,
.post-page .prose > p:has(+ p.is-signoff:last-child)::after {
  content: "";
  display: inline-block;
  width: .42em;
  height: .42em;
  margin-left: .45em;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  vertical-align: .04em;
}

/* Pas de marque après un lien d'adresse (« ↗ ») qui clôt le texte. */
.post-page .prose > p:last-child:has(> a.is-url:last-child)::after { display: none; }

/* Liens : bleu adouci, soulignement fin ; adresse écrite en lien : libellé court, sur une ligne, « ↗ » vers un autre site. */
.post-page .prose a {
  color: #5AAEFF;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(23, 141, 255, .45);
  text-underline-offset: .22em;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.post-page .prose a:hover { color: #8CC6FF; text-decoration-color: currentColor; }
.post-page .prose a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 3px; }
.post-page .prose a:not([href]) { color: inherit; text-decoration: none; }
.post-page .prose a.is-url { overflow-wrap: normal; white-space: nowrap; }
.post-page .prose a.is-url.is-external::after {
  content: "\2197";
  content: "\2197" / "";
  display: inline-block;
  margin-left: .18em;
  font-size: .78em;
  opacity: .75;
  text-decoration: none;
}

/* Listes : puces rondes bleues, même rythme que les paragraphes. */
.post-page .prose :is(ul, ol) { margin: 0 0 1.15em; padding-left: 0; }
.post-page .prose ul { list-style: none; }
.post-page .prose ul > li { position: relative; margin: .5em 0; padding-left: 1.4em; }
.post-page .prose ul > li::before {
  content: "";
  position: absolute;
  top: .72em;
  left: .3em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
}
.post-page .prose ol { padding-left: 1.5em; }
.post-page .prose ol > li { margin: .5em 0; padding-left: .3em; }
.post-page .prose ol > li::marker { color: var(--accent-2); font: 600 .82em var(--mono); }
.post-page .prose li > p { margin: 0 0 .5em; }
.post-page .prose li > p:last-child { margin-bottom: 0; }
.post-page .prose li > :is(ul, ol) { margin: .4em 0 0; }
.post-page .prose :is(.toc, .footnote) li { padding-left: 0; }
.post-page .prose :is(.toc, .footnote) li::before { display: none; }
/* Liste écrite en paragraphes ouverts par une puce (🔹) : la puce d'origine, alignée. */
.post-page .prose ul.prose-list--emoji > li { padding-left: 1.8em; }
.post-page .prose ul.prose-list--emoji > li::before { display: none; }
.post-page .prose .prose-list__marker { position: absolute; top: 0; left: 0; }
/* Suite de liens (revue de presse) : liste à filets. */
.post-page .prose ul.prose-links { margin: .6em 0 1.4em; border-top: 1px solid var(--rule); }
.post-page .prose ul.prose-links > li { margin: 0; padding: .7em 0; border-bottom: 1px solid var(--rule); font-size: .86em; }
.post-page .prose ul.prose-links > li::before { display: none; }

/* Citations : droites (pas d'italique en Poppins), plus grandes, filet bleu. */
.post-page .prose blockquote {
  margin: 1.9em 0;
  padding: .15em 0 .15em 1.2em;
  border-left: 2px solid var(--accent-2);
  color: var(--ink-strong);
  font-size: 1.08em;
  font-style: normal;
  line-height: 1.6;
}
.post-page .prose blockquote p { margin: 0 0 .6em; color: inherit; }
.post-page .prose blockquote > :last-child { margin-bottom: 0; }
/* Tweet intégré (script retiré) : carte, liens d'image masqués, attribution en petites capitales. */
.post-page .prose blockquote.is-tweet {
  padding: 20px var(--card-x);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: .95em;
}
.post-page .prose blockquote.is-tweet a[href^="https://t.co/"],
.post-page .prose blockquote.is-tweet a[href*="pic.twitter.com"] { display: none; }
.post-page .prose blockquote.is-tweet > p:last-child:not(:first-child) {
  margin-top: 12px;
  color: var(--muted);
  font: 500 11.5px/1.5 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.post-page .prose blockquote.is-tweet > p:last-child:not(:first-child) a { color: inherit; text-decoration: none; }

/* Images du texte : à leur taille naturelle (jamais agrandies), centrées, coins arrondis. */
.post-page .prose .prose-figure { margin: 2em 0; text-align: center; }
.post-page .prose .prose-figure img {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72vh, 600px);
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(255, 255, 241, .10), 0 24px 60px -24px rgba(0, 0, 0, .6);
  vertical-align: top;
}
.post-page .prose figcaption { margin-top: 12px; color: var(--muted); font: 400 12px/1.6 var(--mono); letter-spacing: .04em; }

.post-page .prose hr { width: 56px; margin: 2.6em 0; border: 0; border-top: 1px solid var(--line-strong); }
.post-page .prose hr.prose-sep { width: 48px; height: 2px; margin: 2em 0; border: 0; border-radius: 2px; background: var(--grad); }

/* Code et tableaux : proportionnés au texte. */
.post-page .prose :not(pre) > code { font-size: .84em; }
.post-page .prose table:not(.codehilitetable) { font-size: .8em; }
.post-page .prose :is(.codehilite, table:not(.codehilitetable), .admonition, details, .toc) { margin: 1.6em 0; }

/* ---------- Fin d'article : partage et relance dans une carte sur la largeur du texte ---------- */
/* Colonne large (840 px et plus) : une ligne, partage à gauche, relance à droite. Plus étroite : deux étages voulus
   (partage, filet, puis question et bouton), selon la largeur de la colonne et non de la fenêtre. */
.post-page .wrap.narrow:has(> .post-end) { container: post-col / inline-size; }
.post-page .post-end {
  position: relative;
  column-gap: 24px;
  margin: clamp(56px, 5vw, 80px) 0 clamp(88px, 8vw, 128px);
  padding: 16px 16px 16px var(--card-x);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(90% 160% at 100% 0%, rgba(71, 15, 244, .18), transparent 60%), var(--card-bg);
  box-shadow: 0 12px 60px rgba(0, 0, 0, .18);
}
.post-page.post--short .post-end { margin-top: 44px; }
.post-page .post-end .share-pill { background: transparent; border-color: var(--line-strong); }
.post-page .post-cta-copy { color: var(--text); font-size: 17px; font-weight: 600; }
@container post-col (max-width: 819px) {
  .post-page .post-end { flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
  .post-page .post-end .share-bar { padding: 16px var(--card-x); }
  .post-page .post-cta { justify-content: space-between; margin: 0; padding: 14px 14px 14px var(--card-x); border-top: 1px solid var(--rule); }
}
/* « Lien copié » : sous la carte, à son bord intérieur, quelle que soit sa mise en page. */
@media (min-width: 821px) {
  .post-page .post-end .share-bar { position: static; }
  .post-page .post-end .share-bar-toast { top: calc(100% + 12px); left: var(--card-x); }
}

/* « À lire aussi » : sans bande grisée, sur le fond de la page (même filet). */
.post-page + .related-posts { padding: clamp(72px, 6vw, 96px) 0 clamp(96px, 8vw, 128px); background: none; }

/* ---------- Fenêtre étroite (tablette en portrait, fenêtre réduite) ---------- */
@media (max-width: 720px) {
  .post-page { --read: 17px; }
  .post-page .post-hero { padding-top: 120px; }
  .post-page .post-hero h1.post-title--xl { font-size: clamp(40px, 11vw, 56px); }
  .post-page .post-hero h1.post-title--l { font-size: clamp(36px, 9vw, 48px); }
  .post-page .post-hero h1.post-title--m { font-size: clamp(32px, 8vw, 42px); }
  .post-page .post-hero h1.post-title--s { font-size: clamp(29px, 7.4vw, 38px); }
  .post-page { --card-x: 20px; }
  .post-cover img { border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .post-progress { display: none; }
  .post-kicker .back-link span { transition: none; }
}

@media print {
  .nav, .footer, .post-progress, .post-kicker, .post-end, .related-posts { display: none !important; }
  .post-page .post-hero { padding-top: 0; }
  .post-page .post-hero h1, .post-page .prose, .post-page .prose :is(h1, h2, h3, h4, strong, b, a, p, li) { color: #000; }
  .post-page .prose { font-size: 12pt; line-height: 1.55; }
  .post-cover img { box-shadow: none; }
}
