/* ============================================================
   style-core.css — classical-reading-site design system (faithful base)
   Copy into assets/style.css. This is the reusable CORE: tokens, layout,
   3-column reading grid, character-bio cards + impact-tier markers, the
   供參考 callout, and the mobile fixes from the design-review pass.
   Text-specific sections (guang / jingjian / themes / timeline) are omitted
   on purpose — add them per classic.
   ============================================================ */

:root {
  /* ---- 色 ---- */
  --paper:        oklch(0.952 0.018 85);
  --paper-raised: oklch(0.975 0.014 85);
  --paper-sunk:   oklch(0.918 0.020 82);
  --slip:         oklch(0.940 0.034 78);   /* manuscript face — commentary panel */

  --ink:          oklch(0.272 0.020 50);    /* warm lacquer ink */
  --ink-soft:     oklch(0.430 0.022 50);
  /* P1#12: was 0.520 — only 4.35:1 on --paper-sunk (footer / .sy / .worldsnap),
     i.e. the "AA-cleared on all paper tones" promise was false. 0.490 measures
     5.48 / 5.86 / 4.94 / 5.28 on paper / raised / sunk / slip. */
  --ink-faint:    oklch(0.490 0.020 50);

  --rule:         oklch(0.272 0.020 50 / 0.16);
  --rule-strong:  oklch(0.272 0.020 50 / 0.38);

  --vermilion:    oklch(0.548 0.185 28);    /* 朱砂 — signature commentary + active */
  --vermilion-lo: oklch(0.548 0.185 28 / 0.10);
  --gold:         oklch(0.720 0.095 80);    /* 赭金 — rules, chrome */
  --gold-lo:      oklch(0.720 0.095 80 / 0.30);
  /* P1#13: was 0.640 — 2.95:1 on paper. It is a *text* token (.gbox__h, .jj__h)
     and a badge ground (.summary__tag), so it must clear AA: 0.500 → ≥4.76:1
     on every paper tone. Lands in the same 赭金 family as the star colour. */
  --gold-text:    oklch(0.500 0.095 80);

  /* ---- 星 ---- */
  --star:     #8a6500;                      /* P0#2: mandated accessible star (4.6:1+) */
  --star-off: oklch(0.720 0.045 80);        /* P2#9: unlit star — decorative only,
                                               the numeric value lives in aria-label */

  /* ---- per-紀色相（各頁覆寫 --hue，卡片覆寫 --card-hue）---- */
  --hue: 30;
  --accent:      oklch(0.485 0.115 var(--hue));
  --accent-deep: oklch(0.385 0.095 var(--hue));
  --accent-wash: oklch(0.485 0.115 var(--hue) / 0.08);
  --accent-line: oklch(0.485 0.115 var(--hue) / 0.32);

  /* ---- 間距（base 4px）---- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* ---- 字 ---- */
  --song: "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --kai:  "KaiTi", "STKaiti", "楷体", "Noto Serif SC", serif;
  --hei:  "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;

  /* 別名：供人物卡片等次級中繼資料使用（與全站 --ink-soft/--ink-faint/--song 對齊）。
     DEFINING these is P0 — an undefined var silently inherits --ink and flattens hierarchy. */
  --serif: var(--song);
  --ink-1: var(--ink-soft);
  --ink-2: var(--ink-faint);
  --ink-3: var(--ink-faint);

  --t-xs:   0.75rem;
  --t-sm:   0.875rem;
  --t-base: 1.0625rem;
  --t-md:   1.25rem;
  --t-lg:   1.5rem;
  --t-xl:   1.9rem;
  --t-2xl:  2.4rem;
  --t-3xl:  3rem;
  --t-4xl:  4rem;

  --radius: 2px;
  --measure: 35em;       /* ~50 字/行 cap for long-form prose */
  --measure-wide: 42em;  /* secondary prose (輯覽 / 導言) — looser but still capped */
  --slip-w: 58px;        /* manuscript column pitch */

  /* ---- sticky geometry — one source of truth for topbar height ----
     P1#14: scroll-padding-top, .lhs/.rhs top and every scroll-margin-top used
     to be three different hand-tuned numbers (92 / 100 / 110px). */
  --topbar-h: 64px;
  --stick: calc(var(--topbar-h) + var(--s5));
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* descendants that override --hue must re-declare the accents */
.jcard, .vrow, .gcase, .tsg {
  --hue: var(--card-hue);
  --accent:      oklch(0.485 0.115 var(--hue));
  --accent-deep: oklch(0.385 0.095 var(--hue));
  --accent-wash: oklch(0.485 0.115 var(--hue) / 0.08);
  --accent-line: oklch(0.485 0.115 var(--hue) / 0.32);
}

html { scroll-behavior: smooth; scroll-padding-top: var(--stick); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- 3-column reading layout ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 320px);
  gap: var(--s7);
  align-items: start;
  padding: var(--s8) 0 var(--s9);
  max-width: 1480px; margin: 0 auto;
}
.lhs { position: sticky; top: var(--stick); max-height: calc(100vh - var(--stick) - var(--s5));
       overflow-y: auto; overscroll-behavior: contain; font-family: var(--hei); }
.rhs { position: sticky; top: var(--stick); max-height: calc(100vh - var(--stick) - var(--s5));
       overflow-y: auto; overscroll-behavior: contain;
       display: grid; gap: var(--s5); align-content: start; }
.layout > .main { min-width: 0; max-width: 880px; margin: 0 auto; width: 100%; }

/* RHS collapsible (JS sets body[data-rhs="collapsed"]) */
body[data-rhs="collapsed"] .layout { grid-template-columns: minmax(0,220px) minmax(0,1fr) 48px; }
body[data-rhs="collapsed"] .rhs { width:48px; min-width:48px; padding:0; overflow:visible;
       background:transparent; border:0; box-shadow:none; gap:0; }
body[data-rhs="collapsed"] .rhs > *:not(.rhs__toggle) { display:none; }
.rhs__toggle {
  position: sticky; top:var(--stick); z-index:5; align-self:start; justify-self:end;
  width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center;
  font-family:var(--hei); font-size:14px; line-height:1; color:var(--vermilion);
  background:var(--paper-raised); border:1px solid var(--rule); border-radius:16px;
  cursor:pointer; margin-bottom:calc(-1 * var(--s5)); box-shadow:0 1px 2px oklch(0.272 0.020 50 / 0.06);
  transition:background .15s,color .15s,border-color .15s;
}
.rhs__toggle:hover { background:var(--vermilion); color:var(--paper); border-color:var(--vermilion); }
body[data-rhs="collapsed"] .rhs__toggle { position:static; margin:var(--s5) auto 0; justify-self:center;
  width:44px; min-width:0; padding:6px 2px; white-space:normal; text-align:center; line-height:1.5; font-size:13px; }
body[data-rhs="collapsed"] .rhs__toggle::before { content:""; margin:0; }
body[data-rhs="collapsed"] .rhs__toggle::after { content:"顯示背景"; }
body:not([data-rhs="collapsed"]) .rhs__toggle::before { content:"›"; margin-right:4px; }
body:not([data-rhs="collapsed"]) .rhs__toggle::after { content:"隱藏背景"; }

@media (max-width:1180px){
  .layout{grid-template-columns:minmax(0,200px) minmax(0,1fr);}
  .rhs{grid-column:1/-1;position:static;max-height:none;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));}
  .layout>.main{max-width:none;}
}
@media (max-width:920px){
  .layout{grid-template-columns:1fr;gap:var(--s6);}
  .lhs{position:static;max-height:none;border:1px solid var(--rule);border-radius:var(--radius);
       padding:var(--s4) var(--s5);background:var(--paper-raised);}
  .rhs{grid-template-columns:1fr;}
  .rhs__toggle{display:none;}
  .crumb{padding-top:var(--s3);}
  .site-nav-bio{gap:var(--s2);}
  /* the 三段 tier edge is the only tier cue left once names equalise — keep it wide
     enough to survive a narrow gutter */
  .pcard--tier-S{border-left-width:6px;}
  /* 人物頁：行動版隱藏卷次清單，讓人物導覽置頂，避免首篇傳記被埋 */
  .lhs.nav-vols .nav-lhs__title,
  .lhs.nav-vols .nav-vols__list{display:none;}
  .lhs.nav-vols .band-head{margin-top:var(--s4)!important;}
}

