:root {
  --paper: #fbf8f2;
  --desk: #ece5d8;
  --ink: #23252f;
  --muted: #6b6f7c;
  --line: #e4dccd;
  --orange: #e8870e;
  --orange-soft: #fff4e4;
  --blue: #1559c4;
  --blue-dark: #0e3f91;
  --zoom: 1;
  --serif: "Literata", Georgia, serif;
  --display: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--desk); color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
.print-only { display: none; }

/* ===================== COUVERTURE (écran + impression, en unités de conteneur) ===================== */
.cover, .back { container-type: inline-size; position: relative; overflow: hidden; aspect-ratio: 148 / 210; }

.cover { background: #0f50b5; color: #fff; }
.cover__art { position: absolute; left: 0; bottom: 0; width: 100%; }
/* Les fondus sont intégrés à l'image (voir ebook/couverture.py) : pas de dégradé CSS, mal rendu par certains lecteurs PDF */
.cover__title { position: absolute; z-index: 1; top: 8cqw; left: 5cqw; right: 5cqw; text-align: center; display: flex; flex-direction: column; gap: 1cqw; text-shadow: 0 .4cqw 1.6cqw rgba(0, 0, 0, .35); }
.cover__l1 { font: 600 5.6cqw/1.1 var(--display); }
.cover__l2 { font: 700 8.6cqw/1.05 "Oswald", var(--sans); color: #ffa51f; letter-spacing: -.005em; white-space: nowrap; -webkit-text-stroke: .2cqw #fff3d9; paint-order: stroke fill; }
.cover__l3 { font: italic 500 6cqw/1.1 var(--display); color: #fff3d9; }
.cover__foot { position: absolute; z-index: 1; left: 0; right: 0; bottom: 6cqw; text-align: center; }
.book .cover__author { font: 700 5.4cqw/1 var(--display); margin: 0 0 3cqw; text-align: center; text-indent: 0; letter-spacing: .01em; text-shadow: 0 .4cqw 1.6cqw rgba(0, 0, 0, .5); }
.cover__logo { width: 18cqw; margin: 0 auto; opacity: .92; }

/* ===================== 4e DE COUVERTURE ===================== */
.back { background: #fff; display: flex; flex-direction: column; }
.back__top { display: grid; grid-template-columns: 23cqw 1fr; gap: 5cqw; align-items: center; padding: 7cqw 9cqw 5cqw; }
.back__photo { width: 100%; aspect-ratio: 440 / 620; object-fit: cover; border-radius: 1.5cqw; }
.book .back p { text-align: left; text-indent: 0; }
.book .back__name { font: 700 5.4cqw/1.15 var(--display); color: #d9760a; margin: 0 0 2.2cqw; }
.book .back__role { font: 500 2.6cqw/1.55 var(--sans); color: var(--blue); margin: 0; }
.book .back__band { background: #f08a12; color: #fff; font: 700 3.1cqw/1.4 var(--sans); text-align: center; padding: 3.4cqw 9cqw; margin: 0; }
.back__body { flex: 1; min-height: 0; background: var(--blue); color: #fff; padding: 7cqw 10cqw 3cqw; font: 3cqw/1.6 var(--serif); }
.book .back__body p { margin: 0 0 2.6cqw; }
.book .back__body p:first-child { font: italic 600 4.2cqw/1.3 var(--display); margin-bottom: 4cqw; }
.back__foot { background: var(--blue-dark); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 4cqw 9cqw; }
.back__foot img { width: 24cqw; }
.back__foot span { font: 700 2.8cqw var(--sans); letter-spacing: .14em; text-transform: uppercase; background: #f08a12; padding: 1.4cqw 3cqw; border-radius: 99cqw; }

/* ===================== CONTENU (commun) ===================== */
.opener__num { font: 700 4rem/1 var(--display); color: var(--orange); margin: 0 0 .25em; }
.opener__label { font: 700 .72rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--blue); margin: 0 0 .7em; }
.opener h2 { font: 700 2.1rem/1.15 var(--display); margin: 0; letter-spacing: -.01em; }
.opener h2::after { content: ""; display: block; width: 56px; height: 3px; background: var(--orange); margin-top: .6em; border-radius: 2px; }
.first::first-letter { initial-letter: 3; font-family: var(--display); font-weight: 700; color: var(--orange); margin-right: .12em; }

.pull { font: italic 500 1.32em/1.45 var(--display); color: var(--ink); border-left: 3px solid var(--orange); padding: .1em 0 .1em .9em; margin: 1.5em 0; }
.epigraph { font: italic 600 1.4em/1.4 var(--display); text-align: center; color: var(--blue); margin: 1.6em 0; padding: 0 .5em; }

.triad, .asks { margin: .2em 0 1.2em; padding-left: 0; list-style: none; }
.triad li, .asks li { position: relative; padding-left: 1.4em; margin: .35em 0; }
.triad li::before, .asks li::before { content: ""; position: absolute; left: .2em; top: .62em; width: .45em; height: .45em; border-radius: 50%; background: var(--orange); }
.asks li { font-style: italic; }

.questions { counter-reset: q; list-style: none; padding: 0; margin: 1.2em 0 1.4em; display: grid; gap: .6em; }
.questions li { counter-increment: q; display: flex; gap: .9em; align-items: center; background: var(--orange-soft); border-radius: 10px; padding: .75em 1em; font-weight: 600; }
.questions li::before { content: counter(q); flex: 0 0 1.9em; height: 1.9em; border-radius: 50%; display: grid; place-items: center; background: var(--orange); color: #fff; font: 700 .95em var(--display); }

.notion { border: 1px solid var(--line); border-radius: 12px; padding: 1.1em 1.3em; margin: 1.1em 0; background: #fff; }
.notion--accent { border-color: var(--orange); background: var(--orange-soft); }
.notion h3 { font: 700 1.35em var(--display); margin: 0 0 .5em; color: var(--blue); }
.notion--accent h3 { color: var(--orange); }
.notion dl { display: grid; grid-template-columns: 8.5em 1fr; gap: .45em 1em; margin: 0 0 .8em; font-size: .92em; }
.notion dt { font: 700 .68em/1.9 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.notion dd { margin: 0; }
.notion__q { font: italic 500 1em var(--display); border-top: 1px dashed var(--line); padding-top: .7em; margin: 0; }
.notion__q::before { content: ""; display: inline-block; width: .9em; height: 2px; background: var(--orange); vertical-align: middle; margin-right: .5em; }

.journal { display: grid; gap: 1.2em; margin-top: 1.4em; }
.journal__item { display: grid; gap: .6em; }
.journal__q { font-weight: 600; display: flex; gap: .6em; align-items: baseline; }
.journal__q b { color: var(--orange); font-family: var(--display); }
.journal textarea { font: 1em/1.6 var(--serif); padding: .8em 1em; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); resize: vertical; }
.journal textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.journal__lines { display: none; }
.journal__note { font: .8rem var(--sans); color: var(--muted); }

.bio { display: grid; grid-template-columns: 9em 1fr; gap: 1.5em; align-items: start; }
.bio img { border-radius: 10px; }
.bio__name { font: 700 1.4em var(--display); margin: 0 0 .2em; }
.bio__role { font: 600 .8em var(--sans); color: var(--blue); margin: 0 0 1em; }

/* ===================== ÉCRAN ===================== */
@media screen {
  .bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: #0b0f0d; color: #fff; font-family: var(--sans); }
  .bar i[class*="ph-"], .end i[class*="ph-"] { font-size: 1.15em; vertical-align: -.15em; }
  .bar__back { text-decoration: none; font-size: 1.2rem; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
  .bar__back:hover { background: rgba(255, 255, 255, .1); }
  .bar__logo img { height: 30px; width: auto; }
  .bar__tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
  .bar__btn { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #fff; font: 600 .85rem var(--sans); padding: 7px 12px; border-radius: 999px; cursor: pointer; }
  .bar__btn:hover { background: rgba(255, 255, 255, .16); }
  .bar__dl { text-decoration: none; background: #34d873; color: #04140a; font: 700 .85rem var(--sans); padding: 8px 14px; border-radius: 999px; }
  .bar__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .08); }
  .bar__progress span { display: block; height: 100%; width: 0; background: var(--orange); }

  .toc { position: fixed; top: 60px; left: 0; bottom: 0; width: 300px; overflow-y: auto; background: var(--paper); border-right: 1px solid var(--line); padding: 28px 20px; font-family: var(--sans); z-index: 15; }
  .toc__heading { font: 700 .72rem var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px 10px; }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc a { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-size: .9rem; line-height: 1.35; color: var(--muted); }
  .toc a:hover { background: var(--desk); color: var(--ink); }
  .toc a.is-active { background: var(--orange-soft); color: var(--ink); font-weight: 600; }
  .toc__num { flex: 0 0 26px; font: 700 .9rem var(--display); color: var(--orange); }
  .toc__page { display: none; }

  body { padding: 60px 0 0 300px; }
  .book { max-width: 760px; margin: 40px auto 80px; background: var(--paper); box-shadow: 0 10px 40px -20px rgba(0, 0, 0, .25); border-radius: 6px; padding: 56px clamp(20px, 6vw, 72px) 48px; font-size: calc(19px * var(--zoom)); line-height: 1.75; }
  .book p { margin: 0 0 1em; }
  .cover, .back { width: min(420px, 100%); margin: 0 auto 72px; border-radius: 4px 12px 12px 4px; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .45); font-size: 16px; line-height: normal; }
  .back { margin: 80px auto 48px; }
  .chapter { padding-top: 56px; margin-top: 56px; border-top: 1px solid var(--line); }
  .cover + .titlepage + .copyright + .toc + .chapter, .chapter:first-of-type { border-top: 0; margin-top: 0; }
  .opener { margin-bottom: 1.8em; }
  .book .opener p { margin: 0 0 .7rem; }
  .opener__num { font-size: 3.4em; }
  .opener h2 { font-size: 1.75em; }
  .end { text-align: center; font-family: var(--sans); font-size: .95rem; color: var(--muted); }
  .end__ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
  .end__btn { text-decoration: none; background: var(--orange); color: #fff; font-weight: 700; padding: 11px 20px; border-radius: 999px; }
  .end__btn--ghost { background: none; color: var(--ink); border: 1.5px solid var(--line); }
}

@media screen and (max-width: 1100px) {
  body { padding-left: 0; }
  .toc { top: 60px; bottom: auto; width: 100%; max-height: 75vh; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .3); transform: translateY(-120%); transition: transform .25s; }
  .toc.open { transform: none; }
}
@media screen and (min-width: 1101px) { .bar__toc { display: none; } }
@media screen and (max-width: 600px) {
  .book { margin: 0; border-radius: 0; box-shadow: none; padding: 32px 20px 40px; font-size: calc(17px * var(--zoom)); }
  .bar__logo { display: none; }
  .bio { grid-template-columns: 1fr; }
  .bio img { max-width: 180px; }
  .notion dl { grid-template-columns: 1fr; gap: .1em; }
  .notion dd { margin-bottom: .5em; }
}

/* ===================== IMPRESSION / PDF (A5) ===================== */
@page {
  size: 148mm 210mm;
  margin: 18mm 16mm 20mm;
  @bottom-center { content: counter(page); font: 600 7.5pt "Inter", sans-serif; color: #a39b8b; }
}
@page plein { margin: 0; @bottom-center { content: none; } }
@page liminaire { @bottom-center { content: none; } }

@media print {
  .screen-only, .bar { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; padding: 0; font-size: 10pt; line-height: 1.52; }
  .book { margin: 0; padding: 0; }
  a { text-decoration: none; }

  .cover, .back { page: plein; width: 148mm; height: 210mm; aspect-ratio: auto; margin: 0; }
  .cover { break-after: page; }
  .back { break-before: page; }

  .titlepage, .copyright, .toc { page: liminaire; break-after: page; height: 170mm; display: flex; flex-direction: column; }
  .titlepage { text-align: center; }
  .book .titlepage p { text-align: center; text-indent: 0; }
  .book .titlepage__author { font: 600 8pt var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--blue); margin: auto 0 8mm; }
  .titlepage__title { font: 700 20pt/1.2 var(--display); margin: 0 0 6mm; }
  .titlepage__title span { color: var(--orange); }
  .book .titlepage__sub { font: italic 10pt/1.5 var(--serif); color: var(--muted); margin: 0 6mm; }
  .titlepage__logo { width: 32mm; margin: auto auto 0; }

  .copyright { justify-content: flex-end; font: 7.5pt/1.6 var(--sans); color: var(--muted); }
  .book .copyright p { margin: 0 0 2mm; text-indent: 0; text-align: left; }
  .book .opener p, .book .bio__role, .book .bio__name { text-indent: 0; text-align: left; }

  .toc { position: static; }
  .toc__heading { font: 700 18pt var(--display); margin: 6mm 0 8mm; }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc a { display: flex; align-items: baseline; gap: 3mm; padding: 2.3mm 0; border-bottom: .3pt solid var(--line); font-size: 9.5pt; line-height: 1.35; }
  .toc__num { flex: 0 0 7mm; font: 700 9.5pt var(--display); color: var(--orange); }
  .toc__title { flex: 1; }
  .toc__page { font: 600 8.5pt var(--sans); color: var(--muted); }

  .chapter { break-before: page; }
  .opener { padding-top: 14mm; margin-bottom: 8mm; break-after: avoid; }
  .opener__num { font-size: 38pt; }
  .opener__label { font-size: 6.8pt; }
  .opener h2 { font-size: 16.5pt; }
  .opener h2::after { width: 14mm; height: 1.4pt; margin-top: 4mm; }

  .book p { margin: 0; text-align: justify; hyphens: auto; orphans: 3; widows: 3; }
  .book p + p { text-indent: 1.3em; }
  .book .pull, .book .epigraph, .book .first, .book .pull + p, .book .notion + p, .book ul + p, .book ol + p, .book blockquote + p { text-indent: 0; }
  .pull { text-align: left !important; margin: 4.5mm 0 !important; font-size: 11.5pt; break-inside: avoid; }
  .epigraph { font-size: 12.5pt; margin: 6mm 0; break-inside: avoid; }
  .notion { break-inside: avoid; padding: 2.8mm 4mm; margin: 3mm 0; border-radius: 2.5mm; font-size: 8.5pt; line-height: 1.4; }
  .notion h3 { font-size: 11pt; margin-bottom: 1.5mm; }
  .notion dl { grid-template-columns: 25mm 1fr; gap: .8mm 3mm; margin-bottom: 2mm; }
  .notion__q { padding-top: 1.8mm; }
  .notion dt { font-size: 6pt; line-height: 1.9; }
  .questions li, .triad li, .asks li { break-inside: avoid; }
  .questions li { padding: 2.2mm 3mm; border-radius: 2mm; }
  .questions { margin: 3mm 0 4mm; gap: 2mm; }

  .journal { gap: 5mm; margin-top: 5mm; }
  .journal__item { break-inside: avoid; gap: 1mm; }
  .journal textarea { display: none; }
  .journal__lines { display: block; position: relative; height: 24mm; border-bottom: .6pt solid #cfc6b5; }
  .journal__lines::before, .journal__lines::after { content: ""; position: absolute; left: 0; right: 0; border-bottom: .6pt solid #cfc6b5; }
  .journal__lines::before { top: 8mm; }
  .journal__lines::after { top: 16mm; }

  .bio { grid-template-columns: 34mm 1fr; gap: 6mm; }
  .bio p + p { text-indent: 0 !important; margin-top: 2mm !important; }
}
