/* ZS-LECTURE-V1B · LA SALLE DE LECTURE · 21 novembre 2026 · v1b : la portée s’étend aux pages qui sortent
   leur contenu de .post-body (article.post, body > [id^="zs"]), mesuré sur /verdict-du-lundi/ et /la-computation-des-incalculables/.
   La couche de lecture commune des pages de zoesagan.com. Elle ne touche ni aux textes,
   ni aux prix, ni aux formulaires : seulement la mise en page de la prose.
   Activée par la classe `zs-lecture` posée sur <html> par le chargeur de la tête globale.
   Spécificité : `html:not(#zsl)` ajoute un identifiant sans en exiger un, pour passer
   au-dessus des feuilles de page (`html body .x p{…!important}`) sans style en ligne.
   Typographie de la maison inchangée (Fraunces, Newsreader, JetBrains Mono). */

/* ── 1 · LA PROSE · colonne de 62 à 70 caractères, 18 px au moins, interligne 1,65 ── */
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(:is(p, li):not([class]), .zsl-p):not(:is(nav, form, table, figure, figcaption, aside, button, header, footer, [role="dialog"], .kg-button-card, .kg-product-card) *) {
  font-size: max(1em, 18px) !important;
  line-height: 1.65 !important;
  max-width: min(100%, 29.5em) !important;
  text-wrap: pretty;
  hanging-punctuation: first;
  font-kerning: normal;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 900px) {
  html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(p:not([class]), p.zsl-p):not(:is(nav, form, table, figure, figcaption, aside, button, header, footer, [role="dialog"]) *) {
    font-size: max(1em, 20px) !important;
  }
}

/* ── 1 bis · LA MARGE DU TÉLÉPHONE · le thème empile deux marges de 16 px avant la page ;
   on rend la seconde à la colonne (les pages qui l’avaient déjà retirée ne changent pas) ── */
@media (max-width: 640px) {
  html.zs-lecture:not(#zsl) body main.post-content { padding-inline: 0 !important; }
}

/* ── 2 · LE RYTHME VERTICAL · de l’air entre les paragraphes et avant chaque intertitre ── */
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(p:not([class]), p.zsl-p) { margin-block-end: 1.05em !important; }
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(ul, ol):not([class]) > li:not([class]) + li:not([class]) { margin-block-start: .55em !important; }
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(h2, h3):not(:first-child) {
  margin-block-start: clamp(2.1rem, 1.4rem + 3.2vw, 3.4rem) !important;
  scroll-margin-top: 96px;
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(h2, h3) {
  margin-block-end: .7em !important;
  text-wrap: balance;
  scroll-margin-top: 96px;
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(h1, h2, h3, h4) { text-wrap: balance; }

/* ── 3 · LES CHIFFRES ET LES VERDICTS · un encadré qui se lit d’un coup d’œil ── */
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) strong.zsl-chiffre {
  font-variant-numeric: lining-nums tabular-nums !important;
  padding: 0 .16em;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(to top, color-mix(in oklab, currentColor 16%, transparent) 0 36%, transparent 36%);
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) blockquote:not([class]):not(:is(figure, aside) *) {
  position: relative;
  padding: .2em 0 .2em 1.15em !important;
  margin-block: 1.8em !important;
  border: 0 !important;
  font-size: max(1em, 18px) !important;
  line-height: 1.6 !important;
  max-width: min(100%, 64ch) !important;
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) blockquote:not([class]):not(:is(figure, aside) *)::before {
  content: ""; position: absolute; inset: .3em auto .3em 0; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, #8FD3FF, #B69CFF 40%, #FF8FC8 75%, #FFD38A);
}

/* ── 4 · LES TABLEAUX · ils défilent dans leur cadre sur téléphone, jamais la page ── */
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) .zsl-defile {
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  max-width: 100% !important;
  margin-block: 1.6em !important;
  position: relative;
  border-radius: 4px;
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) .zsl-defile.zsl-fin {
  mask-image: none; -webkit-mask-image: none;
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) .zsl-defile:focus-visible { outline: 2px solid #B69CFF; outline-offset: 3px; }
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) .zsl-defile > table {
  min-width: max-content; margin: 0 !important;
  font-variant-numeric: lining-nums tabular-nums;
}
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) .zsl-defile :is(td, th) { white-space: nowrap; }
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) .zsl-defile :is(td, th):first-child { white-space: normal; min-width: 7em; }