/* ---- breadcrumb (nav agent: nav.wrap.crumb, above .slip-head) ---- */
.crumb {
  display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--s2);
  padding-top:var(--s4); padding-bottom:var(--s2);
  font-family:var(--hei); font-size:var(--t-xs); letter-spacing:.08em; line-height:1.7;
}
.crumb__link { color:var(--ink-faint); text-decoration:none;
  border-bottom:1px solid transparent; transition:color .16s, border-color .16s; }
.crumb__link:hover { color:var(--vermilion); border-bottom-color:var(--vermilion-lo); }
.crumb__sep { color:var(--gold); user-select:none; }
.crumb__cur { color:var(--ink-soft); font-weight:600; }
/* the crumb absorbs the slab's top padding so the two do not double up */
.crumb + .slip-head .slip-head__inner { padding-top:var(--s7); }

/* ---- per-人物 nav strip at the foot of a 小傳 (nav agent: .site-nav-bio) ---- */
.site-nav-bio {
  display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--s2) var(--s3);
  margin-top:var(--s5); padding-top:var(--s4); border-top:1px dotted var(--rule-strong);
}
.site-nav-bio .crumb__sep { color:var(--ink-faint); }

/* ---- left nav list ---- */
.nav-lhs__title { font-size:var(--t-xs); font-weight:700; letter-spacing:.3em;
  color:var(--ink-faint); margin:0 0 var(--s3); padding-bottom:var(--s2); border-bottom:1px solid var(--rule); }
.nav-lhs ol { list-style:none; margin:0; padding:0; }
.nav-lhs li { margin-bottom:1px; }
.nav-lhs a { display:flex; align-items:baseline; gap:var(--s3); padding:var(--s2) var(--s3);
  text-decoration:none; font-size:var(--t-sm); color:var(--ink-soft);
  border-left:2px solid transparent; border-radius:0 var(--radius) var(--radius) 0;
  transition:background .18s, color .18s, border-left-color .18s; }
.nav-lhs a:hover { background:var(--accent-wash); color:var(--ink); border-left-color:var(--accent); }

/* ---- preview cards (紀 landing) ---- */
.plgrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:var(--s4); margin-top:var(--s5); }
.plcard { display:block; background:var(--paper-raised); border:1px solid var(--rule);
  border-top:3px solid oklch(0.55 0.12 var(--card-hue)); border-radius:var(--radius);
  padding:var(--s4) var(--s5); text-decoration:none!important; color:inherit;
  transition:transform .15s,box-shadow .15s,border-color .15s; }
.plcard:hover, .plcard:focus-visible { transform:translateY(-2px);
  box-shadow:0 6px 18px oklch(0.272 0.020 50 / 0.10); border-top-color:var(--vermilion); }
.plcard__name { font-family:var(--serif); font-size:var(--t-lg); font-weight:700; color:var(--ink); }
.plcard__title { font-family:var(--hei); font-size:var(--t-xs); color:var(--ink-2); margin-top:4px; }
.plcard__facts { list-style:none; padding:0; margin:var(--s3) 0 0; font-family:var(--hei); font-size:var(--t-sm); color:var(--ink-2); }
.plcard__facts li { padding:3px 0; border-top:1px dotted var(--rule); }
.plcard__facts li::before { content:"·"; margin-right:6px; color:var(--ink-3); }
/* P1#15: was vermilion @ opacity .6 → ~2.3:1. Rest state now carries its own
   AA-cleared colour and the vermilion is spent on the hover transition instead. */
.plcard__goto { display:inline-block; margin-top:var(--s3); font-family:var(--hei);
  font-size:var(--t-xs); letter-spacing:.08em; color:var(--ink-faint); transition:color .16s; }
.plcard:hover .plcard__goto, .plcard:focus-visible .plcard__goto { color:var(--vermilion); }

/* ---- people grid + full bio cards ---- */
.people-grid { display:grid; gap:var(--s6); }
/* base = C 級（一般）: the flattest rung of the tier ladder */
.pcard { background:var(--paper-raised); border:1px solid var(--rule);
  border-left:3px solid oklch(0.55 0.12 var(--card-hue) / 0.45); border-radius:var(--radius);
  padding:var(--s5) var(--s6); scroll-margin-top:var(--stick);
  transition:border-left-color .18s, box-shadow .18s; }
.pcard:target { box-shadow:0 0 0 2px var(--vermilion-lo), 0 6px 22px oklch(0.272 0.020 50 / 0.08); }
.pcard__head { display:flex; flex-direction:column; align-items:flex-start; gap:var(--s2); }
.pcard__name { font-family:var(--serif); font-size:var(--t-lg); font-weight:700;
  color:var(--ink); line-height:1.3; letter-spacing:.04em; }
.pcard__role { font-family:var(--hei); font-size:var(--t-sm); color:var(--ink-2); }
.pcard__summary { font-family:var(--hei); font-size:var(--t-md); line-height:1.8; color:var(--ink-1); margin:var(--s3) 0; }
.pcard__facts { list-style:none; padding:0; margin:var(--s3) 0 0; font-family:var(--hei); font-size:var(--t-sm); line-height:1.7; color:var(--ink-2); }
.pcard__facts li { padding:4px 0 4px 18px; position:relative; border-top:1px dotted var(--rule); }
.pcard__facts li:first-child { border-top:0; }
.pcard__facts li::before { content:"※"; position:absolute; left:0; top:4px; color:oklch(0.55 0.12 var(--card-hue)); font-weight:700; }
.band-head__sub { font-family:var(--hei); font-size:var(--t-sm); color:var(--ink-2); margin:var(--s2) 0 0; max-width:60ch; line-height:1.6; }
@media (max-width:720px){
  .plcard{padding:var(--s3) var(--s4);}
  .pcard{padding:var(--s4) var(--s5);}
  /* collapse the tier type-scale to one step — the coloured edge still carries it */
  .pcard__name,
  .pcard--tier-A .pcard__name,
  .pcard--tier-S .pcard__name{font-size:var(--t-lg);}
}

/* ---- biography sections ---- */
.pbio { display:grid; gap:var(--s6); margin-top:var(--s6); padding-top:var(--s6); border-top:1px solid var(--rule); }
.pbio__h { font-family:var(--hei); font-size:var(--t-sm); font-weight:600; letter-spacing:.12em;
  color:var(--vermilion); margin:0 0 var(--s2); padding-left:var(--s3);
  border-left:3px solid var(--vermilion); line-height:1.5; }
/* P1#5: cap line width. P1#16: 15px sat two steps below the site reading size
   while .pcard__summary above it ran at 20px — the actual 傳記 read as the least
   important text on the card. 1rem restores the ladder without breaking the cap. */
.pbio__sec p { margin:0 0 var(--s3); font-size:1rem; line-height:1.9; color:var(--ink);
  max-width:var(--measure); text-align:justify; text-justify:inter-ideograph; }
.pbio__sec p:last-child { margin-bottom:0; }
@media (max-width:920px){ .pbio{gap:var(--s5);} }

/* ---- impact tier markers (S=典範/A=重要/B=知名/C=一般) ----
   P1#17: the ladder used to be *only* border-width 6/4/3px — and the un-suffixed
   C card inherited the base 4px, so C and A were literally identical. Each rung
   now moves three things at once: edge weight, edge saturation, name size. */
