/* web/tokens.css */
/* Logos design tokens (DESIGN.md §3), lifted from docs/mockups/src/tokens.css (fonts: vendored woff2).
   Hue anchor 262 = encre (ink blue-black); subject accent = rubrique (vermilion, hue 32-33),
   the red of rubricated manuscripts; state ramp = fait / attention. Contrast pairs: DESIGN §3.1. */

@font-face {
  font-family: "Literata";
  src: url("/vendor/literata/Literata.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/vendor/literata/Literata-Italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --book: "Literata", "Iowan Old Style", Charter, Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "DejaVu Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "DejaVu Sans Mono", monospace;

  /* type steps (px): 12 14 16 18 20 24 30 36 */
  --t-12: 0.75rem;
  --t-14: 0.875rem;
  --t-16: 1rem;
  --t-18: 1.125rem;
  --t-20: 1.25rem;
  --t-24: 1.5rem;
  --t-30: 1.875rem;
  --t-36: 2.25rem;
  --lh-prose: 1.62;
  --lh-ui: 1.4;
  --lh-head: 1.18;
  --measure: 66ch;

  /* spacing scale (px): 2 4 8 12 16 24 32 40 48 64 */
  --s-2: 2px; --s-4: 4px; --s-8: 8px; --s-12: 12px; --s-16: 16px;
  --s-24: 24px; --s-32: 32px; --s-40: 40px; --s-48: 48px; --s-64: 64px;

  /* radius: three values only */
  --r-4: 4px;
  --r-8: 8px;
  --r-16: 16px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint */
  --z-sticky: 10;
  --z-sheet: 30;
  --z-toast: 40;

  color-scheme: dark light;
}

/* Nuit: the default when the OS asks for dark, and the scene the product is designed for. */
:root,
:root[data-theme="nuit"] {
  --encre: oklch(0.185 0.014 262);        /* page */
  --encre-haute: oklch(0.225 0.016 262);  /* bars, sheets, rail */
  --encre-basse: oklch(0.16 0.012 262);   /* figures, opened hints, code */
  --filet: oklch(0.32 0.018 262);         /* the rare line */
  --texte: oklch(0.86 0.012 262);         /* prose, 12.2:1 on --encre */
  --texte-2: oklch(0.74 0.014 262);       /* secondary, 8.1:1 */
  --texte-3: oklch(0.58 0.012 262);       /* locked chapters, 4.35:1 */
  --rubrique: oklch(0.71 0.145 33);       /* subject accent, 6.8:1 */
  --rubrique-voile: oklch(0.71 0.145 33 / 0.14);
  --sur-rubrique: oklch(0.185 0.014 262); /* text on a rubrique fill, 6.8:1 */
  --fait: oklch(0.75 0.09 160);           /* state: done, 8.7:1 */
  --attention: oklch(0.82 0.12 80);       /* state: overrun, 10.6:1 */
  --voile: oklch(0.1 0.01 262 / 0.62);    /* sheet backdrop */
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="nuit"]) {
    --encre: oklch(0.975 0.004 262);
    --encre-haute: oklch(0.995 0.002 262);
    --encre-basse: oklch(0.945 0.007 262);
    --filet: oklch(0.86 0.01 262);
    --texte: oklch(0.25 0.02 262);        /* 14.9:1 */
    --texte-2: oklch(0.42 0.02 262);      /* 7.9:1 */
    --texte-3: oklch(0.6 0.012 262);      /* 3.7:1, locked titles only (18 px+) */
    --rubrique: oklch(0.535 0.175 32);    /* 5.2:1 */
    --rubrique-voile: oklch(0.535 0.175 32 / 0.09);
    --sur-rubrique: oklch(0.99 0.002 262);
    --fait: oklch(0.5 0.1 160);           /* 5.3:1 */
    --attention: oklch(0.55 0.13 70);
    --voile: oklch(0.2 0.02 262 / 0.42);
  }
}
:root[data-theme="jour"] {
  --encre: oklch(0.975 0.004 262);
  --encre-haute: oklch(0.995 0.002 262);
  --encre-basse: oklch(0.945 0.007 262);
  --filet: oklch(0.86 0.01 262);
  --texte: oklch(0.25 0.02 262);
  --texte-2: oklch(0.42 0.02 262);
  --texte-3: oklch(0.6 0.012 262);
  --rubrique: oklch(0.535 0.175 32);
  --rubrique-voile: oklch(0.535 0.175 32 / 0.09);
  --sur-rubrique: oklch(0.99 0.002 262);
  --fait: oklch(0.5 0.1 160);
  --attention: oklch(0.55 0.13 70);
  --voile: oklch(0.2 0.02 262 / 0.42);
}

/* web/base.css */
/* Logos base styles: the component vocabulary of DESIGN.md §3-4, lifted from docs/mockups/src/mock.css
   (the sheet is the native <dialog> of web/ui/sheet.ts). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--encre);
  color: var(--texte);
  font: 400 var(--t-16) / var(--lh-ui) var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100dvh;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--rubrique); outline-offset: 2px; border-radius: var(--r-4); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-8);
  min-height: 44px; padding: 0 var(--s-16);
  border-radius: var(--r-8); border: 1px solid var(--filet); background: transparent;
  font: 600 var(--t-14) / 1 var(--sans); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.btn:hover { border-color: var(--texte-3); }
.btn.primary { background: var(--rubrique); border-color: var(--rubrique); color: var(--sur-rubrique); }
.btn.ghost { border-color: transparent; }
.btn.icon { width: 44px; padding: 0; }
.btn.lg { min-height: 52px; font-size: var(--t-16); padding: 0 var(--s-24); }

/* ---------- top bar (reader chrome) ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--s-8);
  height: 56px; padding: 0 var(--s-12);
  background: var(--encre-haute);
}
.topbar .where { display: flex; align-items: center; gap: var(--s-4); min-width: 0; color: var(--texte-2); font-size: var(--t-14); text-decoration: none; }
.topbar .where b { color: var(--texte); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.wordmark { font: 600 var(--t-18) / 1 var(--book); letter-spacing: 0.01em; color: var(--texte); text-decoration: none; }
.wordmark span { color: var(--rubrique); }

/* the session timer: the only live element in the chrome */
.timer {
  display: flex; align-items: center; gap: var(--s-8);
  padding: 0 var(--s-4) 0 var(--s-12); min-height: 44px;
  border-radius: var(--r-8); background: var(--encre-basse);
}
.timer .clock { font: 600 var(--t-18) / 1 var(--mono); font-variant-numeric: tabular-nums; }
.timer .of { color: var(--texte-2); font: 400 var(--t-14) / 1 var(--mono); }
.timer .live { width: 8px; height: 8px; border-radius: 50%; background: var(--rubrique); }
.timer-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--filet); }
.timer-progress i { display: block; height: 100%; background: var(--rubrique); }