/* ── 5 · LES LIENS DE LA PROSE · un soulignement qui respire (jamais de transition sur la couleur) ── */
html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) p:not([class]) a:not([class]) {
  text-decoration-thickness: from-font;
  text-underline-offset: .2em;
  transition: text-underline-offset 160ms cubic-bezier(.23, 1, .32, 1);
}
@media (hover: hover) and (pointer: fine) {
  html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) p:not([class]) a:not([class]):hover { text-underline-offset: .32em; }
}

/* ── 6 · LA BARRE DE PROGRESSION · deux pixels de lumière spectrale ── */
#zsl-progres {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 2147483000;
  pointer-events: none; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #8FD3FF, #B69CFF 40%, #FF8FC8 75%, #FFD38A);
  opacity: .85;
}
@supports (animation-timeline: scroll()) {
  #zsl-progres { animation: zsl-progres linear both; animation-timeline: scroll(root block); }
  @keyframes zsl-progres { to { transform: scaleX(1); } }
}

/* ── 7 · LE SOMMAIRE COLLANT · sur ordinateur seulement, dans la marge de gauche ── */
#zsl-sommaire {
  position: fixed; top: 132px; z-index: 40; width: 216px;
  max-height: calc(100dvh - 200px); overflow: auto; scrollbar-width: none;
  font-family: 'Newsreader', Georgia, serif; font-size: 16px; line-height: 1.35;
  color: var(--zsl-encre, rgba(255, 255, 255, .58));
  opacity: 0; transform: translateX(-6px);
  transition: opacity 320ms cubic-bezier(.23, 1, .32, 1), transform 320ms cubic-bezier(.23, 1, .32, 1);
}
#zsl-sommaire.zsl-vu { opacity: 1; transform: none; }
#zsl-sommaire .zsl-som-titre {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .18em;
  text-transform: uppercase; margin: 0 0 14px; opacity: .7;
}
#zsl-sommaire ol { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid currentColor; border-color: color-mix(in oklab, currentColor 30%, transparent); }
#zsl-sommaire li { margin: 0; padding: 0; }
#zsl-sommaire a {
  display: block; padding: 6px 0 6px 14px; margin-inline-start: -1px;
  color: inherit; -webkit-text-fill-color: currentColor; text-decoration: none;
  border-inline-start: 1px solid transparent;
  transition: transform 180ms cubic-bezier(.23, 1, .32, 1), opacity 180ms;
}
#zsl-sommaire a:hover { transform: translateX(2px); }
#zsl-sommaire a[aria-current="true"] {
  color: var(--zsl-encre-vive, #fff); -webkit-text-fill-color: var(--zsl-encre-vive, #fff);
  border-image: linear-gradient(180deg, #8FD3FF, #B69CFF 40%, #FF8FC8 75%, #FFD38A) 1;
}
@media (max-width: 1239px) { #zsl-sommaire { display: none !important; } }

/* ── 8 · LES ENTRÉES AU DÉFILEMENT · CSS natif, sans bibliothèque ── */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    html.zs-lecture:not(#zsl) body :is(.post-body, article.post, body > [id^="zs"]) :is(h2, h3, blockquote:not([class]), .zsl-defile, figure) {
      animation: zsl-entree linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
    @keyframes zsl-entree {
      from { opacity: 0; transform: translateY(14px); }
      to { opacity: 1; transform: none; }
    }
  }
  /* ── 9 · LES VIEW TRANSITIONS · un fondu court entre les pages de l’Oracle ── */
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: 220ms;
    animation-timing-function: cubic-bezier(.23, 1, .32, 1);
  }
}

/* ── 10 · TOUT EFFET SE COUPE SOUS prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  #zsl-progres { animation: none !important; transition: none !important; }
  #zsl-sommaire, #zsl-sommaire a, html.zs-lecture body :is(.post-body, article.post, body > [id^="zs"]) a { transition: none !important; }
  #zsl-sommaire { transform: none !important; }
}

/* ── 11 · L’IMPRESSION · ni barre ni sommaire ── */
@media print { #zsl-progres, #zsl-sommaire { display: none !important; } }