.pcard--tier-B { border-left:4px solid oklch(0.55 0.12 var(--card-hue) / 0.70); }
.pcard--tier-A { border-left:5px solid oklch(0.55 0.12 var(--card-hue)); }
.pcard--tier-A .pcard__name { font-size:var(--t-xl); }
.pcard--tier-S {
  border-left:7px solid oklch(0.45 0.14 var(--card-hue));
  background:
    linear-gradient(180deg, oklch(0.55 0.12 var(--card-hue) / 0.05), transparent 180px),
    var(--paper-raised);
  box-shadow:0 2px 22px oklch(0.55 0.12 var(--card-hue) / 0.10);
}
.pcard--tier-S .pcard__name { font-size:var(--t-xl); letter-spacing:.06em; }
.pcard--tier-S .pcard__name::after {
  content:""; display:block; width:44px; height:2px; margin-top:var(--s2);
  background:oklch(0.55 0.12 var(--card-hue));
}

.pcard__badge { font-family:var(--hei); font-size:var(--t-xs); font-weight:700; letter-spacing:.08em;
  color:oklch(0.42 0.11 var(--card-hue)); background:oklch(0.96 0.03 var(--card-hue));
  border:1px solid oklch(0.86 0.05 var(--card-hue)); padding:2px 10px; border-radius:999px; white-space:nowrap; }
/* gap already spaces .pcard__head children — the extra margin double-counted */
.pcard__meta { display:flex; flex-wrap:wrap; align-items:center; gap:var(--s2) var(--s3); }
/* P1#18: 典範/重要 (tier label) now outranks the muted 一般/知名 by ink, not by a
   hardcoded grey. #9a9488 measured 2.62:1 — it failed AA at 12px. */
.pcard__tier { font-family:var(--hei); font-size:var(--t-xs); font-weight:600;
  color:var(--ink-soft); letter-spacing:.03em; white-space:nowrap; }
.pcard__tier--minor { color:var(--ink-faint); font-weight:500; }
.pcard__stars { color:var(--star); font-size:13px; letter-spacing:2px;
  white-space:nowrap; font-style:normal; }   /* P0#2: was #c8a13a (~2.3:1) */
.star-empty, .pcard__stars i, .legend__st i {
  color:var(--star-off); font-style:normal;  /* P2#9: unlit stars stay decorative */
}
.plcard__meta { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:2px 0; }
/* the 卷 landing cards reuse .pcard__tier / .pcard__stars — shrink them in place
   rather than keeping a parallel .plcard__* set the builder never emits */
.plcard__meta .pcard__tier { font-size:11px; }
.plcard__meta .pcard__stars { font-size:12px; letter-spacing:1px; }
.plcard__meta .pcard__badge { font-size:11px; padding:1px 8px; }

/* ---- 供參考：考古 / 正史新證 callout ---- */
.pbio__ref { margin-top:var(--s6); padding:var(--s4) var(--s5) var(--s5);
  background:oklch(0.97 0.02 var(--card-hue)); border:1px solid oklch(0.90 0.03 var(--card-hue));
  border-left:4px solid oklch(0.62 0.11 var(--card-hue)); border-radius:var(--radius); }
.pbio__ref-tag { display:inline-block; font-family:var(--hei); font-size:var(--t-xs); font-weight:700;
  letter-spacing:.12em; color:var(--paper-raised); background:oklch(0.52 0.11 var(--card-hue));
  padding:2px 11px; border-radius:999px; margin-bottom:var(--s3); }
.pbio__ref p { margin:0 0 10px; font-size:14px; line-height:1.85; color:var(--ink-1); text-align:justify; }
.pbio__ref p:last-child { margin-bottom:0; }

/* ============================================================
   史記 layer — text-specific chrome, prose, commentary, tables.
   Appended after style-core.css. Uses only core tokens.
   ============================================================ */

html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--song);
  font-size: var(--t-base);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-deep); }
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 var(--s6); }
@media (max-width: 720px) { .wrap { padding: 0 var(--s4); } }

/* ============ topbar ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: oklch(0.952 0.018 85 / 0.90);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner {
  max-width: 1480px; margin: 0 auto; padding: 0 var(--s6);
  height: 64px; display: flex; align-items: center; gap: var(--s6);
}
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: inherit; flex: none; }
.brand__mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  font-family: var(--song); font-size: 20px; font-weight: 700; line-height: 1;
  color: var(--paper-raised); background: var(--vermilion);
  border-radius: var(--radius); box-shadow: 0 1px 3px oklch(0.548 0.185 28 / 0.35);
}
.brand__txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand__txt b { font-family: var(--song); font-size: var(--t-md); font-weight: 700; letter-spacing: .06em; }
.brand__txt i { font-family: var(--hei); font-style: normal; font-size: 11px; letter-spacing: .22em; color: var(--ink-faint); }
.topnav { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.topnav a {
  font-family: var(--hei); font-size: var(--t-sm); text-decoration: none;
  color: var(--ink-soft); padding: 7px var(--s3); border-radius: var(--radius);
  transition: background .18s, color .18s;
}
.topnav a:hover { background: var(--paper-sunk); color: var(--ink); }
.topnav__hi { color: var(--vermilion) !important; font-weight: 600; }
.topnav__hi:hover { background: var(--vermilion-lo) !important; }
@media (max-width: 900px) {
  /* the bar wraps to two rows here — re-point the single sticky token at the
     taller chrome so #anchors do not land underneath it */
  :root { --topbar-h: 112px; }
  .topbar__inner { height: auto; padding: var(--s3) var(--s4); flex-wrap: wrap; gap: var(--s3); }
  .topnav { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap;
    scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { white-space: nowrap; padding: 6px var(--s2); }
}

/* ============ hero (index) ============ */
.hero {
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(1100px 420px at 50% -10%, oklch(0.720 0.095 80 / 0.14), transparent 70%),
    var(--paper);
}
.hero__inner { max-width: 900px; margin: 0 auto; padding: var(--s9) var(--s6) var(--s8); text-align: center; }
.hero__eyebrow { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .5em;
  color: var(--ink-faint); margin: 0 0 var(--s5); text-indent: .5em; }
.hero__title {
  font-family: var(--song); font-size: var(--t-4xl); font-weight: 700;
  letter-spacing: .22em; text-indent: .22em; margin: 0; line-height: 1.1; color: var(--ink);
}
.hero__sub { font-family: var(--kai); font-size: var(--t-md); color: var(--ink-soft);
  margin: var(--s4) 0 0; letter-spacing: .08em; }
.hero__rule { width: 72px; height: 2px; background: var(--vermilion); margin: var(--s6) auto; opacity: .8; }
.hero__quote { margin: 0 auto; max-width: 30em; }
.hero__quote p { font-family: var(--kai); font-size: var(--t-lg); line-height: 2;
  color: var(--ink); margin: 0; letter-spacing: .04em; }
.hero__quote cite { display: block; font-family: var(--hei); font-style: normal;
  font-size: var(--t-xs); letter-spacing: .2em; color: var(--ink-faint); margin-top: var(--s4); }
.hero__stats { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s6); margin-top: var(--s8); }
.stat { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .12em; color: var(--ink-faint); }
.stat b { display: block; font-family: var(--song); font-size: var(--t-xl);
  font-weight: 700; letter-spacing: normal; color: var(--vermilion); line-height: 1.2; margin-bottom: 2px; }
@media (max-width: 720px) {
  .hero__inner { padding: var(--s7) var(--s4) var(--s7); }
  .hero__title { font-size: var(--t-3xl); }
  .hero__quote p { font-size: var(--t-md); }
  .hero__stats { gap: var(--s5); }
}