/* ---------- reader layout ---------- */
.layout { display: block; }
.rail { display: none; }
.reading { padding: var(--s-24) var(--s-16) 120px; min-width: 0; }

@media (min-width: 720px) {
  .layout { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); align-items: start; }
  .layout.toc-collapsed { grid-template-columns: minmax(0, 1fr); }
  .layout.toc-collapsed > .rail { display: none; }
  .rail {
    display: block; position: sticky; top: 56px; max-height: calc(100dvh - 56px); overflow-y: auto;
    padding: var(--s-24) var(--s-8) var(--s-24) var(--s-16);
  }
  .reading { padding: var(--s-32) var(--s-40) var(--s-64) var(--s-32); }
}

.rail h2 { font: 600 var(--t-12) / 1.3 var(--sans); color: var(--texte-2); margin: 0 0 var(--s-8); }
.rail ol { list-style: none; margin: 0 0 var(--s-24); padding: 0; }
.rail li a {
  display: flex; gap: var(--s-8); align-items: baseline;
  padding: var(--s-8) var(--s-8); border-radius: var(--r-4);
  color: var(--texte-2); text-decoration: none; font-size: var(--t-14); line-height: 1.3;
}
.rail li a .k { color: var(--texte-3); font-family: var(--mono); font-size: var(--t-12); min-width: 2ch; }
.rail li a[aria-current="true"] { color: var(--texte); background: var(--rubrique-voile); }
.rail li a[aria-current="true"] .k { color: var(--rubrique); }
.rail .tiny { font-size: var(--t-12); color: var(--texte-2); }

/* ---------- prose ---------- */
.prose { font: 400 var(--t-18) / var(--lh-prose) var(--book); font-optical-sizing: auto; max-width: var(--measure); }
.prose p { margin: 0 0 var(--s-16); text-wrap: pretty; hyphens: auto; }
.prose h1, .prose h2, .prose h3 { font-family: var(--book); text-wrap: balance; line-height: var(--lh-head); color: var(--texte); }
.prose h2 { font-size: var(--t-24); font-weight: 600; margin: var(--s-48) 0 var(--s-16); }
.prose h3 { font-size: var(--t-20); font-weight: 600; margin: var(--s-32) 0 var(--s-12); }
.prose strong { font-weight: 650; }
.prose em { font-style: italic; }
.prose .katex { font-size: 1.04em; }
.prose .katex-display { margin: var(--s-16) 0 var(--s-24); overflow-x: auto; overflow-y: hidden; padding: var(--s-4) 0; }

.chapter-head { max-width: var(--measure); margin-bottom: var(--s-32); }
.chapter-head .kicker { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--rubrique); margin: 0 0 var(--s-8); }
.chapter-head h1 { font: 600 var(--t-36) / var(--lh-head) var(--book); margin: 0 0 var(--s-12); text-wrap: balance; letter-spacing: -0.005em; }
.chapter-head .meta { display: flex; flex-wrap: wrap; gap: var(--s-8) var(--s-16); color: var(--texte-2); font-size: var(--t-14); }

/* callouts: background step, never a side stripe */
.callout { background: var(--encre-basse); border-radius: var(--r-8); padding: var(--s-16) var(--s-16) var(--s-4); margin: var(--s-24) 0; }
.callout .label { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--rubrique); margin: 0 0 var(--s-8); display: flex; gap: var(--s-8); align-items: center; }

/* Maïa's note, pinned at the head of the chapter after a review */
.retour { background: var(--encre-haute); border-radius: var(--r-16); padding: var(--s-16) var(--s-24) var(--s-8); margin: 0 0 var(--s-32); max-width: var(--measure); }
.retour .from { display: flex; align-items: center; gap: var(--s-8); font: 600 var(--t-14) / 1.3 var(--sans); color: var(--texte-2); margin-bottom: var(--s-8); }
.retour .from .dot { width: 24px; height: 24px; border-radius: 50%; background: var(--rubrique-voile); color: var(--rubrique); display: grid; place-items: center; font: 600 var(--t-12) / 1 var(--book); }
.retour p { font: 400 var(--t-16) / 1.55 var(--book); margin: 0 0 var(--s-8); }
.retour .plan { display: flex; flex-wrap: wrap; gap: var(--s-8); margin: var(--s-12) 0 var(--s-8); padding: 0; list-style: none; }
.retour .plan li { font-size: var(--t-14); padding: var(--s-8) var(--s-12); border-radius: var(--r-8); background: var(--encre-basse); }
.retour .plan li b { color: var(--rubrique); font-weight: 600; }

/* ---------- figure ---------- */
.figure { margin: var(--s-32) 0; background: var(--encre-basse); border-radius: var(--r-16); padding: var(--s-16); max-width: 100%; font: 400 var(--t-14) / var(--lh-ui) var(--sans); }
.figure header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-12); margin-bottom: var(--s-12); }
.figure h4 { margin: 0; font: 600 var(--t-16) / 1.3 var(--book); }
.figure .fig-n { color: var(--rubrique); font: 600 var(--t-14) / 1 var(--sans); }
.figure .stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-16); }
@media (min-width: 720px) { .figure .stage { grid-template-columns: minmax(0, 1fr) 176px; } }
.figure canvas, .figure svg.plot { width: 100%; height: 240px; display: block; }
.figure .readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-8) var(--s-16); align-content: start; }
@media (min-width: 720px) { .figure .readout { grid-template-columns: 1fr; } }
.figure .readout div { display: flex; flex-direction: column; gap: var(--s-2); }
.figure .readout span { font-size: var(--t-12); color: var(--texte-2); }
.figure .readout b { font: 600 var(--t-20) / 1.2 var(--mono); font-variant-numeric: tabular-nums; }
.figure .controls { display: flex; flex-wrap: wrap; gap: var(--s-12) var(--s-24); margin-top: var(--s-12); align-items: center; }
.figure figcaption { margin-top: var(--s-12); font: 400 var(--t-14) / 1.5 var(--book); color: var(--texte-2); max-width: var(--measure); }
.seg { display: inline-flex; background: var(--encre); border-radius: var(--r-8); padding: var(--s-2); gap: var(--s-2); }
.seg button { min-height: 40px; min-width: 40px; padding: 0 var(--s-12); border: 0; border-radius: 6px; background: transparent; color: var(--texte-2); font: 600 var(--t-14) / 1 var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--encre-haute); color: var(--texte); box-shadow: inset 0 0 0 1px var(--filet); }
.seg-label { font-size: var(--t-12); color: var(--texte-2); display: block; margin-bottom: var(--s-4); }

