/* ============================================================
   Classicalia — page design system (content pages)
   ui.css — loads after shell.css on subject, course, lesson and
   set-text pages. The header and footer come from the shell.
   Light ground, white panels with a soft shadow, upright Lora
   headings, DM Sans text, one blue accent and one green.
   ============================================================ */

:root {
  --navy: #0E1E3F; --ink: #141a2b; --body: #3b4358; --muted: #6b7386;
  --rule: #e6e8ee; --rule-soft: #f1f2f6; --paper: #ffffff; --ground: #f6f7f9;
  --brand: #1a6fff; --brand-soft: #e9f1ff;
  --ok: #1f9d55; --ok-soft: #e4f5eb; --ok-deep: #127a3e;
  --warn: #f0b429; --warn-soft: #fff4d6; --weak: #f06a5c; --weak-soft: #fdeceb; --none: #e5e8ef;
  --latin: #e4573f; --greek: #2b8def; --civ: #e8a317;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 10px 30px rgba(14,30,63,.08), 0 1px 2px rgba(14,30,63,.06);
  --shadow-lg: 0 24px 48px rgba(14,30,63,.14), 0 1px 3px rgba(14,30,63,.08);
  /* names the older lesson components still use */
  --cream: #f6f7f9; --rule-faint: #f1f2f6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); font-size: 15.5px; line-height: 1.55; color: var(--body); background: var(--ground); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; color: var(--ink); letter-spacing: -0.012em; text-wrap: balance; }
img { max-width: 100%; height: auto; }
.inner { max-width: 1140px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: var(--navy); padding: 8px 12px; z-index: 300; }
.skip:focus { left: 8px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── page head ── */
.phead { padding: 28px 0 0; }
.crumb { font-size: 14px; color: var(--muted); margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb a:hover { color: var(--ink); }
.crumb span { color: #b3bac9; }
.ptitle { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.ptitle h1 { font-size: clamp(30px, 3.6vw, 40px); line-height: 1.08; }
.ptitle .sub { color: var(--muted); font-size: 15.5px; margin-top: 8px; max-width: 70ch; }
.ptitle .sub em { color: var(--body); }
.ptitle .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-top: 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-size: 15px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--navy); }
.tabs a:hover { color: var(--ink); }

/* ── buttons, chips, bars ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--sans); font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn.navy { background: var(--navy); color: #fff; }
.btn.navy:hover { background: #1a2e5c; }
.btn.green { background: var(--ok-deep); color: #fff; }
.btn.green:hover { background: #0f6a35; }
.btn.line { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.btn.line:hover { border-color: var(--ink); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
.btn.lg { padding: 13px 22px; font-size: 15.5px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 6px; background: var(--rule-soft); color: var(--body); white-space: nowrap; line-height: 1.5; }
.chip.on { background: var(--ok-soft); color: #1f7a45; }
.chip.live { background: var(--ok); color: #fff; }
.chip.warn { background: var(--warn-soft); color: #7a5300; }
.chip.weak { background: var(--weak-soft); color: #9a2f22; }
.chip.blue { background: var(--brand-soft); color: #1457cc; }
.chip.soon { background: transparent; color: #9aa3b5; border: 1px solid var(--rule); font-weight: 600; }
.chip.pdf { background: #fff; color: var(--body); border: 1px solid var(--rule); }
.bar { height: 6px; background: var(--none); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar.blue i { background: var(--brand); }

/* ── panels and rows ── */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow); }
.panel .ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--rule-soft); }
.panel .ph .t { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.panel .ph .t small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.panel .ph .n { font-size: 13.5px; color: var(--muted); }
.panel .ph .n b { color: var(--ok); }
.panel .ph h2, .panel .ph h3 { font-size: 18px; }
.panel .pb { padding: 16px 18px 18px; }
.panel .pb > p { font-size: 14.5px; margin: 0 0 10px; }
.panel .pb > p:last-child { margin-bottom: 0; }
.panel .pb > p b { color: var(--ink); }
.panel.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.panel.navy h3 { color: #fff; }
.panel.navy p { color: #b9c6e2; }
.panel.navy .btn.line { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.rows .row { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 11px 0; border-top: 1px solid var(--rule-soft); align-items: center; }
.rows .row:first-child { border-top: 0; padding-top: 2px; }
.rows .row:last-child { padding-bottom: 2px; }
.rows .rt { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.rows .rt .code { display: inline-block; font-weight: 600; font-size: 12px; color: var(--muted); background: var(--rule-soft); border-radius: 5px; padding: 1px 7px; margin-right: 8px; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.rows .rm { grid-row: 2; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.rows .rm em { font-style: italic; }
.rows .right { grid-row: 1 / span 2; display: flex; align-items: center; gap: 12px; }
.rows .right .bar { width: 84px; }
.rows .right .v { font-size: 12.5px; color: var(--muted); min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.rows a.row:hover .rt { color: var(--brand); }
.rows .row.off .rt { color: var(--muted); font-weight: 500; }
.rows .row.off .rm { color: #9aa3b5; }
.rows .row.sep { padding: 14px 0 4px; border-top: 0; }
.rows .row.sep .rt { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.kv { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
/* unwritten lessons folded away under one line */
.more { border-top: 1px solid var(--rule-soft); }
.more summary { list-style: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 11px 0 6px; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '+'; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--rule-soft); color: var(--muted); font-weight: 700; font-size: 13px; }
.more[open] summary::before { content: '–'; }
.more summary:hover { color: var(--ink); }
.more .row:first-of-type { border-top: 0; }

/* ── layouts ── */
.page { padding: 26px 0 60px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cols-wide { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.stack > * { min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--serif); font-size: 28px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.rail { position: sticky; top: 20px; display: grid; gap: 16px; min-width: 0; }
.rail .panel .pb { padding-top: 10px; padding-bottom: 12px; }
.lvl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 14px; }
.lvl-head h2 { font-size: 24px; }
.lvl-head .code { font-size: 13px; color: var(--muted); font-weight: 600; }
.lvl-head p { flex-basis: 100%; color: var(--muted); font-size: 14.5px; max-width: 72ch; margin-top: 2px; }
.stack + .lvl-head, .panel + .lvl-head { margin-top: 24px; }

/* ── key/value list (rail "Key facts", "About this course") ── */
.kvl { list-style: none; margin: 0; padding: 0; }
.kvl li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--rule-soft); font-size: 14px; color: var(--ink); }
.kvl li:first-child { border-top: 0; }
.kvl li b { color: var(--muted); font-weight: 600; }
.kvl li .k { color: var(--muted); font-weight: 600; }

/* ── on this page ── */
.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: block; font-size: 14px; color: var(--body); padding: 6px 10px; border-radius: 6px; line-height: 1.35; }
.toc a:hover { background: var(--ground); color: var(--ink); }
.toc a.on { background: var(--brand-soft); color: var(--ink); font-weight: 600; }

/* ── exam focus box ── */
.exam { background: var(--brand-soft); border-radius: 12px; padding: 18px 20px; }
.exam .k { font-size: 12px; font-weight: 700; color: #1457cc; margin-bottom: 8px; }
.exam ol { margin: 0 0 0 20px; font-size: 15px; color: var(--ink); }
.exam li { margin-bottom: 6px; }
.exam .explain-block { background: transparent; border: 0; padding: 0; margin: 0 0 14px; }
.exam .explain-block:last-child { margin-bottom: 0; }
.exam .explain-label { color: #1457cc; }
.exam .explain-q { font-size: 14px; border-bottom-color: rgba(20,87,204,.15); }
.exam .explain-q::before { color: #1457cc; }
.exam .explain-q em { color: var(--muted); font-size: 12.5px; }

/* ── document layout: full-height sidebar with the course tree, then the page ── */
.layout { display: grid; grid-template-columns: clamp(280px, 17vw, 340px) minmax(0, 1fr); align-items: start; }
.docnav { background: var(--paper); border-right: 1px solid var(--rule); padding: 28px 20px 48px 28px; position: sticky; top: 0; min-height: 100vh; max-height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.docnav .course { font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--ink); line-height: 1.2; display: block; }
.docnav .course:hover { color: var(--brand); }
.docnav .lvl { font-size: 13px; color: var(--muted); margin: 2px 0 18px; }
.docnav .grp { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 16px 10px 6px; line-height: 1.35; }
.docnav .grp:first-of-type { margin-top: 0; }
.docnav .grp span { font-weight: 500; white-space: nowrap; }
.docnav .sect { font-size: 11.5px; font-weight: 700; color: #9aa3b5; margin: 22px 10px 0; letter-spacing: 0; }
.docnav a, .docnav .soon-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--body); padding: 7px 10px; border-radius: 7px; line-height: 1.35; }
.docnav a:hover { background: var(--ground); color: var(--ink); }
.docnav a.on { background: var(--brand-soft); color: var(--ink); font-weight: 600; }
.docnav a .n, .docnav .soon-row .n { color: #9aa3b5; font-weight: 600; min-width: 26px; flex: none; font-variant-numeric: tabular-nums; }
.docnav a.on .n { color: var(--brand); }
.docnav .sub { margin: 4px 0 6px 18px; border-left: 2px solid var(--rule); padding-left: 6px; }
.docnav .sub a { font-size: 13.5px; color: var(--muted); padding: 5px 8px; }
.docnav .sub a.on { background: none; color: var(--ink); font-weight: 600; }
.docnav .done { color: var(--ok); font-size: 12px; font-weight: 600; }
.docnav .soon { color: #b3bac9; font-size: 12px; white-space: nowrap; }
.docnav .soon-row { color: #9aa3b5; font-size: 13px; }
.docnav .foot { margin: 22px 10px 0; padding-top: 16px; border-top: 1px solid var(--rule-soft); font-size: 13.5px; display: grid; gap: 2px; }
.docnav .foot a { padding: 6px 0; color: var(--brand); font-weight: 600; display: block; }
.docnav .foot a:hover { background: none; text-decoration: underline; }
.maincol { min-width: 0; }
.maincol .inner { max-width: 1800px; margin: 0; padding-left: max(56px, env(safe-area-inset-left, 0px)); padding-right: max(48px, env(safe-area-inset-right, 0px)); }
.cols-r { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 22%, 400px); gap: clamp(24px, 2.2vw, 40px); align-items: start; }
.docnav-toggle { display: none; }

/* ── document (lesson) ── */
.doc { padding: 8px 32px 32px; max-width: none; }
.doc .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 18px; }
.doc section { scroll-margin-top: 20px; }
.doc h2 { font-size: 27px; margin: 34px 0 6px; padding-top: 26px; border-top: 1px solid var(--rule-soft); }
.doc section:first-of-type h2 { border-top: 0; padding-top: 6px; margin-top: 0; }
.doc .sect-sub { color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.doc h3, .doc .entry-head .term { font-family: var(--serif); font-style: normal; font-weight: 600; font-size: 19px; color: var(--ink); line-height: 1.3; }
.doc h3 { margin: 22px 0 8px; }
.doc h4 { font-size: 16px; margin: 18px 0 6px; }
.doc p { margin: 0 0 12px; font-size: 16px; line-height: 1.65; }
.doc ul, .doc ol { margin: 0 0 14px 20px; font-size: 16px; line-height: 1.6; }
.doc li { margin-bottom: 6px; }
.doc li b, .doc p b, .doc .k { color: var(--ink); font-weight: 600; }
.doc .lead, .doc p.lede { font-family: var(--serif); font-size: 19px; color: var(--ink); line-height: 1.5; margin-bottom: 18px; }
.doc .pull { border-left: 3px solid var(--navy); padding: 4px 0 4px 18px; font-family: var(--serif); font-size: 18px; line-height: 1.5; color: var(--ink); margin: 18px 0 22px; }
.doc .exam { margin: 20px 0; }
.doc hr.entry-divider { border: 0; border-top: 1px solid var(--rule-soft); margin: 22px 0; }

/* figures: in the prose, where they belong */
.figs, .figs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 20px; align-items: start; }
.fig, .rev-fig { margin: 0 0 18px; text-align: left; }
.fig img, .rev-fig img { border-radius: 10px; display: block; max-width: 100%; height: auto; border: 0; background: var(--ground); }
.figs-row .rev-fig img { max-height: none; width: 100%; }
.fig figcaption, .rev-fig figcaption { font-size: 13px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
.fig.float, .doc .detail-fig { float: right; width: 260px; margin: 4px 0 14px 22px; }
.doc .detail-fig img { width: 100%; border-radius: 10px; border: 0; }
.doc .detail-fig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; text-align: left; line-height: 1.4; }
.doc .entry--fig, .doc .entry--fig .facts { display: flow-root; }

/* lesson components (entries, facts, analysis, quotations, comparisons) */
.doc .entry { margin-bottom: 22px; }
.doc .entry-head { margin-bottom: 6px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.doc .term-gloss { font-family: var(--sans); font-style: italic; font-size: 14px; color: var(--muted); }
.doc .entry-def { font-size: 15px; color: var(--muted); line-height: 1.6; margin: 0 0 9px; }
.doc .facts { list-style: none; margin: 0 0 14px; padding: 0; }
.doc .facts li { font-size: 15.5px; color: var(--body); line-height: 1.6; padding: 5px 0 5px 18px; position: relative; margin: 0; border-bottom: 1px solid var(--rule-soft); }
.doc .facts li:last-child { border-bottom: 0; }
.doc .facts li::before { content: ''; position: absolute; left: 2px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .55; }
.doc .facts li.sub { padding-left: 34px; font-size: 14.5px; color: var(--muted); }
.doc .facts li.sub::before { left: 18px; width: 5px; height: 5px; background: #b3bac9; opacity: 1; }
.doc .facts li.source { color: var(--muted); font-size: 14.5px; }
.doc .facts li.source::before { background: var(--civ); }
.doc .analysis { font-family: var(--serif); font-style: normal; font-weight: 500; font-size: 17px; color: var(--ink); line-height: 1.6; margin: 18px 0 8px; padding: 2px 0 2px 18px; border-left: 3px solid var(--navy); }
.doc .quote { margin: 14px 0 12px; padding: 14px 18px; background: var(--ground); border-radius: 10px; }
.doc .quote-latin, .doc .quote-greek { font-family: var(--serif); font-style: italic; font-size: 16.5px; color: var(--ink); line-height: 1.55; }
.doc .quote-trans { font-size: 14.5px; color: var(--muted); margin-top: 6px; line-height: 1.55; }
.doc .cmp-header, .doc .cmp-row { display: grid; grid-template-columns: 1fr 1fr; }
.doc .cmp-col-head { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 12px 8px; border-bottom: 1px solid var(--rule); }
.doc .cmp-row { border-top: 1px solid var(--rule-soft); font-size: 15px; line-height: 1.55; }
.doc .cmp-row:last-of-type { border-bottom: 1px solid var(--rule-soft); }
.doc .cmp-cell { padding: 10px 12px; color: var(--body); border-right: 1px solid var(--rule-soft); }
.doc .cmp-cell:last-child { border-right: 0; }
.doc .explain-block { background: var(--brand-soft); border: 0; border-radius: 12px; padding: 16px 18px; margin: 18px 0; }
.doc .explain-label { font-size: 12px; font-weight: 700; color: #1457cc; margin-bottom: 8px; }
.explain-q { font-size: 15px; color: var(--ink); padding: 6px 0; border-bottom: 1px solid rgba(20,87,204,.12); line-height: 1.5; }
.explain-q:last-child { border-bottom: 0; padding-bottom: 0; }
.explain-q::before { content: 'Q '; color: #1457cc; font-weight: 700; font-size: 12px; }
.explain-q em { color: var(--muted); font-size: 13px; }
.doc .rev-fig + .entry { clear: both; }
.doc .note, .doc .rev-note { background: var(--ground); border-radius: 10px; padding: 12px 16px; font-size: 14.5px; margin: 12px 0; }
.doc .ln, .doc a.ln { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 10px 0 16px; }
.doc th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 0 10px 8px 0; border-bottom: 1px solid var(--rule); }
.doc td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
/* the "view image" popovers on the Myth and Religion pages */
.doc .source-img-trigger { font-size: 12px; font-weight: 600; color: var(--brand); display: inline-flex; align-items: center; gap: 4px; }

/* flashcards */
.fc-panel .pb { padding-top: 14px; }
.fc-wrap { margin-top: 4px; }
.fc { height: 280px; cursor: pointer; perspective: 1200px; margin-bottom: 14px; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.4,0,.2,1); transform-style: preserve-3d; }
.fc-inner.flipped { transform: rotateY(180deg); }
.fc-front, .fc-back { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 40px; }
.fc-front { background: var(--ground); border: 1px solid var(--rule); }
.fc-front:hover { border-color: var(--brand); }
.fc-q { font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--ink); text-align: center; line-height: 1.5; max-width: 52ch; }
.fc-hint { margin-top: 18px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fc-back { background: var(--navy); border: 1px solid var(--navy); transform: rotateY(180deg); align-items: flex-start; justify-content: center; overflow-y: auto; }
.fc-back p { font-size: 15px; color: rgba(255,255,255,.9); line-height: 1.65; margin: 0; text-align: left; }
.fc-back ul { list-style: none; padding: 0; margin: 0; width: 100%; }
.fc-back li { font-size: 14.5px; color: rgba(255,255,255,.88); line-height: 1.6; padding: 6px 0 6px 18px; position: relative; border-bottom: 1px solid rgba(255,255,255,.08); }
.fc-back li:last-child { border-bottom: 0; }
.fc-back li::before { content: ''; position: absolute; left: 0; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: #6ba0ff; }
.fc-back b { color: #fff; }
.fc-back em { color: rgba(255,255,255,.7); }
.fc-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fc-btn { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); padding: 8px 14px; border-radius: 7px; cursor: pointer; }
.fc-btn:hover:not(:disabled) { border-color: var(--ink); }
.fc-btn:disabled { opacity: .35; cursor: default; }
.fc-btn-next { background: var(--navy); color: #fff; border-color: var(--navy); }
.fc-btn-next:hover:not(:disabled) { background: #1a2e5c; }
.fc-counter { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-progress { height: 4px; background: var(--none); border-radius: 2px; margin-bottom: 14px; overflow: hidden; }
.fc-progress-bar { height: 100%; width: 0; background: var(--brand); border-radius: 2px; transition: width .3s ease; }
.fc-tools { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }

/* pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager a, .pager span { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: block; }
.pager span { visibility: hidden; }
.pager a.next { text-align: right; }
.pager a small { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.pager a b { font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 15.5px; }
.pager a:hover b { color: var(--brand); }

/* lightbox (revision-lightbox.js) */
.rev-zoomable { cursor: zoom-in; }
.rev-lightbox { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; padding: 4vmin; background: rgba(15,20,35,.82); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.rev-lightbox.open { display: flex; }
.rev-lightbox-fig { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.rev-lightbox-img { max-width: 92vw; max-height: 82vh; width: auto; height: auto; border-radius: 8px; box-shadow: 0 24px 64px rgba(0,0,0,.5); }
.rev-lightbox-cap { margin-top: 12px; max-width: 70ch; text-align: center; color: rgba(255,255,255,.82); font-size: 13px; line-height: 1.5; }
.rev-lightbox-close { position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }

/* ── support band (subject pages) ── */
.support { background: var(--navy); color: #fff; border-radius: 14px; padding: 24px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.support h3 { color: #fff; font-size: 20px; margin-bottom: 4px; }
.support p { color: #b9c6e2; font-size: 14.5px; max-width: 60ch; }
.support .btn.line { background: #fff; color: var(--navy); border-color: #fff; }

/* wide screens: the notes use the room, with the type a touch larger so lines stay readable */
@media (min-width: 1500px) {
  .doc { padding: 8px 44px 40px; }
  .doc p, .doc ul, .doc ol, .doc .facts li, .doc .cmp-row, .doc .explain-q { font-size: 17px; }
  .doc .facts li.sub, .doc .facts li.source { font-size: 15.5px; }
  .doc h2 { font-size: 30px; }
  .doc h3, .doc .entry-head .term { font-size: 21px; }
  .doc .lead, .doc p.lede { font-size: 21px; }
  .doc .analysis { font-size: 18.5px; }
  .fig.float, .doc .detail-fig { width: 340px; margin-left: 28px; }
  .ptitle h1 { font-size: 44px; }
  .ptitle .sub { font-size: 16.5px; }
  .kvl li { font-size: 15px; grid-template-columns: 110px 1fr; }
  .toc a { font-size: 15px; }
  .exam ol, .exam .explain-q { font-size: 15.5px; }
}
@media (min-width: 1900px) {
  .doc p, .doc ul, .doc ol, .doc .facts li, .doc .cmp-row, .doc .explain-q { font-size: 18px; }
  .doc .facts li.sub, .doc .facts li.source { font-size: 16.5px; }
  .fig.float, .doc .detail-fig { width: 400px; }
}

/* ── responsive ── */
@media (max-width: 1180px) {
  .cols-r { grid-template-columns: minmax(0, 1fr); }
  .cols-r .rail { position: static; grid-template-columns: 1fr 1fr; }
  .maincol .inner { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
}
@media (max-width: 980px) {
  .cols, .cols-wide, .two { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .doc .source-img-popup { display: none; }
  .docnav { position: static; min-height: 0; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule); padding: 14px 20px; }
  .docnav .tree { display: none; }
  .docnav .lvl { margin-bottom: 0; }
  .docnav .foot { margin-top: 10px; padding-top: 10px; }
  .docnav[data-open] .tree { display: block; }
  .docnav-toggle { display: inline-block; margin: 8px 0 0; }
  .maincol .inner { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
  .cols-r .rail { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .ptitle .acts .btn.line[data-print] { display: none; }
}
@media (max-width: 640px) {
  .doc { padding: 8px 18px 28px; }
  .doc h2 { font-size: 23px; }
  .figs, .figs-row { grid-template-columns: 1fr; }
  .fig.float, .doc .detail-fig { float: none; width: auto; max-width: 320px; margin: 10px 0 16px; }
  .kvl li { grid-template-columns: 1fr; gap: 2px; }
  .pager { grid-template-columns: 1fr; }
  .pager span { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .rows .row { grid-template-columns: 1fr; }
  .rows .right { grid-row: 3; margin-top: 4px; }
  .fc { height: 240px; }
  .fc-front, .fc-back { padding: 22px 20px; }
  .fc-q { font-size: 17px; }
  .doc .cmp-header, .doc .cmp-row { grid-template-columns: 1fr; }
  .doc .cmp-cell { border-right: 0; }
  .doc .cmp-cell + .cmp-cell { border-top: 1px dashed var(--rule); }
}
@media print {
  body { background: #fff; font-size: 12.5px; }
  .docnav, .rail .toc-panel, .ptitle .acts, .pager, .fc-panel, .tabs, .docnav-toggle { display: none !important; }
  .layout, .cols-r { display: block; }
  .panel { box-shadow: none; border: 0; }
  .doc { padding: 0; }
  .maincol .inner { padding: 0; max-width: none; }
  .rail { display: block; }
  a[href]::after { content: ''; }
}