/* ============ summary slab ============ */
.summary {
  position: relative; background: var(--slip); border: 1px solid var(--gold-lo);
  border-radius: var(--radius); padding: var(--s6) var(--s6) var(--s5);
  margin: var(--s7) 0 0;
}
/* P1#21: 980px of 20px 楷體 ran ~46 字/行. 900 lands it near 42. */
.summary--wide { max-width: 900px; margin: var(--s8) auto 0; }
.summary__tag {
  position: absolute; top: -11px; left: var(--s5);
  font-family: var(--hei); font-size: 11px; font-weight: 700; letter-spacing: .18em;
  color: var(--paper-raised); background: var(--gold-text);
  padding: 3px 12px; border-radius: 999px;
}
.summary p { margin: 0; font-family: var(--kai); font-size: var(--t-md);
  line-height: 2.05; color: var(--ink); text-align: justify; }
@media (max-width: 720px) { .summary { padding: var(--s5) var(--s4) var(--s4); } .summary p { font-size: var(--t-base); } }

/* ============ band heads ============ */
.band-head { text-align: center; margin: var(--s9) 0 var(--s6); }
.band-head__eyebrow { font-family: var(--hei); font-size: var(--t-xs);
  letter-spacing: .45em; color: var(--ink-faint); margin: 0 0 var(--s3); text-indent: .45em; }
.band-head h2 { font-family: var(--song); font-size: var(--t-2xl); font-weight: 700;
  letter-spacing: .1em; margin: 0; color: var(--ink); line-height: 1.3; }
.band-head__rule { width: 48px; height: 2px; background: var(--gold); margin: var(--s4) auto 0; }
.band-head[style*="left"] .band-head__sub,
.band-head[style*="left"] { text-align: left; }
@media (max-width: 720px) { .band-head { margin: var(--s7) 0 var(--s5); } .band-head h2 { font-size: var(--t-xl); } }

/* ============ 五體 cards (index) ============ */
.jgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s5); }
/* P0#20: the builder now emits .jcard > a.jcard__main > (.jcard__top, h3, p…)
   with .jcard__plink as a *sibling* of the link. The old `grid-template-columns:
   58px 1fr` therefore crushed the entire card body into a 58px column. The card
   is a vertical stack; .jcard__top is the row that carries the 序 plate. */
.jcard {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-top: 3px solid var(--accent); border-radius: var(--radius);
  padding: var(--s5) var(--s5) var(--s4);
  transition: transform .16s, box-shadow .16s, border-top-color .16s;
}
.jcard:hover, .jcard:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px oklch(0.272 0.020 50 / 0.09);
  border-top-color: var(--accent-deep);
}
.jcard__main { display: block; width: 100%; min-width: 0; flex: 1 1 auto;
  color: inherit; text-decoration: none; }
.jcard__top { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  margin-bottom: var(--s3); }
.jcard__ord {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: var(--radius);
  background: var(--accent-wash); border: 1px solid var(--accent-line);
  font-family: var(--song); font-size: var(--t-md); font-weight: 700;
  color: var(--accent-deep); line-height: 1; text-align: center;
}
/* 卷數 — a count, not a title: sans, tracked, quiet */
.jcard__n { font-family: var(--hei); font-size: var(--t-xs); font-weight: 600;
  letter-spacing: .18em; color: var(--ink-faint); }
.jcard__name { display: block; font-family: var(--song); font-size: var(--t-xl); font-weight: 700;
  letter-spacing: .08em; color: var(--ink); text-decoration: none;
  margin: 0; line-height: 1.25; transition: color .16s; }
.jcard:hover .jcard__name, .jcard:focus-within .jcard__name { color: var(--vermilion); }
.jcard__dyn { display: inline-block; width: fit-content;
  font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .12em;
  color: var(--accent-deep); background: var(--accent-wash);
  border: 1px solid var(--accent-line); padding: 2px 9px; border-radius: 999px;
  white-space: nowrap; margin: var(--s3) 0 0; }
.jcard__blurb { font-family: var(--hei); font-size: var(--t-sm); color: var(--ink-faint);
  margin: var(--s2) 0 0; letter-spacing: .04em; }
.jcard__sum { font-family: var(--kai); font-size: var(--t-base); line-height: 1.95;
  color: var(--ink-soft); margin: var(--s3) 0 0; text-align: justify;
  text-justify: inter-ideograph; }
.jcard__plink { display: inline-block; margin-top: var(--s4); font-family: var(--hei);
  font-size: var(--t-xs); letter-spacing: .08em; color: var(--vermilion); text-decoration: none;
  border-bottom: 1px solid var(--vermilion-lo); padding-bottom: 2px;
  transition: border-color .16s; }
.jcard__plink:hover { border-bottom-color: var(--vermilion); }
.jcard__plink--off { color: var(--ink-faint); border-bottom: 0; }
@media (max-width: 560px) {
  .jgrid { gap: var(--s4); }
  .jcard { padding: var(--s4); }
  .jcard__ord { width: 36px; height: 36px; font-size: var(--t-base); }
  .jcard__name { font-size: var(--t-lg); }
}

/* ============ guide ============ */
.guide { max-width: 980px; margin: 0 auto; }
.guide__intro { font-family: var(--kai); font-size: var(--t-md); line-height: 2;
  color: var(--ink); text-align: justify; margin: 0 0 var(--s6);
  max-width: var(--measure-wide); }
.guide__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s5); }
.gbox { background: var(--paper-raised); border: 1px solid var(--rule);
  border-left: 3px solid var(--gold); border-radius: var(--radius); padding: var(--s5); }
.gbox__h { font-family: var(--hei); font-size: var(--t-sm); font-weight: 700;
  letter-spacing: .16em; color: var(--gold-text); margin: 0 0 var(--s4); }
.gbox__list { margin: 0; padding-left: 1.35em; }
.gbox__list li { font-family: var(--hei); font-size: var(--t-sm); line-height: 1.85;
  color: var(--ink-soft); padding: var(--s2) 0; }
.gbox__list li + li { border-top: 1px dotted var(--rule); }
.gbox__list li b { color: var(--ink); font-weight: 700; }

/* ============ worldsnap ============ */
/* P1#21: t-base 楷體 across 980px was ~54 字/行 — the longest measure on the site */
.worldsnap {
  max-width: 820px; margin: var(--s7) auto 0;
  background: var(--paper-sunk); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: var(--s6);
}
.worldsnap__h { font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .28em; color: var(--ink-faint); margin: 0 0 var(--s4); }
.worldsnap p { margin: 0; font-family: var(--kai); font-size: var(--t-base);
  line-height: 2; color: var(--ink-soft); text-align: justify; }

/* ============ 凡例 ============ */
.fanli { max-width: 980px; margin: 0 auto; border-top: 1px solid var(--rule); }
.fanli__item { display: grid; grid-template-columns: 120px 1fr; gap: var(--s5);
  padding: var(--s4) var(--s2); border-bottom: 1px solid var(--rule); align-items: baseline; }
.fanli__k { font-family: var(--hei); font-size: var(--t-sm); font-weight: 700;
  letter-spacing: .12em; color: var(--vermilion); }
.fanli__v { font-family: var(--hei); font-size: var(--t-sm); line-height: 1.85;
  color: var(--ink-soft); max-width: 46em; }
.fanli__v b { color: var(--ink); }
.fanli__v a { color: var(--accent-deep); }
@media (max-width: 620px) { .fanli__item { grid-template-columns: 1fr; gap: var(--s2); } }