/* ---------- exercise + hint seals ---------- */
.exo { margin: var(--s-32) 0; max-width: var(--measure); }
.exo-head { display: flex; align-items: baseline; gap: var(--s-12); margin-bottom: var(--s-8); }
.exo-head .n { font: 700 var(--t-20) / 1 var(--book); color: var(--rubrique); min-width: 2.2ch; }
.exo-head h3 { margin: 0; font: 600 var(--t-18) / 1.3 var(--book); }
.tag { font: 600 var(--t-12) / 1 var(--sans); color: var(--texte-2); padding: var(--s-4) var(--s-8); border-radius: var(--r-4); background: var(--encre-basse); }
.exo .body { font: 400 var(--t-18) / var(--lh-prose) var(--book); }
.exo .body p { margin: 0 0 var(--s-12); }

.seals { display: flex; flex-wrap: wrap; gap: var(--s-8); margin-top: var(--s-12); }
.seal {
  display: inline-flex; align-items: center; gap: var(--s-8);
  min-height: 44px; padding: 0 var(--s-12) 0 var(--s-8);
  border-radius: var(--r-8); border: 1px solid var(--rubrique); background: transparent; color: var(--texte);
  font: 600 var(--t-14) / 1 var(--sans); cursor: pointer;
}
.seal .wax { width: 24px; height: 24px; border-radius: 50%; background: var(--rubrique); color: var(--sur-rubrique); display: grid; place-items: center; font: 700 var(--t-12) / 1 var(--book); }
.seal small { font-weight: 400; color: var(--texte-2); }
.seal[aria-disabled="true"] { border-color: var(--filet); color: var(--texte-3); cursor: default; }
.seal[aria-disabled="true"] .wax { background: var(--filet); color: var(--texte-2); }
.seal[aria-expanded="true"] { background: var(--rubrique-voile); }
.confirm {
  margin-top: var(--s-8); padding: var(--s-12) var(--s-16); border-radius: var(--r-8); background: var(--rubrique-voile);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-16);
}
.confirm p { margin: 0; flex: 1 1 260px; font-size: var(--t-14); line-height: 1.45; }
.confirm .actions { display: flex; gap: var(--s-8); }
.hint-open { margin-top: var(--s-8); padding: var(--s-12) var(--s-16); border-radius: var(--r-8); background: var(--encre-basse); }
.hint-open .h { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--rubrique); margin-bottom: var(--s-4); }
.hint-open .when { font-size: var(--t-12); color: var(--texte-2); }

/* ---------- references ---------- */
.refs { list-style: none; padding: 0; margin: var(--s-16) 0; max-width: var(--measure); }
.ref { display: grid; grid-template-columns: 1fr auto; gap: var(--s-4) var(--s-16); padding: var(--s-12) 0; align-items: center; }
.ref + .ref { border-top: 1px solid var(--filet); }
.ref .t { font: 600 var(--t-16) / 1.35 var(--book); }
.ref .a { font-size: var(--t-14); color: var(--texte-2); }
.ref .p { font: 400 var(--t-14) / 1.4 var(--sans); color: var(--texte-2); }
.ref .p b { color: var(--texte); font-weight: 600; }
.ref .btn { grid-row: 1 / span 3; grid-column: 2; }

/* ---------- outer-screen (narrow) bottom session bar ---------- */
.sessionbar { display: none; }
@media (max-width: 719px) {
  .topbar .timer { display: none; }
  .sessionbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky);
    align-items: center; gap: var(--s-8); padding: var(--s-8) var(--s-12) calc(var(--s-8) + env(safe-area-inset-bottom));
    background: var(--encre-haute);
  }
  .sessionbar .timer { flex: 1; background: transparent; padding-left: var(--s-4); }
  .chapter-head h1 { font-size: var(--t-30); }
  .prose, .exo .body { font-size: var(--t-18); }
}

/* ---------- sheet (native <dialog>) ---------- */
dialog.sheet {
  position: fixed; margin: 0; border: 0; padding: 0; color: var(--texte); background: var(--encre-haute);
  left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: none; max-height: calc(100dvh - 24px);
  border-radius: var(--r-16) var(--r-16) 0 0; overflow: hidden;
}
dialog.sheet::backdrop { background: var(--voile); }
.sheet-panel { max-height: calc(100dvh - 24px); overflow-y: auto; padding: var(--s-8) var(--s-16) calc(var(--s-16) + env(safe-area-inset-bottom)); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--filet); margin: 0 auto var(--s-12); }
.sheet-head { display: flex; align-items: flex-start; gap: var(--s-8); }
.sheet-title { font: 600 var(--t-24) / var(--lh-head) var(--book); margin: 0 0 var(--s-4); flex: 1; text-wrap: balance; }
.sheet-lead { color: var(--texte-2); font-size: var(--t-14); margin: 0 0 var(--s-24); }
.sheet-body { font-size: var(--t-16); }
.sheet .foot { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: var(--s-8); margin-top: var(--s-16); }
@media (max-width: 719px) {
  .sheet .foot { position: sticky; bottom: calc(-1 * (var(--s-16) + env(safe-area-inset-bottom))); margin: var(--s-8) calc(-1 * var(--s-16)) 0; padding: var(--s-12) var(--s-16) calc(var(--s-16) + env(safe-area-inset-bottom)); background: var(--encre-haute); flex-wrap: nowrap; }
  .sheet .foot .btn { flex: 1 1 auto; }
}
@media (min-width: 720px) {
  dialog.sheet { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(820px, calc(100vw - 64px)); max-height: calc(100dvh - 48px); border-radius: var(--r-16); }
  .sheet-panel { max-height: calc(100dvh - 48px); padding: var(--s-24); }
  .sheet .grab { display: none; }
  dialog.sheet.small { width: min(520px, calc(100vw - 64px)); }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: rise 320ms var(--ease-out); }
  @keyframes rise { from { opacity: 0; translate: 0 16px; } }
}

