/* ==========================================================================
   Lecture guidée — passages, focus, chiffres clés, frise, barre de lecture
   ========================================================================== */

/* ---------- Chapitres ---------- */
.chapter { margin-bottom: clamp(56px, 7vw, 88px); scroll-margin-top: 150px; }
.chapter:last-child { margin-bottom: 0; }
.chapter__head {
  display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: end;
  margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); position: relative;
}
.chapter__head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 90px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--sky-400), var(--green-500)); }
.chapter__num {
  font-family: var(--font-display); font-size: clamp(2.6rem, 5vw, 3.6rem); font-weight: 600; line-height: .9;
  color: transparent; -webkit-text-stroke: 1.5px var(--gold-500);
}
.chapter__titles h2 { margin: 0; font-size: clamp(1.6rem, 2.8vw, 2.3rem); }
.chapter__titles .eyebrow { margin-bottom: 8px; }
.chapter__time {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--sand); padding: 7px 12px; border-radius: 999px;
}
.chapter__time svg { width: 15px; height: 15px; color: var(--green-600); }

/* ---------- Chiffres clés ---------- */
.facts { margin: 0 0 32px; }
.facts__title { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.facts__title svg { width: 16px; height: 16px; color: var(--gold-500); }
.facts__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fact {
  position: relative; display: grid; align-content: start; gap: 8px; text-align: left; font: inherit;
  padding: 18px 18px 16px; border: 0; border-radius: 16px; overflow: hidden;
  background: linear-gradient(150deg, var(--navy-900), var(--navy-700)); color: #cdd8e6;
  box-shadow: var(--shadow-sm); transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.fact::before { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(220,189,111,.35), transparent 70%); transition: transform .6s var(--ease); }
.fact:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.fact:hover::before { transform: scale(1.8); }
.fact__val { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; line-height: 1.05; color: var(--gold-400); }
.fact__num { font-family: var(--font-display); font-size: clamp(1.6rem, 2.4vw, 2.1rem); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fact__unit { font-size: .82rem; font-weight: 700; letter-spacing: .04em; color: #e9d7a4; }
.fact__label { font-size: .8rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fact__go { position: absolute; right: 12px; bottom: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; opacity: 0; transform: translateX(-6px); transition: opacity .3s, transform .3s var(--ease); }
.fact__go svg { width: 14px; height: 14px; transform: rotate(90deg); }
.fact:hover .fact__go, .fact:focus-visible .fact__go { opacity: 1; transform: none; }
.fact__label { padding-right: 20px; }

/* ---------- Fil de lecture ---------- */
.reader-flow { position: relative; padding-left: 34px; }
.reader-flow::before {
  content: ""; position: absolute; left: 10px; top: 14px; bottom: 14px; width: 2px; border-radius: 2px;
  background: linear-gradient(var(--line), var(--line)) no-repeat, var(--line);
}
.reader-flow + .reader-flow, .quote + .reader-flow, .flags + .reader-flow { margin-top: 8px; }

[data-bite] {
  position: relative; list-style: none;
  margin: 0 0 12px; padding: 16px 22px; border-radius: 16px;
  font-size: 1.08rem; line-height: 1.8; color: var(--ink-soft);
  transition: opacity .55s var(--ease), background .45s, box-shadow .45s, color .45s, transform .55s var(--ease);
  cursor: default;
}
[data-bite] p { margin: 0; }
[data-bite]::before {
  content: ""; position: absolute; left: -30px; top: 25px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid #b3bcc9; box-sizing: border-box;
  transition: background .35s, border-color .35s, box-shadow .35s, transform .45s var(--ease);
}
[data-bite]::after {
  content: ""; position: absolute; left: -27px; top: 29px; width: 8px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0);
  transition: transform .35s var(--ease) .1s;
}
[data-bite].is-focus {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 2px rgba(10,31,60,.05), 0 18px 40px -22px rgba(10,31,60,.35);
}
[data-bite].is-focus::before { border-color: var(--gold-500); background: var(--gold-400); box-shadow: 0 0 0 6px rgba(220,189,111,.22); transform: scale(1.15); }
[data-bite].is-read::before { border-color: var(--green-500); background: var(--green-500); }
[data-bite].is-read::after { transform: rotate(-45deg) scale(1); }
.section--sand [data-bite].is-focus { background: #fff; }

/* mode focus : les passages hors champ s'estompent */
.reader.focus-on [data-bite]:not(.is-focus):not([data-anim]) { opacity: .42; }
.reader.focus-on [data-bite]:not(.is-focus):not([data-anim]):hover { opacity: .8; cursor: pointer; }

.bite__lead { font-weight: 600; color: var(--navy-900); }
.bite--raw ul, .bite--raw ol { margin: 0; }
.bite--fig, .bite--inline-fig { margin: 8px 0 20px; }
.bite--fig .figure, .reader-flow > .figure { margin: 0; }
.reader-flow > .figure { margin: 8px 0 24px; }
.bite--inline-fig .inline-fig { float: none; width: 120px; margin: 0 0 0 22px; }

/* lettrine sur le tout premier passage */
.chapter--dropcap .reader-flow:first-of-type > .bite:first-child p::first-letter {
  float: left; font-family: var(--font-display); font-size: 3.6em; line-height: .85; padding: 6px 10px 0 0; color: var(--navy-900); font-weight: 600;
}
.chapter--lead .reader-flow:first-of-type > .bite:first-child { font-size: 1.18rem; }

/* surlignage animé des chiffres et dates */
mark.hl {
  color: inherit; font-weight: 600; padding: 0 2px; border-radius: 3px;
  background: linear-gradient(transparent 58%, rgba(220,189,111,.45) 58%) no-repeat 0 0 / 0% 100%;
  transition: background-size .9s var(--ease) .2s;
}
mark.hl--year { color: var(--navy-900); font-weight: 700; background-image: linear-gradient(transparent 58%, rgba(106,178,231,.35) 58%); }
.is-focus mark.hl, .is-read mark.hl { background-size: 100% 100%; }
mark.hl.flash { animation: hlFlash 1.8s var(--ease); }
@keyframes hlFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,189,111,0); } 20% { box-shadow: 0 0 0 8px rgba(220,189,111,.55); background-size: 100% 100%; } }

/* ---------- Frise chronologique ---------- */
.timeline { margin: 0 0 12px; padding: 0; }
.tl { display: grid; grid-template-columns: 116px 1fr; gap: 20px; align-items: start; }
.tl__year {
  font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.25; color: var(--navy-900);
  text-align: right; padding-top: 2px;
}
.tl__year:empty::before { content: "…"; color: var(--gold-500); }
.tl.is-focus .tl__year { color: var(--gold-500); }
.tl__year { transition: color .4s, transform .5s var(--ease); }
.tl.is-focus .tl__year { transform: translateX(-4px); }

/* ---------- Barre de lecture (HUD) ---------- */
.rhud {
  position: fixed; left: 0; right: 0; top: 0; z-index: 95;
  background: rgba(255,255,255,.97); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line); box-shadow: 0 10px 26px -18px rgba(10,31,60,.45);
  transform: translateY(-120%); transition: transform .45s var(--ease), top .45s var(--ease); pointer-events: none;
}
.rhud.is-on { transform: none; pointer-events: auto; }
.rhud__in { display: flex; align-items: center; gap: 16px; height: 58px; }
.rhud__chap { display: flex; flex-direction: column; min-width: 0; flex: 0 1 240px; line-height: 1.2; }
.rhud__chap small { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-600); }
.rhud__chap b { font-family: var(--font-display); font-weight: 600; color: var(--navy-900); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rhud__toc { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 90%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); }
.rhud__toc::-webkit-scrollbar { display: none; }
.rhud__chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 500; color: var(--ink-soft); white-space: nowrap;
  transition: background .25s, color .25s, border-color .25s;
}
.rhud__chip i { width: 6px; height: 6px; border-radius: 50%; background: #cfd5de; font-style: normal; transition: background .25s; }
.rhud__chip:hover { border-color: var(--navy-900); color: var(--navy-900); }
.rhud__chip.is-current { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.rhud__chip.is-current i { background: var(--gold-400); }
.rhud__chip.is-done i { background: var(--green-500); }
.rhud__stats { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.rhud__read { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--green-600); background: var(--green-100); padding: 5px 10px; border-radius: 999px; }
.rhud__read svg { width: 14px; height: 14px; }
.rhud__read.bump { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.18); } }
.rhud__focus {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  padding: 6px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; flex-shrink: 0;
}
.rhud__focus svg { width: 15px; height: 15px; }
.rhud__focus[aria-pressed="true"] { background: var(--gold-100); border-color: var(--gold-400); color: #7a5d18; }
.rhud__bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: linear-gradient(90deg, var(--sky-400), var(--green-500), var(--gold-400)); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Carte « Poursuivre la découverte » ---------- */
.section--tight { padding-top: 0; }
.next-read {
  display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 24px;
  padding: 14px 28px 14px 14px; border-radius: 22px; background: var(--navy-900); color: #fff; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.next-read:hover { color: #fff; transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.next-read__media { display: block; height: 110px; border-radius: 14px; overflow: hidden; }
.next-read__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.next-read:hover .next-read__media img { transform: scale(1.08); }
.next-read small { display: block; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-400); font-weight: 700; margin-bottom: 6px; }
.next-read strong { font-family: var(--font-display); font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 600; }
.next-read__go { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-500); color: var(--navy-950); transition: transform .45s var(--ease); }
.next-read__go svg { width: 22px; height: 22px; }
.next-read:hover .next-read__go { transform: translateX(6px); }