/* ============ slip-head (ji / juan) ============ */
.slip-head {
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(180deg, var(--accent-wash), transparent 72%),
    repeating-linear-gradient(90deg, transparent 0 calc(var(--slip-w) - 1px),
      var(--rule) calc(var(--slip-w) - 1px) var(--slip-w)),
    var(--paper-raised);
}
.slip-head__inner {
  max-width: 1480px; margin: 0 auto; padding: var(--s8) var(--s6) var(--s7);
  display: flex; align-items: center; gap: var(--s6);
}
.juan-plate {
  flex: none; width: 82px; height: 100px; display: grid; place-content: center; text-align: center;
  background: var(--accent-deep); color: var(--paper-raised); border-radius: var(--radius);
  box-shadow: 0 3px 14px oklch(0.385 0.095 var(--hue) / 0.30);
}
.juan-plate--red { background: var(--vermilion); box-shadow: 0 3px 14px oklch(0.548 0.185 28 / 0.32); }
.juan-plate__zi { font-family: var(--song); font-size: var(--t-md); letter-spacing: .12em; opacity: .82; }
.juan-plate__no { font-family: var(--song); font-size: var(--t-2xl); font-weight: 700; line-height: 1.1; }
.juan-lead { min-width: 0; }
.juan-lead__kicker { font-family: var(--hei); font-size: var(--t-xs);
  letter-spacing: .32em; color: var(--ink-faint); margin: 0 0 var(--s2); }
.juan-lead h1 { font-family: var(--song); font-size: var(--t-2xl); font-weight: 700;
  letter-spacing: .1em; margin: 0; line-height: 1.25; color: var(--ink); }
.juan-lead__span { font-family: var(--hei); font-size: var(--t-sm); color: var(--ink-soft);
  margin: var(--s3) 0 0; line-height: 1.7; max-width: 62ch; }
@media (max-width: 720px) {
  .slip-head__inner { padding: var(--s6) var(--s4); gap: var(--s4); }
  .juan-plate { width: 62px; height: 76px; }
  .juan-plate__no { font-size: var(--t-xl); }
  .juan-lead h1 { font-size: var(--t-xl); }
}

/* ============ volume list (ji page) ============ */
.vlist { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.vrow {
  display: grid; grid-template-columns: 62px 1fr auto; align-items: baseline; gap: var(--s4);
  padding: var(--s4) var(--s3); border-bottom: 1px solid var(--rule);
  text-decoration: none; color: inherit; transition: background .16s, box-shadow .16s;
}
/* P2#22: the old hover shifted padding-left, which reflowed all three columns
   under the cursor. An inset rule reads the same and costs no layout. */
.vrow:hover, .vrow:focus-visible { background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent); }
.vrow__no { font-family: var(--song); font-size: var(--t-md); font-weight: 700;
  color: var(--accent-deep); letter-spacing: .04em; }
.vrow__name { font-family: var(--song); font-size: var(--t-md); color: var(--ink); letter-spacing: .04em; }
.vrow__meta { font-family: var(--hei); font-size: var(--t-xs); color: var(--ink-faint); white-space: nowrap; }
.vrow__go { font-family: var(--hei); font-size: var(--t-xs); color: var(--vermilion); opacity: 0; transition: opacity .16s; }
.vrow:hover .vrow__go, .vrow:focus-visible .vrow__go { opacity: 1; }
@media (max-width: 620px) {
  .vrow { grid-template-columns: 46px 1fr; gap: var(--s3); }
  .vrow__meta, .vrow__go { grid-column: 2; font-size: 11px; }
}

/* ============ left nav variants ============ */
.nav-lhs__empty { font-family: var(--hei); font-size: var(--t-sm); color: var(--ink-faint); padding: var(--s2) var(--s3); }
.nav-lhs a .n { flex: none; min-width: 2.2em; font-family: var(--song);
  font-size: var(--t-xs); color: var(--ink-faint); text-align: right; }
.nav-lhs a:hover .n { color: var(--accent-deep); }
/* accept any aria-current value — the nav agent emits aria-current="page" */
.nav-lhs a.on, .nav-lhs a[aria-current] {
  background: var(--accent-wash); color: var(--ink); border-left-color: var(--vermilion); font-weight: 600;
}
.nav-vols__list { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: var(--s5); }
.nv { font-family: var(--hei); font-size: 11px; color: var(--ink-faint); text-decoration: none;
  padding: 2px 6px; border: 1px solid var(--rule); border-radius: var(--radius); white-space: nowrap; }
.nv:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-wash); }
.nav-people ol { list-style: none; margin: 0; padding: 0; }
.nav-people a { display: flex; align-items: baseline; gap: var(--s2); padding: 5px var(--s3);
  text-decoration: none; border-left: 2px solid transparent; transition: all .18s; }
.nav-people a:hover { background: var(--accent-wash); border-left-color: var(--accent); }
.np__n { font-family: var(--song); font-size: var(--t-sm); color: var(--ink); white-space: nowrap; }
.np__t { font-family: var(--hei); font-size: 11px; color: var(--ink-faint); }
.mlink { font-family: var(--hei); font-size: var(--t-xs); color: var(--vermilion); text-decoration: none; }
.mlink:hover { text-decoration: underline; }

/* ============ prose (juan body) ============ */
.prose { max-width: var(--measure); margin: 0 auto; }
.prose > p, .pz__p {
  font-family: var(--song); font-size: var(--t-md); line-height: 2.15;
  color: var(--ink); margin: 0 0 var(--s5); text-align: justify;
  text-justify: inter-ideograph; letter-spacing: .01em;
}
.prose > p:first-of-type::first-letter { font-size: 1.05em; }
.pz {
  font-family: var(--song); font-size: var(--t-lg); font-weight: 700; letter-spacing: .12em;
  color: var(--ink); margin: var(--s8) 0 var(--s5); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--rule); scroll-margin-top: var(--stick);
}
.pz::before { content: "◇"; color: var(--accent); margin-right: .5em; font-size: .7em; vertical-align: .18em; }
.prose > .pz:first-child { margin-top: 0; }
/* jumping in from the 本卷章節 rail should say where you landed */
.pz:target { border-bottom-color: var(--vermilion); }
.pz:target::before { color: var(--vermilion); }
@media (max-width: 720px) { .prose > p, .pz__p { font-size: var(--t-base); line-height: 2.05; } }

/* ============ 太史公曰 (vermilion) vs 索隱述贊 (grey) ============ */
.cmt {
  position: relative; margin: var(--s6) 0; padding: var(--s5) var(--s5) var(--s4) var(--s6);
  background: var(--vermilion-lo); border: 1px solid oklch(0.548 0.185 28 / 0.20);
  border-left: 4px solid var(--vermilion); border-radius: var(--radius);
}
.cmt__tag { display: inline-block; font-family: var(--hei); font-size: 11px; font-weight: 700;
  letter-spacing: .18em; color: var(--paper-raised); background: var(--vermilion);
  padding: 2px 11px; border-radius: 999px; margin-bottom: var(--s3); }
.cmt p { margin: 0 0 var(--s3); font-family: var(--kai); font-size: var(--t-md);
  line-height: 2.1; color: var(--ink); text-align: justify; }
.cmt p:last-child { margin-bottom: 0; }
.sy {
  margin: var(--s6) 0; padding: var(--s4) var(--s5);
  background: var(--paper-sunk); border: 1px solid var(--rule);
  border-left: 4px solid var(--ink-faint); border-radius: var(--radius);
}
.sy__tag { display: inline-block; font-family: var(--hei); font-size: 11px; font-weight: 700;
  letter-spacing: .16em; color: var(--ink-faint); border: 1px solid var(--rule-strong);
  padding: 2px 10px; border-radius: 999px; margin-bottom: var(--s3); }
.sy p { margin: 0 0 6px; font-family: var(--kai); font-size: var(--t-base);
  line-height: 1.95; color: var(--ink-soft); text-align: justify; }
.sy p:last-child { margin-bottom: 0; }

/* ============ tables (十表) ============ */
.tblwrap {
  margin: var(--s6) 0; overflow-x: auto; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--paper-raised);
  -webkit-overflow-scrolling: touch;
}
.tbl { border-collapse: collapse; width: 100%; min-width: 520px;
  font-family: var(--hei); font-size: var(--t-sm); }