/* ---------- app nav (library-level screens) ---------- */
.app { min-height: 100dvh; }
.appnav { display: flex; align-items: center; gap: var(--s-4); height: 56px; padding: 0 var(--s-16); background: var(--encre-haute); position: sticky; top: 0; z-index: var(--z-sticky); }
.appnav[hidden] { display: none; }
.appnav nav { display: flex; gap: var(--s-4); margin-left: var(--s-16); }
.appnav nav a, .appnav .nav-settings { display: inline-flex; align-items: center; gap: var(--s-8); min-height: 44px; padding: 0 var(--s-12); border-radius: var(--r-8); color: var(--texte-2); text-decoration: none; font: 600 var(--t-14) / 1 var(--sans); }
.appnav nav a[aria-current="page"], .appnav .nav-settings[aria-current="page"] { color: var(--texte); background: var(--encre-basse); }
.appnav .spacer { flex: 1; }
.nav-timer:empty { display: none; }
@media (max-width: 719px) {
  .appnav { padding: 0 var(--s-8) 0 var(--s-12); }
  .appnav nav a span { display: none; }
  .appnav nav { margin-left: var(--s-8); }
}
.page { padding: var(--s-24) var(--s-16) var(--s-64); max-width: 1100px; margin: 0 auto; }
@media (min-width: 720px) { .page { padding: var(--s-32) var(--s-32) var(--s-64); } }
.page-title { font: 600 var(--t-30) / var(--lh-head) var(--book); margin: 0 0 var(--s-8); text-wrap: balance; }
.page-lede { color: var(--texte-2); margin: 0 0 var(--s-24); font: 400 var(--t-16) / 1.5 var(--book); }
.muted { color: var(--texte-2); }
.small { font-size: var(--t-14); }

/* ---------- toast, empty, skeleton, offline ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(var(--s-24) + env(safe-area-inset-bottom)); translate: -50% 0; z-index: var(--z-toast); display: grid; gap: var(--s-8); width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-12); padding: var(--s-12) var(--s-16); border-radius: var(--r-8); background: var(--texte); color: var(--encre); font: 600 var(--t-14) / 1.4 var(--sans); box-shadow: 0 8px 24px oklch(0 0 0 / 0.3); }
.toast-msg { flex: 1; }
.toast-action { background: transparent; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 40px; }
body:has(.sessionbar:not([hidden])) .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
.empty { max-width: 34rem; margin: var(--s-48) auto; text-align: center; display: grid; gap: var(--s-12); justify-items: center; }
.empty-title { font: 600 var(--t-24) / var(--lh-head) var(--book); margin: 0; }
.empty-body { color: var(--texte-2); margin: 0; font: 400 var(--t-16) / 1.5 var(--book); }
.skeleton { background: var(--encre-basse); border-radius: var(--r-8); }
.skeleton-line { height: 16px; margin: var(--s-8) 0; }
.skeleton-row { height: 56px; margin: var(--s-12) 0; }
.skeleton-block { height: 160px; margin: var(--s-12) 0; }
.screen-loading { padding: var(--s-32); max-width: 900px; margin: 0 auto; }
.offline-banner { display: flex; gap: var(--s-8); align-items: center; padding: var(--s-8) var(--s-16); background: var(--encre-basse); color: var(--attention); font-size: var(--t-14); }
.offline-banner[hidden] { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: var(--s-16); padding: var(--s-24); text-align: center; }
.auth-title { font: 600 var(--t-36) / 1.1 var(--book); margin: 0; }
.auth-title span { color: var(--rubrique); }
.auth-lead { max-width: 30rem; color: var(--texte-2); font: 400 var(--t-18) / 1.5 var(--book); margin: 0; }
.auth-error { color: var(--attention); min-height: 1.4em; margin: 0; }

/* ---------- forms and settings rows ---------- */
.field-l { font: 600 var(--t-14) / 1.3 var(--sans); margin: 0 0 var(--s-8); display: block; }
.field-h { font-size: var(--t-12); color: var(--texte-2); margin: var(--s-4) 0 0; line-height: 1.4; }
.input { width: 100%; resize: vertical; display: block; min-height: 48px; padding: var(--s-12); border-radius: var(--r-8); border: 1px solid var(--filet); background: var(--encre); color: var(--texte); font: 400 var(--t-16) / 1.4 var(--book); }
.input::placeholder { color: var(--texte-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-8); }
.chip { display: inline-flex; align-items: center; gap: var(--s-8); min-height: 40px; padding: 0 var(--s-12); border-radius: var(--r-8); border: 1px solid var(--filet); background: transparent; font: 600 var(--t-14) / 1 var(--sans); cursor: pointer; color: var(--texte-2); }
.chip[aria-pressed="true"] { border-color: var(--rubrique); background: var(--rubrique-voile); color: var(--texte); }
.chip[disabled] { opacity: .5; cursor: default; }
.rows { display: grid; gap: var(--s-2); margin: 0 0 var(--s-32); }
.rows h2 { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--texte-2); margin: 0 0 var(--s-8); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-16); padding: var(--s-12) var(--s-16); background: var(--encre-haute); }
.rows > .row:first-of-type { border-radius: var(--r-8) var(--r-8) 0 0; }
.rows > .row:last-child { border-radius: 0 0 var(--r-8) var(--r-8); }
.rows > .row:only-of-type { border-radius: var(--r-8); }
.row .label { flex: 1 1 200px; display: grid; gap: var(--s-2); }
.row .label b { font-weight: 600; }
.row .label span { color: var(--texte-2); font-size: var(--t-14); }
.switch { width: 52px; height: 32px; border-radius: 16px; border: 0; background: var(--filet); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--texte-2); transition: translate 160ms var(--ease-out); }
.switch[aria-checked="true"] { background: var(--rubrique); }
.switch[aria-checked="true"]::after { translate: 20px 0; background: var(--sur-rubrique); }

