:root {
  --night: #0d1b2e;
  --ink: #0b1119;
  --paper: #efe9dc;
  --paper-dim: #cfc7b6;
  --gold: #d4a843;
  --ochre: #a0703c;
  --sehid: #b22222;
  --panel: rgba(11, 17, 25, 0.8);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.reduce { scroll-behavior: auto; }
body {
  margin: 0; background: var(--night); color: var(--paper);
  font: 400 1.06rem/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; background: var(--night); }
#veil { position: fixed; inset: 0; z-index: 1; background: var(--ink); opacity: 0; pointer-events: none; transition: opacity .38s ease; }
#veil.on { opacity: 1; }
html.reduce #veil { transition: none; }
/* v3 : vignettage, grain et etalonnage sont dans la passe de post-traitement WebGL ; ce calque ne sert qu'en repli. */
#grade { display: none; position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(8,10,14,.5)); }
html.nopost #grade { display: block; }
html, body { overflow-x: clip; max-width: 100%; }
#progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 30; background: rgba(255,255,255,.08); }
#progress i { display: block; height: 100%; width: 0; background: var(--gold); }

.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--paper); color: var(--ink); padding: 8px 12px; }
.skip:focus { left: 8px; }

.bar {
  position: fixed; top: 3px; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; background: linear-gradient(to bottom, rgba(11,17,25,.85), rgba(11,17,25,0)); font-size: .85rem; letter-spacing: .04em;
}
.bar.solid { background: rgba(11,17,25,.92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.brand { text-transform: uppercase; font-weight: 600; letter-spacing: .1em; font-size: .78rem; }
.brand em { font-style: normal; font-weight: 400; color: var(--paper-dim); letter-spacing: .04em; text-transform: none; }
.tools { display: flex; align-items: center; gap: 14px; }
.srclink { color: var(--paper); text-decoration: none; border-bottom: 1px solid rgba(239,233,220,.4); padding: 4px 0; }
.srclink:hover, .srclink:focus-visible { color: var(--gold); border-color: var(--gold); outline: none; }
#motion { white-space: nowrap; font: inherit; color: var(--paper); background: rgba(11,17,25,.7); border: 1px solid rgba(239,233,220,.45); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
#motion[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
#motion:hover, #motion:focus-visible { border-color: var(--gold); outline: none; box-shadow: 0 0 0 2px var(--gold); }

#dots { position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 20; display: flex; flex-direction: column; gap: 4px; }
#dots a { display: block; width: 26px; height: 26px; position: relative; }
#dots a::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px solid var(--paper); background: transparent; transition: all .25s; }
#dots a.on::after { background: var(--gold); border-color: var(--gold); inset: 7px; }
#dots a:focus-visible { outline: 2px solid var(--gold); border-radius: 50%; }
#dots a span { position: absolute; right: 32px; top: 2px; white-space: nowrap; background: var(--panel); padding: 2px 10px; border-radius: 4px; font-size: .8rem; opacity: 0; pointer-events: none; transition: opacity .2s; }
#dots a:hover span, #dots a:focus-visible span { opacity: 1; }

main { position: relative; z-index: 5; }
.chapter { position: relative; min-height: var(--h, 220vh); padding: 0 clamp(16px, 6vw, 110px); }
.chapter .stack { padding-top: 24vh; padding-bottom: 20vh; display: flex; flex-direction: column; gap: 70vh; }
#chapters .chapter:last-child .stack { padding-bottom: 60vh; }
@media (max-width: 720px) { #chapters .chapter:last-child .stack { padding-bottom: 90vh; } }
.chapter:nth-child(even) .card { margin-left: auto; }
.card {
  width: min(600px, 100%); background: var(--panel); border-left: 3px solid var(--gold); border-radius: 2px;
  padding: 26px 28px 22px; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.chapter.rouge .card { border-left-color: var(--sehid); }
.card .kicker { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .18em; color: var(--gold); font-weight: 600; }
.chapter.rouge .card .kicker { color: #e8a0a0; }
.card h2, .card h1 { font-family: var(--serif); font-weight: 600; margin: 0 0 10px; line-height: 1.1; color: var(--paper); }
.card h2 { font-size: clamp(1.9rem, 4.6vw, 2.7rem); }
.card h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); letter-spacing: .005em; }
.card .lede { font-family: var(--serif); font-style: italic; font-size: 1.35rem; color: var(--paper-dim); margin: 0 0 12px; }
.card p { margin: 0 0 .9em; }
.card p:last-child { margin-bottom: 0; }
.card .note { font-size: .92rem; color: var(--paper-dim); border-top: 1px solid rgba(239,233,220,.18); padding-top: .7em; margin-top: 1em; }
.card strong { color: #fff; }
.card.plain { padding-top: 22px; }
.card { scroll-margin-top: 72px; }
@media (max-width: 720px) { .card { scroll-margin-top: 156px; } }

.chapter.first .stack { padding-top: 18vh; }
.hero { min-height: 62vh; display: flex; align-items: flex-end; }
.hero .card { border-left-width: 4px; }

#cartouche {
  position: fixed; left: 14px; top: auto; bottom: 14px; z-index: 4; max-width: min(460px, calc(100vw - 28px)); margin: 0; opacity: .85;
  background: rgba(11,17,25,.86); color: var(--paper); border: 1px solid rgba(239,233,220,.3); border-radius: 4px; padding: 8px 12px; font-size: .74rem; line-height: 1.4;
}
#cartouche.r { left: auto; right: 58px; }
#cartouche[hidden] { display: none; }

.foot { position: relative; z-index: 6; background: var(--ink); padding: 14vh clamp(16px, 6vw, 110px) 12vh; }
.foot-card { border-left-color: var(--gold); backdrop-filter: none; margin: 0 auto; width: min(720px, 100%); }
.noscript { position: relative; z-index: 9; padding: 16px; background: var(--paper); color: var(--ink); }
.nogl #stage { display: none; }
body.nogl { background: radial-gradient(circle at 50% 20%, #1c2d45, var(--night) 60%); }

#cartbtn { display: none; }
#dotlabel { display: none; }
@media (max-width: 720px) {
  body { font-size: 1.02rem; }
  .card { padding: 30px 18px 28px; background: rgba(11,17,25,.84);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%); }
  .brand em { display: none; }
  .brand { font-size: .68rem; letter-spacing: .06em; }
  #motion { padding: 5px 10px; font-size: .78rem; }
  .bar { padding: 8px 12px; background: rgba(11,17,25,.92); }
  .chapter .stack { gap: 85vh; }
  .chapter { padding-right: clamp(16px, 6vw, 110px); }
  .srclink { display: none; }
  /* barre segmentee horizontale sous le bandeau : 9 segments, le segment actif en or, zone tactile de 44 px */
  #dots { top: calc(env(safe-area-inset-top, 0px) + 44px); right: 0; left: 0; transform: none; flex-direction: row; gap: 2px; padding: 0 12px; height: 44px; align-items: flex-start; }
  #dots a { flex: 1; width: auto; height: 44px; }
  #dots a::after { inset: 0 0 auto 0; height: 3px; border: 0; border-radius: 0; background: rgba(239,233,220,.28); }
  #dots a.on::after { background: var(--gold); inset: 0 0 auto 0; }
  #dots a span { display: none; }
  #dotlabel { display: block; position: fixed; z-index: 19; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 47px); height: 26px; padding: 5px 12px 0; font-size: .7rem; line-height: 1.5; letter-spacing: .12em; text-transform: uppercase; color: var(--paper-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; background: rgba(11,17,25,.92); }
  /* zone d'en-tete opaque puis fondu : le texte des cartes ne passe plus sous l'etiquette ni sous la pastille « Reconstitution ».
     Opaque jusqu'au bas de la pastille (47 + 26 + 6 + 28 = 107 px), puis fondu jusqu'a 150 px. */
  body::before { content: ""; position: fixed; z-index: 18; left: 0; right: 0; top: 0; height: calc(env(safe-area-inset-top, 0px) + 150px); pointer-events: none;
    background: linear-gradient(to bottom, rgba(11,17,25,.92) 0, rgba(11,17,25,.92) calc(env(safe-area-inset-top, 0px) + 108px), rgba(11,17,25,0) 100%); }
  #dots { overflow: hidden; max-width: 100vw; }
  #dots a { min-width: 0; }
  /* cartouche : pastille compacte qui deplie le texte */
  #cartbtn { display: inline-flex; align-items: center; gap: 6px; position: fixed; z-index: 26; left: 12px; top: calc(env(safe-area-inset-top, 0px) + 47px + 26px + 6px); font: inherit; font-size: .72rem; color: var(--paper); background: rgba(11,17,25,.86); border: 1px solid rgba(239,233,220,.3); border-radius: 999px; padding: 4px 10px; min-height: 28px; cursor: pointer; }
  #cartbtn[hidden] { display: none; }
  #cartbtn:focus-visible { outline: 2px solid var(--gold); }
  #cartouche { z-index: 25; display: none; top: calc(env(safe-area-inset-top, 0px) + 47px + 26px + 6px + 34px); bottom: auto; left: 12px; right: 12px; max-width: none; font-size: .72rem; padding: 8px 10px; background: rgba(11,17,25,.94); opacity: 1; }
  #cartouche.r { right: 12px; left: 12px; }
  #cartouche.open:not([hidden]) { display: block; }
  #cartouche[hidden] { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } #veil { transition: none; } }

/* Recit : citation d'ouverture, sous-titres, notes, figure */
.card h3 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; line-height: 1.15; margin: 0 0 8px; color: var(--gold); }
.card blockquote { margin: 0 0 .9em; padding: 0; }
.card blockquote p:first-child { font-family: var(--serif); font-style: italic; font-size: 1.5rem; line-height: 1.25; color: var(--paper); margin-bottom: .4em; }
.card blockquote p:last-child { font-size: .9rem; color: var(--paper-dim); }
.card figure { margin: 1em 0 0; }
.card figure img { display: block; width: 100%; height: auto; border: 1px solid rgba(239,233,220,.25); filter: sepia(.25) contrast(1.02); }
.card figcaption { font-size: .82rem; color: var(--paper-dim); margin-top: .5em; line-height: 1.4; }
a.fn { color: var(--gold); text-decoration: none; font-size: .72em; vertical-align: super; line-height: 0; padding: 0 1px; }
a.fn:hover, a.fn:focus-visible { text-decoration: underline; outline: none; }
.card a { color: var(--gold); }
table.encadre { width: 100%; border-collapse: collapse; font-size: .95rem; margin-top: .8em; }
table.encadre th, table.encadre td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-top: 1px solid rgba(239,233,220,.16); }
table.encadre thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); border-top: 0; }
table.encadre tbody th { width: 28%; font-weight: 600; color: #fff; }
.foot { display: flex; flex-direction: column; gap: 6vh; }
.sources h3 { font-size: 1.15rem; margin: 1.4em 0 .4em; color: var(--gold); font-family: var(--serif); }
ul.biblio, .foot ul { list-style: none; margin: 0; padding: 0; }
ul.biblio li, .foot-card ul li { padding: 6px 0 6px 0; font-size: .92rem; line-height: 1.45; border-top: 1px solid rgba(239,233,220,.1); overflow-wrap: anywhere; }
ul.biblio li:target { background: rgba(212,168,67,.16); outline: 2px solid var(--gold); }
ul.biblio .n { color: var(--gold); font-weight: 600; margin-right: .3em; }
.noscript h2 { font-family: var(--serif); }