.tbl th, .tbl td {
  border: 1px solid var(--rule); padding: var(--s2) var(--s3);
  text-align: left; vertical-align: top; line-height: 1.7; color: var(--ink);
}
.tbl th { background: var(--accent-wash); font-weight: 700; color: var(--accent-deep);
  white-space: nowrap; position: sticky; top: 0; }
.tbl tbody tr:nth-child(even) { background: oklch(0.272 0.020 50 / 0.025); }
.tbl tbody tr:hover { background: var(--accent-wash); }
.tbl td:first-child { font-family: var(--song); color: var(--ink-soft); white-space: nowrap; }
/* 表 pages read wider than the 35em prose measure */
.prose:has(.tblwrap) { max-width: none; }

/* ============ RHS panels ============ */
.ctx, .jj, .legend {
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: var(--s5);
}
.ctx__h, .jj__h, .legend__h {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700; letter-spacing: .22em;
  color: var(--ink-faint); margin: 0 0 var(--s4); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--rule);
}
.ctx__h--sub { margin-top: var(--s5); }
.ctx__dl { margin: 0; font-family: var(--hei); font-size: var(--t-sm); }
.ctx__dl dt { font-weight: 700; color: var(--accent-deep); letter-spacing: .08em;
  font-size: var(--t-xs); margin-top: var(--s3); }
.ctx__dl dt:first-child { margin-top: 0; }
.ctx__dl dd { margin: 3px 0 0; color: var(--ink-soft); line-height: 1.75; }
/* P0#23: the builder emits <ul class="ctx__world"> now, not <p> — without a
   reset the UA bullet + 40px indent broke out of the 320px RHS rail. */
.ctx__world { font-family: var(--hei); font-size: var(--t-sm); line-height: 1.8;
  color: var(--ink-soft); margin: 0; padding: 0; list-style: none; }
.ctx__world li { position: relative; padding-left: 1.05em; margin-top: var(--s2); }
.ctx__world li:first-child { margin-top: 0; }
.ctx__world li::before { content: "·"; position: absolute; left: .15em;
  color: var(--gold-text); font-weight: 700; }
.ctx__link { display: inline-block; margin-top: var(--s4); font-family: var(--hei);
  font-size: var(--t-xs); color: var(--vermilion); text-decoration: none; }
.ctx__link:hover { text-decoration: underline; }
.jj { background: var(--slip); border-color: var(--gold-lo); }
.jj__h { color: var(--gold-text); border-bottom-color: var(--gold-lo); }
.jj p { margin: 0 0 var(--s3); font-family: var(--kai); font-size: var(--t-base);
  line-height: 1.95; color: var(--ink); text-align: justify; }
.jj p:last-child { margin-bottom: 0; }
.legend__list { list-style: none; margin: 0; padding: 0; font-family: var(--hei); font-size: var(--t-sm); }
.legend__list li { display: flex; align-items: baseline; gap: var(--s3);
  padding: 6px 0; border-top: 1px dotted var(--rule); color: var(--ink-soft); }
.legend__list li:first-child { border-top: 0; }
/* the legend spells the scale out with <i>☆</i> for the unlit half — without a
   rule those rendered italic and at full star weight, flattening the whole scale */
.legend__st { color: var(--star); font-size: 12px; letter-spacing: 1px;
  white-space: nowrap; flex: none; min-width: 5.4em; font-style: normal; }
.legend__note { font-family: var(--hei); font-size: 11px; line-height: 1.7;
  color: var(--ink-faint); margin: var(--s3) 0 0; padding-top: var(--s3); border-top: 1px solid var(--rule); }

/* ============ 太史公曰 輯覽 ============ */
.tsg {
  margin: var(--s6) 0; background: var(--paper-raised); border: 1px solid var(--rule);
  border-left: 4px solid var(--vermilion); border-radius: var(--radius);
  padding: var(--s5) var(--s6); scroll-margin-top: var(--stick);
  transition: box-shadow .18s;
}
/* 太史公曰 stays vermilion everywhere; the 體 hue only tints the head rule, so a
   171-entry scroll still reads as five groups without stealing the signature red */
.tsg__head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap;
  margin-bottom: var(--s4); padding-bottom: var(--s3);
  border-bottom: 1px dotted var(--accent-line); }
.tsg:hover { box-shadow: 0 4px 18px oklch(0.272 0.020 50 / 0.06); }
.tsg:target { box-shadow: 0 0 0 2px var(--vermilion-lo); }
.tsg__no { font-family: var(--hei); font-size: 11px; font-weight: 700; letter-spacing: .1em;
  color: var(--paper-raised); background: var(--vermilion); padding: 2px 10px;
  border-radius: 999px; white-space: nowrap; }
.tsg__name { font-family: var(--song); font-size: var(--t-md); font-weight: 700;
  color: var(--ink); letter-spacing: .05em; text-decoration: none; }
.tsg__name:hover { color: var(--vermilion); }
.tsg__body p { margin: 0 0 var(--s3); font-family: var(--kai); font-size: var(--t-base);
  line-height: 2.05; color: var(--ink); text-align: justify;
  text-justify: inter-ideograph; max-width: var(--measure-wide); }
.tsg__body p:last-child { margin-bottom: 0; }
@media (max-width: 720px) { .tsg { padding: var(--s4) var(--s5); } }

/* ============ pager ============ */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4);
  padding: var(--s7) 0 var(--s9); }
.pager__prev, .pager__next {
  display: flex; flex-direction: column; gap: 4px; padding: var(--s4) var(--s5);
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; color: inherit; transition: border-color .16s, transform .16s, box-shadow .16s;
}
.pager__next { text-align: right; }
.pager__prev:hover, .pager__next:hover {
  border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 14px oklch(0.272 0.020 50 / 0.07);
}
.dir { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .14em; color: var(--vermilion); }
.who { font-family: var(--song); font-size: var(--t-base); color: var(--ink); letter-spacing: .04em; }
.pager--off { opacity: .55; background: transparent; border-style: dashed; }
.pager--off:hover { transform: none; box-shadow: none; border-color: var(--rule); }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager__next { text-align: left; } }

/* ============ footer ============ */
.foot { margin-top: var(--s9); border-top: 1px solid var(--rule);
  background: var(--paper-sunk); padding: var(--s8) var(--s6) var(--s5); }
.foot__inner { max-width: 1480px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s6); }
.foot__h { font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .22em; color: var(--ink-faint); margin: 0 0 var(--s3); }
.foot__p { font-family: var(--hei); font-size: var(--t-sm); line-height: 1.85;
  color: var(--ink-soft); margin: 0 0 var(--s3); }
.foot__p--dim { color: var(--ink-faint); font-size: var(--t-xs); }
.foot__list { list-style: none; margin: 0; padding: 0; }
.foot__list li { padding: 3px 0; }
.foot__list a { font-family: var(--hei); font-size: var(--t-sm);
  color: var(--ink-soft); text-decoration: none; }
.foot__list a:hover { color: var(--vermilion); }
.foot__rule { max-width: 1480px; margin: var(--s6) auto var(--s4); height: 1px; background: var(--rule); }
.foot__legal { max-width: 1480px; margin: 0 auto; font-family: var(--hei);
  font-size: 11px; letter-spacing: .1em; color: var(--ink-faint); text-align: center; }
.foot__legal code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; }

/* ============ misc ============ */
::selection { background: var(--vermilion-lo); }
:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; border-radius: var(--radius); }
/* cards own their own offset so the ring does not sit on top of the card edge */
.jcard:focus-within, .plcard:focus-visible, .pcard:focus-within { outline-offset: 3px; }