/* web/ui/session.css */
/* Session chrome (DESIGN §4.7-4.8): timer states, front cue, bottom bar, start and end sheets, photo
   viewer. The timer's base look is in base.css. */

.session-slot { display: flex; align-items: center; }
.bar-session { position: relative; display: flex; align-items: center; }
.timer .live.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--texte-2); }
.timer .paused-l { font: 600 var(--t-12) / 1 var(--sans); color: var(--texte-2); }
.timer.overrun .clock { color: var(--attention); }
.timer.overrun .live { background: var(--attention); }
.timer.nav { text-decoration: none; color: var(--texte); padding-right: var(--s-12); }
.timer .btn.icon { width: 40px; min-height: 40px; }
.start-session { white-space: nowrap; }
.sessionbar[hidden] { display: none !important; }
@media (max-width: 719px) {
  .start-session { padding: 0 var(--s-8); font-size: var(--t-14); }
  .sessionbar .session-slot { flex: 1; gap: var(--s-8); }
  .sessionbar .timer { flex: 1; }
  .reader:has(.sessionbar:not([hidden])) .reading { padding-bottom: 160px; }
}

/* the front cue hangs under the bar, right-aligned with the timer */
.front-cue {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--s-8); width: min(360px, calc(100vw - 24px));
  padding: var(--s-8) var(--s-4) var(--s-8) var(--s-12); border-radius: var(--r-8);
  background: var(--encre-haute); box-shadow: 0 8px 24px oklch(0 0 0 / 0.35);
  font: 400 var(--t-14) / 1.4 var(--sans); color: var(--texte);
}
.front-cue[hidden] { display: none; }
.front-cue p { margin: 0; flex: 1; }
@media (max-width: 719px) {
  .front-cue { position: fixed; top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; }
}

/* library: the running session first */
.running-session { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-16); padding: var(--s-12) var(--s-16); margin: 0 0 var(--s-24); border-radius: var(--r-8); background: var(--encre-haute); }
.running-session p { margin: 0; flex: 1 1 260px; font-size: var(--t-16); }
.running-session .live { width: 10px; height: 10px; border-radius: 50%; background: var(--rubrique); flex: none; }
.running-session .live.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--texte-2); }

/* start sheet */
.start-sheet .seg { margin-bottom: var(--s-8); }

/* end sheet (mockup fin-de-seance) */
.end .sheet-lead { margin-bottom: var(--s-24); }
.end .summary { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-16); color: var(--texte-2); font-size: var(--t-14); margin: 0; }
.end .summary b { color: var(--texte); font-weight: 600; }
.end .cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-24); }
@media (min-width: 720px) { .end .cols { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--s-32); } }
.end .block { margin-bottom: var(--s-24); }
.end .pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-8); }
.end .photo-tile { position: relative; margin: 0; border-radius: var(--r-8); overflow: hidden; background: var(--encre-basse); aspect-ratio: 4 / 3; }
.end .photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.end .photo-tile.uploading img { opacity: .55; }
.end .photo-tile .cap { position: absolute; left: var(--s-8); bottom: var(--s-8); font: 600 var(--t-12) / 1 var(--sans); background: var(--voile); color: oklch(0.95 0.005 262); padding: var(--s-4) var(--s-8); border-radius: var(--r-4); }
.end .photo-tile .rm { position: absolute; top: var(--s-4); right: var(--s-4); width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--voile); color: oklch(0.95 0.005 262); display: grid; place-items: center; cursor: pointer; }
.end .shoot { aspect-ratio: 4 / 3; border-radius: var(--r-8); border: 1px dashed var(--texte-3); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-8); color: var(--texte); font: 600 var(--t-14) / 1.3 var(--sans); cursor: pointer; text-align: center; padding: var(--s-8); }
.end .shoot svg.i { width: 28px; height: 28px; color: var(--rubrique); }
.end .gallery { min-height: 40px; padding: 0; margin-top: var(--s-4); font-size: var(--t-14); color: var(--texte-2); text-decoration: underline; text-underline-offset: 3px; }
.end .picker { margin-top: var(--s-8); padding: var(--s-8); border-radius: var(--r-8); background: var(--encre-basse); }
.end .picker[hidden] { display: none; }
.end .inline { display: flex; align-items: center; gap: var(--s-8); }
.end .inline .input { width: 7rem; }
.end .overflow { position: relative; }
.overflow-menu { position: absolute; right: 0; top: 100%; z-index: 2; display: grid; min-width: 260px; padding: var(--s-4); border-radius: var(--r-8); background: var(--encre-basse); box-shadow: 0 8px 24px oklch(0 0 0 / 0.35); }
.overflow-menu[hidden] { display: none; }
.overflow-menu .btn { justify-content: flex-start; }
.offline-note { display: flex; align-items: center; gap: var(--s-8); margin: 0 auto 0 0; color: var(--attention); font-size: var(--t-14); }
.offline-note[hidden] { display: none; }
@media (max-width: 719px) {
  .end .shoot { grid-column: 1 / -1; aspect-ratio: auto; min-height: 56px; flex-direction: row; }
  .offline-note { flex-basis: 100%; }
  .sheet.end .foot { flex-wrap: wrap; }
}

/* photo viewer */
dialog.viewer { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: oklch(0.08 0.01 262); color: var(--texte); }
dialog.viewer::backdrop { background: oklch(0.08 0.01 262); }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.viewer-stage img { max-width: 100%; max-height: 100%; transform-origin: center; user-select: none; }
.viewer-close { position: absolute; top: calc(var(--s-12) + env(safe-area-inset-top)); right: var(--s-12); background: var(--voile); border: 0; color: oklch(0.95 0.005 262); }

/* web/screens/chapitre.css */
/* Reader (DESIGN §4.2, mockups lecteur-*.png). Base components come from base.css (mock.css). */
.reader .topbar .where { min-height: 44px; padding-right: var(--s-8); }
.reader .topbar .where .trail-short { white-space: nowrap; }
.reader .reading { scroll-margin-top: 72px; }
.reader [id] { scroll-margin-top: 72px; }