/* ---------- Textes repliés (destinations, listes longues) ---------- */
.clamp { position: relative; max-height: 10.6em; overflow: hidden; transition: max-height .7s var(--ease); }
.clamp.is-short { max-height: none; }
.clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4.5em; background: linear-gradient(rgba(255,255,255,0), #fff); pointer-events: none; transition: opacity .4s; }
.clamp.is-open::after, .clamp.is-short::after { opacity: 0; }
.more-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--navy-900); font-weight: 600; font-size: .86rem;
  transition: background .25s, color .25s, border-color .25s;
}
.more-btn:hover { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.more-btn svg { width: 16px; height: 16px; transition: transform .35s var(--ease); }
.more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
li.is-extra { display: none; }
li.is-extra.is-shown { display: list-item; animation: fadeUpSm .45s var(--ease) both; }
.prose li.is-extra.is-shown { display: block; }

/* ---------- Mobile ---------- */
@media (max-width: 1180px) {
  .rhud__toc { display: none; }
  .rhud__chap { flex: 1; }
}
@media (max-width: 760px) {
  .chapter__head { grid-template-columns: auto 1fr; }
  .chapter__time { grid-column: 1 / -1; justify-self: start; }
  .reader-flow { padding-left: 26px; }
  .reader-flow::before { left: 6px; }
  [data-bite] { padding: 14px 16px; font-size: 1.02rem; }
  [data-bite]::before { left: -26px; }
  [data-bite]::after { left: -23px; }
  .tl { grid-template-columns: 1fr; gap: 4px; }
  .tl__year { text-align: left; }
  .rhud__in { height: 52px; gap: 10px; }
  .rhud__time, .rhud__focus span { display: none; }
  .next-read { grid-template-columns: 1fr auto; padding: 14px 18px 14px 14px; }
  .next-read__media { display: none; }
  .facts__grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  [data-bite], mark.hl, .rhud, .clamp { transition: none !important; }
}

body.hud-on .scroll-progress { opacity: 0; }
.scroll-progress { transition: opacity .3s; }