/* ============ print — 130 卷 is a reading site; let people print a 卷 ============ */
@media print {
  :root { --paper: #fff; --paper-raised: #fff; --paper-sunk: #fff; --slip: #fff; }
  .topbar, .lhs, .rhs, .rhs__toggle, .pager, .foot, .crumb, .site-nav-bio { display: none !important; }
  body { background: #fff; font-size: 11pt; line-height: 1.7; }
  .layout { display: block; padding: 0; }
  .layout > .main { max-width: none; }
  .slip-head { background: none; border-bottom: 1px solid var(--rule); }
  .slip-head__inner, .wrap { padding: 0; }
  .prose, .prose > p, .pz__p, .tsg__body p, .pbio__sec p { max-width: none; }
  .pz, .pcard, .tsg { break-inside: avoid; }
  .cmt, .sy, .pbio__ref, .summary { break-inside: avoid; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}

/* ============================================================
   Reading-enrichment modules (hover tags · 名句 · 亮點)
   Self-contained: defines the gold helper vars + tooltip it needs.
   ============================================================ */
:root {
  --gold-deep: #8a5e12;     /* darker gold for fine text/borders */
  --gold-soft: #f6e8c6;     /* hover wash */
  --gold-line: rgba(192,138,30,.45);
  /* tooltip arrow + theme category hue (overridable per-element) */
  --arrow-x: 50%;
  --arrow-bottom: -7px;
  --arrow-top: auto;
  --cat-hue: 30;
  --chue: 30;
  --mhue: 30;
}

/* ---- hover glossary term / famous-quote 'tags' (Module A) ---- */
.term {
  border-bottom: 1px dotted var(--gold-deep);
  cursor: help; color: inherit; transition: background .15s;
}
.term:hover, .term:focus { background: var(--gold-soft); outline: none; }
.q-famous {
  background: linear-gradient(180deg,#fbeec4,#f3dd9c); color: #5a3d00;
  border-radius: 3px; padding: 0 3px; cursor: help;
  box-shadow: inset 0 -1px 0 var(--gold-line); transition: background .15s;
}
.q-famous:hover, .q-famous:focus { background: linear-gradient(180deg,#fff0c2,#eccf7a); outline: none; }

/* tooltip (positioned by site.js) */
#anno-tip {
  position: fixed; z-index: 9999; max-width: 320px;
  background: #241405; color: #f6ecd8;
  border: 1px solid var(--gold); border-radius: 9px;
  padding: 10px 13px;
  font-family: var(--hei); font-size: 13px; line-height: 1.75;
  box-shadow: 0 10px 34px rgba(0,0,0,.42);
  pointer-events: none; opacity: 0; transition: opacity .14s;
}
#anno-tip.show { opacity: 1; }
#anno-tip::after {
  content: ""; position: absolute; left: var(--arrow-x,50%); transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  bottom: var(--arrow-bottom,-7px); top: var(--arrow-top,auto);
  border-top: 7px solid var(--gold);
}
#anno-tip.below::after { border-top: 0; border-bottom: 7px solid var(--gold); }

/* annotation toggle bar (字詞註) */
#anno-ctrl { position: fixed; right: 14px; bottom: 14px; z-index: 9998;
  display: flex; gap: 6px; background: var(--paper-raised);
  border: 1px solid var(--rule); border-radius: 999px; padding: 5px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10); font-family: var(--hei); }
#anno-ctrl button { font: inherit; font-size: 12px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft);
  border-radius: 999px; padding: 3px 10px; }
#anno-ctrl button.is-off { opacity: .5; text-decoration: line-through; }
body.no-anno .term { border-bottom: none; cursor: auto; background: none; }
body.no-anno .q-famous { background: none; box-shadow: none; cursor: auto; color: inherit; }
body.no-anno #anno-tip { display: none; }

/* ---- 人物亮點 callout (Module C) ---- */
.pcard__highlight { display:flex; gap:10px; align-items:flex-start;
  margin: var(--s4) 0 var(--s2); padding: 10px 14px;
  background: oklch(0.97 0.02 var(--card-hue));
  border: 1px solid oklch(0.90 0.03 var(--card-hue));
  border-left: 3px solid oklch(0.55 0.11 var(--card-hue)); border-radius: var(--radius); }
.pcard__highlight-tag { font-family: var(--hei); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; color: oklch(0.45 0.11 var(--card-hue)); white-space: nowrap; margin-top: 3px; }
.pcard__highlight-txt { font-family: var(--song); font-size: 14px; line-height: 1.7; color: var(--ink-1); }

/* ---- 名句 / 名言 (Module B) ---- */
.pbio__quotes { margin: var(--s5) 0 var(--s3); }
.pbio__quotes-h { font-family: var(--hei); font-size: 13px; font-weight: 600; letter-spacing: .12em;
  color: var(--gold-text); margin: 0 0 10px; padding-left: 11px; border-left: 3px solid var(--gold); }
.pbio__quote { margin: 0 0 var(--s4); padding: var(--s4) var(--s5);
  background: linear-gradient(180deg,#fbf3da,#f6e7bd);
  border: 1px solid var(--gold-line); border-left: 4px solid var(--gold); border-radius: var(--radius); }
.pbio__quote-text { font-family: var(--kai); font-size: 1.05rem; line-height: 1.95; color: #5a3d00; margin: 0; text-align: justify; }
.pbio__quote-anno { font-family: var(--hei); font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.7; }
.pbio__quote-src { display: block; font-family: var(--hei); font-style: normal; font-size: 12px; color: var(--ink-faint); margin-top: 6px; }

/* ---- RHS 人物亮點 aggregate (Module D) ---- */
.panel--gold { border-top-color: var(--gold); }
.hl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.hl-list li a { display: block; text-decoration: none; color: var(--ink-soft); font-size: var(--t-sm); line-height: 1.6; }
.hl-list li b { font-family: var(--song); color: var(--ink); font-weight: 700; }
.hl-list li a:hover { color: var(--vermilion); }

/* ============================================================
   主題閱讀 (themes.html + themes/*.html)
   Modelled on the 資治通鑑 theme section; mapped to 史記 tokens.
   ============================================================ */
.slip-head--theme { background:
    radial-gradient(120% 90% at 15% 0%, oklch(0.55 0.11 var(--hue) / 0.10), transparent 60%),
    linear-gradient(180deg, oklch(0.965 0.02 85), oklch(0.94 0.02 85)); }
.slip-head--theme .slip-head__inner { display: flex; align-items: center; gap: var(--s6); flex-wrap: wrap; }
.slip-head--theme .juan-lead__kicker { color: oklch(0.50 0.13 var(--hue)); }
.slip-head--theme h1 { font-size: clamp(2rem, 5vw, var(--t-3xl)); letter-spacing: .1em; }

/* left category nav */
.nav-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-cats a { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s3);
  text-decoration: none; font-size: var(--t-sm); color: var(--ink-soft);
  border-left: 2px solid transparent; border-radius: 0 var(--radius) var(--radius) 0; transition: all .2s; }
.nav-cats a:hover { background: var(--accent-wash); border-left-color: var(--accent); color: var(--ink); }
.nav-cats .nl__name { font-family: var(--song); font-size: var(--t-base); font-weight: 700; color: var(--ink); }
.nav-cats .nl__date { font-family: var(--hei); font-size: 11px; letter-spacing: .08em; color: var(--ink-faint); }

/* section + grid */
.tsec { margin-top: var(--s9); scroll-margin-top: 100px; }
.tsec__desc { font-size: var(--t-sm); line-height: 1.9; color: var(--ink-soft); margin: var(--s2) 0 0; max-width: 60ch; }
.tsec .band-head { text-align: left; align-items: flex-start; margin-bottom: var(--s5); }
.tsec .band-head h2 { color: oklch(0.45 0.13 var(--cat-hue, 30)); letter-spacing: .1em; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s5); margin-top: var(--s5); }
.tcard { display: block; background: var(--paper-raised); border: 1px solid var(--rule);
  border-top: 3px solid oklch(0.55 0.12 var(--card-hue, 30)); border-radius: var(--radius);
  padding: var(--s5); text-decoration: none!important; color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s; }
.tcard:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.09); border-top-color: var(--vermilion); }
.tcard__cat { font-family: var(--hei); font-size: 10.5px; letter-spacing: .18em; color: oklch(0.45 0.13 var(--card-hue, 30)); }
.tcard h3 { font-family: var(--song); font-size: var(--t-lg); font-weight: 900; color: var(--ink);
  margin: 6px 0 8px; line-height: 1.4; }