/* prose at 66ch; figures, tables, code and display math use the whole track */
.reader .prose { max-width: none; }
.reader .prose > * { max-width: var(--measure); }
.reader .prose > .figure, .reader .prose > .table, .reader .prose > .code, .reader .prose > .katex-display { max-width: 100%; }
.reader .prose ul, .reader .prose ol { padding-left: 1.4em; margin: 0 0 var(--s-16); }
.reader .prose li { margin: 0 0 var(--s-4); }
.reader .prose li > p { margin: 0 0 var(--s-4); }
.reader .prose hr { border: 0; height: 1px; background: var(--filet); margin: var(--s-40) 0; max-width: 12rem; }
.reader .prose a { color: var(--rubrique); text-underline-offset: 3px; }
.reader .prose code, .exo code, .hint-body code { font-family: var(--mono); font-size: 0.86em; background: var(--encre-basse); padding: 1px 5px; border-radius: var(--r-4); }
.reader .prose blockquote { margin: var(--s-16) 0; padding: 0 0 0 var(--s-16); color: var(--texte-2); font-style: italic; }
.reader .prose h2 + h3 { margin-top: var(--s-16); }
.callout > p:last-child { margin-bottom: var(--s-12); }

[data-font-step="-1"] .reader .prose, [data-font-step="-1"] .exo .body { font-size: var(--t-16); }
[data-font-step="1"] .reader .prose, [data-font-step="1"] .exo .body { font-size: var(--t-20); }

.code { position: relative; margin: var(--s-16) 0 var(--s-24); background: var(--encre-basse); border-radius: var(--r-8); }
.code pre { margin: 0; padding: var(--s-16); overflow-x: auto; font: 400 var(--t-14) / 1.55 var(--mono); tab-size: 4; }
.code pre code { background: none; padding: 0; font-size: inherit; }
.code .copy { position: absolute; top: var(--s-4); right: var(--s-4); min-height: 40px; font-size: var(--t-12); background: var(--encre-haute); }
.code[data-lang="python"] pre { padding-top: var(--s-40); }
.table { overflow-x: auto; margin: var(--s-16) 0 var(--s-24); }
.table table { border-collapse: collapse; font: 400 var(--t-16) / 1.45 var(--book); min-width: 100%; }
.table th, .table td { padding: var(--s-8) var(--s-12); text-align: left; vertical-align: top; }
.table th { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--texte-2); border-bottom: 1px solid var(--filet); }
.table tr + tr td { border-top: 1px solid color-mix(in oklch, var(--filet) 55%, transparent); }

.math-error { display: inline-flex; flex-wrap: wrap; gap: var(--s-4) var(--s-8); align-items: baseline; padding: var(--s-4) var(--s-8); border-radius: var(--r-4); background: var(--encre-basse); color: var(--attention); font: 400 var(--t-14) / 1.4 var(--sans); }
.math-error code { color: var(--texte); }
.math-error small { color: var(--texte-2); }

.fig-pending { margin: 0; padding: var(--s-24) var(--s-16); border-radius: var(--r-8); background: var(--encre); color: var(--texte-2); text-align: center; font: 600 var(--t-14) / 1.4 var(--sans); }
.figure .shows { display: block; margin-top: var(--s-8); }
.figure.sealed { opacity: 0.9; }

.chapter-head .meta .fait { display: inline-flex; align-items: center; gap: var(--s-4); color: var(--fait); font-weight: 600; }
.section-t { font: 600 var(--t-24) / var(--lh-head) var(--book); margin: var(--s-48) 0 var(--s-8); max-width: var(--measure); }
.exo .body { max-width: var(--measure); }
.exo .body ul, .exo .body ol { padding-left: 1.4em; }
.exo .body hr { display: none; }
.exo .body .katex-display { overflow-x: auto; overflow-y: hidden; }
.seal[data-state="open"] { border-color: var(--filet); background: var(--encre-basse); }
.seal[data-state="open"] .wax { background: var(--fait); color: var(--encre); }
.seal[aria-disabled="true"]:focus-visible { outline: none; }
.confirm-err { flex-basis: 100%; margin: 0; color: var(--attention); font-size: var(--t-14); }
.confirm-err:empty { display: none; }
.hint-body { font: 400 var(--t-16) / 1.55 var(--book); }
.hint-body p { margin: 0 0 var(--s-8); }
.hint-open + .hint-open { margin-top: var(--s-8); }
.by-maia { font: 600 var(--t-12) / 1.3 var(--sans); color: var(--rubrique); margin: 0 0 var(--s-8); }

.lectures .refs { margin-top: 0; }
.ref { grid-template-columns: minmax(0, 1fr) auto; }
.ref .k { font-size: var(--t-12); color: var(--texte-2); overflow-wrap: anywhere; }
.ref .note { font: 400 var(--t-14) / 1.45 var(--book); color: var(--texte-2); }
.ref .btn { grid-row: 1 / span 5; }
@media (max-width: 719px) {
  .ref { grid-template-columns: minmax(0, 1fr); }
  .ref .btn { grid-row: auto; grid-column: 1; justify-self: start; margin-top: var(--s-4); }
  .reader .topbar .where .trail-short, .reader .topbar .where > span[aria-hidden] { display: none; }
}

.rail li a .t { min-width: 0; }
.rail-sheet { display: block; position: static; max-height: none; padding: 0; }
.rail-sheet ol { list-style: none; padding: 0; margin: 0 0 var(--s-16); }
.rail-sheet li a { min-height: 44px; align-items: center; }
.locked-page .empty .i { color: var(--texte-3); }
.rail { scrollbar-width: thin; scrollbar-color: var(--filet) transparent; }