.tcard p { font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft); margin: 0 0 var(--s3); }
.tcard__era { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .1em; color: var(--ink-faint); }

/* guide band + statgrid (reuse for theme intro) */
.guide-band { margin-bottom: var(--s7); }
.guide-block { margin-bottom: var(--s7); }
.guide-block:last-child { margin-bottom: 0; }
.guide-block__head { font-family: var(--hei); font-size: 13px; font-weight: 700; letter-spacing: .14em;
  color: var(--vermilion); display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.guide-block__head::before { content: ""; width: 22px; height: 2px; background: var(--vermilion); }
.guide-intro { font-family: var(--hei); font-size: var(--t-md); line-height: 1.9; color: var(--ink-1); margin: 0; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-bottom: var(--s5); }
.statgrid .stat { text-align: center; background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: var(--s4) var(--s2); }
.statgrid .stat b { display: block; font-family: var(--hei); font-size: var(--t-xl); font-weight: 900; color: var(--accent-deep); line-height: 1; }
.statgrid .stat span { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .2em; color: var(--ink-faint); }

/* theme article prose (themes/*.html) */
.theme-prose { max-width: 70ch; margin: 0 auto; }
.theme-prose > h2 { font-family: var(--song); font-size: var(--t-lg); font-weight: 900; color: var(--ink);
  margin: var(--s7) 0 var(--s3); padding-left: 12px; border-left: 4px solid var(--accent); }
.theme-prose > h3 { font-family: var(--hei); font-size: var(--t-md); font-weight: 700; color: var(--vermilion); margin: var(--s6) 0 var(--s2); }
.theme-prose > p { font-family: var(--song); font-size: 1.05rem; line-height: 1.95; color: var(--ink);
  margin: 0 0 var(--s4); text-align: justify; }
.theme-prose .pull { font-family: var(--kai); font-size: 1.2rem; line-height: 1.9; color: var(--accent-deep);
  border-left: 3px solid var(--gold); background: linear-gradient(180deg,#fbf3da,#f6e7bd);
  padding: var(--s4) var(--s5); margin: var(--s5) 0; border-radius: var(--radius); }
.theme-prose .xref { font-family: var(--hei); font-size: var(--t-sm); color: var(--ink-soft);
  background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: var(--radius);
  padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.theme-prose .xref a { color: var(--accent-deep); }

@media (max-width: 920px) { .tgrid { grid-template-columns: 1fr; } }

/* ===================== 主題閱讀 · 補齊模組 ===================== */
/* 主題 mark（頭圖左側方印） */
.theme-mark { width: 92px; height: 92px; border-radius: var(--radius);
  background: linear-gradient(135deg, oklch(0.95 0.02 var(--mhue,30)), var(--paper-raised));
  border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  box-shadow: 0 2px 0 var(--gold-lo); }
.theme-mark__cat { font-family: var(--hei); font-weight: 700; font-size: var(--t-xs);
  letter-spacing: .22em; color: oklch(0.50 0.11 var(--mhue,30)); writing-mode: vertical-rl; }

/* 主題正文（theme-body） */
.theme-body .theme-h { font-family: var(--song); font-size: var(--t-xl); font-weight: 900;
  color: var(--accent-deep); margin: var(--s7) 0 var(--s4); padding-bottom: var(--s2);
  border-bottom: 2px solid var(--gold); position: relative; }
.theme-body .theme-h::before { content: ""; position: absolute; left: 0; bottom: -2px;
  width: 52px; height: 2px; background: var(--vermilion); }
.theme-body p { font-size: var(--t-md); line-height: 2.15; color: var(--ink); margin: 0 0 var(--s5); }
.tlink { color: var(--accent-deep); font-weight: 700; text-decoration: none;
  border-bottom: 1.5px solid var(--gold); padding-bottom: 1px; }
.tlink:hover { color: var(--vermilion); border-bottom-color: var(--vermilion); }

/* 左欄：主題導覽（個別主題頁） */
.nav-theme__cat { font-family: var(--hei); font-size: 10.5px; font-weight: 700; letter-spacing: .2em;
  color: oklch(0.50 0.11 var(--chue,30)); margin: var(--s4) 0 var(--s2) var(--s2); padding-top: var(--s3); }
.nav-theme__cat:first-child { margin-top: 0; padding-top: 0; }
.nav-theme__item { display: block; padding: var(--s2) var(--s3); font-size: var(--t-sm);
  color: var(--ink-soft); text-decoration: none; border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0; margin-left: var(--s2); }
.nav-theme__item:hover { background: var(--accent-wash); border-left-color: var(--accent); color: var(--ink); }
.nav-theme__item.is-current { background: var(--accent-wash); border-left-color: var(--vermilion);
  color: var(--accent-deep); font-weight: 700; }

/* 右欄：相關卷次 / 關聯主題 */
.tref-list { display: grid; gap: var(--s2); }
.tref { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s3);
  background: var(--paper-sunk); border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none;
  transition: border-color .15s; }
.tref:hover { border-color: var(--accent); }
.tref__no { font-family: var(--hei); font-weight: 700; color: var(--accent-deep); flex: 0 0 auto; font-size: var(--t-sm); }
.tref__span { font-family: var(--song); font-size: var(--t-xs); color: var(--ink-soft); line-height: 1.5; }
.trel-list { display: grid; gap: var(--s1); }
.trel { display: block; font-size: var(--t-sm); color: var(--accent-deep); text-decoration: none;
  padding: var(--s3) 0; border-bottom: 1px dashed var(--rule); }
.trel:hover { color: var(--vermilion); }

/* 右欄面板（通用） */
.panel { background: var(--paper-raised); border: 1px solid var(--rule);
  border-top: 3px solid var(--accent); border-radius: var(--radius);
  padding: var(--s5); box-shadow: 0 2px 0 var(--gold-lo); }
.panel__title { font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .3em; color: var(--ink-faint); margin: 0 0 var(--s4);
  padding-bottom: var(--s3); border-bottom: 1px solid var(--rule); }
.panel__lede { margin: 0 0 var(--s4); font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft); }
.panel--vermilion { border-top-color: var(--vermilion); }
.panel--vermilion .jingjian-text { font-family: var(--kai); font-size: var(--t-md); line-height: 2.1;
  color: oklch(0.300 0.045 30); text-indent: 2em; margin: 0; }

/* landing 頭圖 */
.slip-head--site { text-align: left; }
.slip-head--site .slip-head__inner { max-width: 1180px; margin: 0 auto; padding: var(--s9) var(--s5); }
.slip-head__l { display: flex; flex-direction: column; gap: var(--s3); }
.slip-head__kicker { margin: 0; font-family: var(--hei); font-size: var(--t-sm); font-weight: 700;
  letter-spacing: .14em; color: var(--accent-deep); }
.slip-head__title { font-family: var(--song); font-size: clamp(1.7rem, 4.4vw, var(--t-3xl));
  font-weight: 900; color: var(--ink); letter-spacing: .04em; line-height: 1.3; margin: 0; }

@media (max-width: 720px) {
  .theme-mark { width: 64px; height: 64px; }
  .theme-body p { font-size: var(--t-base); }
}