/* web/screens/journal.css */
/* Journal des séances (DESIGN §4.9) */
.journal .serie { margin: 0 0 var(--s-32); max-width: 760px; }
.journal .serie-t { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--texte-2); margin: 0 0 var(--s-8); }
.journal .entry { padding: var(--s-16); border-radius: var(--r-8); background: var(--encre-haute); margin-bottom: var(--s-8); }
.journal .entry header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-8); }
.journal .entry h3 { margin: 0; font: 600 var(--t-18) / 1.3 var(--book); }
.journal .entry h3::first-letter { text-transform: uppercase; }
.journal .status { font: 600 var(--t-12) / 1 var(--sans); padding: var(--s-4) var(--s-8); border-radius: var(--r-4); background: var(--encre-basse); color: var(--texte-2); }
.journal .st-relue { color: var(--fait); }
.journal .st-a_relire { color: var(--rubrique); }
.journal .facts { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-16); margin: var(--s-8) 0; color: var(--texte-2); font-size: var(--t-14); }
.journal .facts a { color: var(--texte); }
.journal .kw { color: var(--rubrique); font-weight: 600; }
.journal .thumbs { display: flex; flex-wrap: wrap; gap: var(--s-8); margin: var(--s-8) 0; }
.journal .thumb { width: 120px; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: var(--r-8); overflow: hidden; background: var(--encre-basse); cursor: zoom-in; }
.journal .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.journal .front { font: 400 var(--t-16) / 1.5 var(--book); margin: var(--s-8) 0; }
.journal .front b { font: 600 var(--t-12) / 1 var(--sans); color: var(--rubrique); margin-right: var(--s-4); }
.journal .go { margin-top: var(--s-8); }
.journal .retour { margin: var(--s-12) 0 0; background: var(--encre-basse); }
.retour .from .spacer { flex: 1; }
.retour .lu { min-height: 40px; }

/* web/screens/lire.css */
/* Lecture PDF (DESIGN §4.4) */
.pdf-bar { gap: var(--s-4); }
.pdf-bar .pdf-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--t-14) / 1.3 var(--book); color: var(--texte-2); }
.pdf-counter { font-size: var(--t-14); color: var(--texte); white-space: nowrap; padding: 0 var(--s-8); }
.pdf-bar [aria-pressed="true"] { background: var(--rubrique-voile); color: var(--texte); }
.pdf-kor { margin: 0; padding: var(--s-8) var(--s-16); font-size: var(--t-12); color: var(--texte-2); }
.pdf-stage { padding: 0 var(--s-8) var(--s-64); }
.pdf-viewer { overflow-x: auto; touch-action: pan-x pan-y; }
.pdf-pages { width: 100%; max-width: none; margin: 0 auto; display: grid; gap: var(--s-12); }
@media (min-width: 720px) { .pdf-pages { width: min(100%, 900px); } }
.pdf-page { position: relative; background: oklch(0.97 0.003 90); border-radius: 2px; overflow: hidden; box-shadow: 0 1px 3px oklch(0 0 0 / 0.3); }
.pdf-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdf-num { position: absolute; top: 50%; left: 50%; translate: -50% -50%; font: 400 var(--t-14) / 1 var(--mono); color: oklch(0.6 0.01 262); }
.pdf-stage.dark .pdf-page { background: oklch(0.2 0.01 262); }
.pdf-stage.dark canvas { filter: invert(0.9) hue-rotate(180deg); }
.pdf-bar .btn { flex: none; }
.pdf-counter { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 719px) {
  .pdf-bar .pdf-title, .pdf-bar .lbl, .pdf-bar .zoom { display: none; }
  .pdf-bar .spacer { display: none; }
  .pdf-counter { flex: 1 1 auto; font-size: var(--t-12); text-align: center; }
}

/* web/screens/parcours.css */
/* Parcours, the roadmap (DESIGN §4.6), lifted from docs/mockups/src/parcours.src.html. */
.trail { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-32); padding: var(--s-24) var(--s-16) var(--s-64); max-width: 1100px; margin: 0 auto; }
@media (min-width: 720px) {
  .trail { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: var(--s-40); padding: var(--s-32) var(--s-32) var(--s-64); align-items: start; }
  .cover { position: sticky; top: calc(56px + var(--s-32)); }
}
.cover .shelf { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--rubrique); margin: 0 0 var(--s-8); }
.cover h1 { font: 600 var(--t-30) / var(--lh-head) var(--book); margin: 0 0 var(--s-12); text-wrap: balance; }
.cover .lede { font: 400 var(--t-16) / 1.55 var(--book); color: var(--texte-2); margin: 0 0 var(--s-24); text-wrap: pretty; }
.cover > .btn { width: 100%; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-8); margin: 0 0 var(--s-24); padding: var(--s-12) 0; }
.stats div { display: flex; flex-direction: column; gap: var(--s-4); }
.stats b { font: 600 var(--t-20) / 1.1 var(--mono); font-variant-numeric: tabular-nums; }
.stats span { font-size: var(--t-12); color: var(--texte-2); line-height: 1.3; }
.week { margin-top: var(--s-24); }
.week p { font-size: var(--t-12); color: var(--texte-2); margin: 0 0 var(--s-8); }
.week .bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-4); align-items: end; height: 56px; }
.week .bars i { display: block; min-height: 2px; background: var(--filet); border-radius: 2px; }
.week .bars i.on { background: var(--rubrique); }
.week .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-4); font: 400 var(--t-12) / 1 var(--mono); color: var(--texte-2); text-align: center; margin-top: var(--s-4); }

.toc h2 { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--texte-2); margin: 0 0 var(--s-12); }
.toc ol { list-style: none; margin: 0; padding: 0; position: relative; }
.toc ol::before { content: ""; position: absolute; left: 19px; top: 24px; bottom: 24px; width: 2px; background: var(--filet); }
.ch { position: relative; border-radius: var(--r-16); }
.ch-hit {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s-4) var(--s-16);
  padding: var(--s-16) var(--s-16) var(--s-16) 0; align-items: start; width: 100%;
  text-decoration: none; color: inherit; background: none; border: 0; text-align: left; font: inherit; cursor: pointer; border-radius: var(--r-16);
}
.ch .node { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 600 var(--t-16) / 1 var(--book); background: var(--encre); box-shadow: inset 0 0 0 2px var(--filet); color: var(--texte-3); position: relative; z-index: 1; }
.ch h3 { margin: var(--s-8) 0 0; font: 600 var(--t-20) / 1.25 var(--book); text-wrap: balance; }
.ch .sub { font-size: var(--t-14); color: var(--texte-2); line-height: 1.4; }
.ch .side { grid-row: 1 / span 2; grid-column: 3; align-self: center; text-align: right; font-size: var(--t-14); color: var(--texte-2); display: flex; flex-direction: column; gap: var(--s-8); align-items: flex-end; }
.ch .side .num { font-size: var(--t-14); }
.ch.done .node { background: var(--fait); box-shadow: none; color: var(--encre); }
.ch.done h3 { color: var(--texte); }
.ch.current { background: var(--encre-haute); margin: var(--s-8) 0; padding-bottom: var(--s-4); }
.ch.current .node { background: var(--rubrique); color: var(--sur-rubrique); box-shadow: 0 0 0 6px var(--rubrique-voile); }
.ch.current .note { margin: 0 var(--s-16) var(--s-12) 56px; font: 400 var(--t-16) / 1.5 var(--book); color: var(--texte); }
.ch.current .note b { font: 600 var(--t-14) / 1 var(--sans); color: var(--rubrique); margin-right: var(--s-8); }
.ch.locked h3 { color: var(--texte-3); font-weight: 500; }
.ch.locked .sub, .ch.locked .side { color: var(--texte-3); }
.ch.locked .summary { margin: calc(-1 * var(--s-8)) var(--s-16) var(--s-12) 56px; font: 400 var(--t-14) / 1.5 var(--book); color: var(--texte-3); max-width: var(--measure); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ch .after-line { margin: 0 var(--s-16) var(--s-16) 56px; font: 600 var(--t-14) / 1.3 var(--sans); color: var(--texte-2); display: flex; gap: var(--s-8); align-items: center; }
.ch .after-line[hidden] { display: none; }
.ch.finale .node { font-size: var(--t-14); }
.ch .fork { position: absolute; left: 44px; top: -6px; font: 600 var(--t-12) / 1 var(--mono); color: var(--texte-2); background: var(--encre); padding: 2px 6px; border-radius: var(--r-4); z-index: 2; }
.ch-actions { display: flex; gap: var(--s-8); margin: 0 var(--s-16) var(--s-12) 56px; flex-wrap: wrap; }
@media (max-width: 719px) {
  .ch-hit { grid-template-columns: 40px minmax(0, 1fr); }
  .ch .side { grid-row: auto; grid-column: 2; align-items: center; text-align: left; flex-direction: row; flex-wrap: wrap; gap: var(--s-8) var(--s-12); }
}

/* Bibliothèque (DESIGN §4.1) */
.library .shelf { margin: 0 0 var(--s-40); }
.library .shelf-t { font: 600 var(--t-14) / 1.3 var(--sans); color: var(--rubrique); margin: 0 0 var(--s-12); }
.book { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-8) var(--s-24); align-items: center; padding: var(--s-24); border-radius: var(--r-16); background: var(--encre-haute); }
.book + .book { margin-top: var(--s-12); }
.book h3 { margin: 0; font: 600 var(--t-24) / var(--lh-head) var(--book); text-wrap: balance; }
.book h3 a { color: inherit; text-decoration: none; }
.book .lede { margin: var(--s-4) 0 var(--s-12); font: 400 var(--t-16) / 1.5 var(--book); color: var(--texte-2); max-width: var(--measure); text-wrap: pretty; }
.book .facts { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-16); font-size: var(--t-14); color: var(--texte-2); }
.book .facts b { color: var(--texte); font-weight: 600; }
.book .retour-line { margin: var(--s-8) 0 0; font-size: var(--t-14); }
.book .retour-line a { color: var(--rubrique); font-weight: 600; }
.book .go { grid-column: 2; grid-row: 1 / span 3; }
@media (max-width: 719px) {
  .book { grid-template-columns: minmax(0, 1fr); padding: var(--s-16); }
  .book .go { grid-column: 1; grid-row: auto; justify-self: start; }
}
.running { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-16); padding: var(--s-16) var(--s-24); border-radius: var(--r-16); background: var(--rubrique-voile); margin: 0 0 var(--s-32); }
.running p { margin: 0; flex: 1 1 240px; font-weight: 600; }
.running .num { font-weight: 400; }

/* web/figures/figures.css */
/* Figures (DESIGN §4.5): the frame comes from base.css (.figure); the runtime adds controls. */
.figure .stage { align-items: start; }
.figure .fig-plot { min-width: 0; }
.figure .fig-plot svg.plot { width: 100%; height: auto; max-height: none; display: block; overflow: visible; }
.figure.interactive .fig-plot svg { cursor: pointer; touch-action: manipulation; }
.figure .readout b { font-size: var(--t-18); overflow-wrap: anywhere; }
.figure .fig-note { grid-column: 1 / -1; margin: 0; font: 400 var(--t-14) / 1.45 var(--sans); color: var(--texte-2); }
.figure .controls[hidden] { display: none; }
.figure .controls { align-items: flex-end; }
.figure .ctl { display: grid; gap: var(--s-4); min-width: 0; max-width: 100%; }
.figure .ctl .seg-label { margin: 0; }
.figure .seg { flex-wrap: wrap; max-width: 100%; }
.figure .seg button[disabled] { opacity: 0.45; cursor: default; }
.figure .seg.multi button[aria-pressed="true"] { background: var(--rubrique-voile); color: var(--texte); box-shadow: inset 0 0 0 1px var(--rubrique); }
.figure .ctl.gated .seg-label { color: var(--texte-3); }
.figure .gate { font: 600 var(--t-12) / 1 var(--sans); color: var(--texte-2); display: inline-flex; gap: var(--s-4); }
.figure .gate::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--filet); }
.figure .range { display: flex; align-items: center; gap: var(--s-8); min-height: 40px; }
.figure .range input { width: min(220px, 60vw); accent-color: var(--rubrique); min-height: 40px; }
.figure .range output { font-size: var(--t-14); min-width: 4ch; }
.figure .actions { display: flex; flex-wrap: wrap; gap: var(--s-8); flex-basis: 100%; }
.figure .fig-help { flex-basis: 100%; margin: 0; font-size: var(--t-12); color: var(--texte-2); }
.figure iframe.sandbox { width: 100%; border: 0; border-radius: var(--r-8); background: var(--encre); display: block; grid-column: 1 / -1; }
.figure.sandboxed .stage { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 719px) {
  .figure { margin-left: calc(-1 * var(--s-8)); margin-right: calc(-1 * var(--s-8)); padding: var(--s-12); }
}
