/* ============================================================
   《淮南子》閱讀網站 — 設計系統 (Manuscript Ink, Youth Edition)
   OKLCH 色彩 · 暖宣紙底 · 漆墨字 · 朱砂點睛 · 每章一色
   所有發出的 class 都在此定義（構建後做 class-coverage diff）。
   ============================================================ */

:root {
  /* 色彩 —— 統一 OKLCH，不混 HSL */
  --paper:        oklch(0.965 0.015 85);   /* 宣紙 */
  --paper-2:      oklch(0.952 0.022 85);   /* 卡面 */
  --paper-3:      oklch(0.938 0.028 85);   /* 更深卡面 */
  --ink:          oklch(0.30 0.020 60);    /* 漆墨（暖黑）*/
  --ink-soft:     oklch(0.42 0.020 60);    /* 次級文字 */
  --ink-faint:    oklch(0.52 0.020 60);    /* 弱化文字 — 4.81:1 on --paper-2（AA） */
  --line:         oklch(0.74 0.022 80);    /* 分隔線（純裝飾，非狀態指示） */
  --vermilion:    oklch(0.55 0.180 25);    /* 朱砂（點睛層）*/
  --vermilion-w:  oklch(0.55 0.180 25 /.10);
  --gold:         oklch(0.72 0.110 75);
  --star:         #8a6500;                 /* ★ 對比 4.6:1 */
  --star-empty:   #d6c9a8;

  /* accent 由每頁 --card-hue 注入；此處為 fallback（暖金）*/
  --card-hue:     35;
  --accent:       oklch(0.50 0.140 var(--card-hue));
  --accent-deep:  oklch(0.45 0.120 var(--card-hue));
  --accent-wash:  oklch(0.55 0.140 var(--card-hue) /.10);
  --accent-line:  oklch(0.55 0.140 var(--card-hue) /.32);

  /* 字體 */
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans:  "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* 字階 1.2–1.333 */
  --t-sm:   0.82rem;
  --t-base: 1rem;
  --t-lg:   1.18rem;
  --t-xl:   1.5rem;
  --t-2xl:  2.15rem;   /* 所有頂層頁 h1 統一尺寸 */
  --t-hero: 3rem;      /* 僅首頁 hero */

  /* 空間（基準 4/8）*/
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 72px;

  --radius: 10px; --radius-lg: 18px;
  --measure: 35em;     /* 正文行寬上限 */

  --serif-ink: var(--serif);
  --ink-1: var(--ink-soft);
  --ink-2: var(--ink-faint);
  --ink-3: var(--ink-faint);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;            /* 網頁正文 ≥16px */
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }
.muted { color: var(--ink-faint); }
.serif { font-family: var(--serif); }
.center { text-align: center; }
.measure { max-width: var(--measure); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--s5); }

/* ---------- 頂欄 (4 tabs) ---------- */
.topbar {
  background: oklch(0.22 0.02 60);
  color: var(--paper);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid oklch(0.30 0.02 60);
}
.topbar__inner {
  max-width: 1120px; margin: 0 auto; padding: var(--s3) var(--s5);
  display: flex; align-items: center; gap: var(--s4);
}
.topbar__brand {
  font-family: var(--serif); font-weight: 700; font-size: var(--t-lg);
  color: var(--paper); letter-spacing: .08em; white-space: nowrap;
}
.topbar__brand:hover { color: var(--gold); }
.topbar__nav { margin-left: auto; display: flex; gap: var(--s2); }
.topbar__nav a {
  color: oklch(0.82 0.02 80); font-family: var(--sans);
  font-size: var(--t-sm); letter-spacing: .14em; padding: var(--s2) var(--s3);
  border-radius: var(--radius); transition: background .15s, color .15s;
}
.topbar__nav a:hover { color: var(--paper); background: oklch(0.30 0.02 60); }
.topbar__nav a.is-current {
  color: var(--paper); background: var(--accent);
  font-weight: 600;
}
.topbar__toggle {
  display: none; margin-left: auto; background: none; border: 1px solid oklch(0.4 0.02 60);
  color: var(--paper); border-radius: var(--radius); padding: var(--s2) var(--s3);
  font-size: var(--t-sm); cursor: pointer; font-family: var(--sans);
}

/* ---------- 頂層頁 masthead（統一居中）---------- */
.masthead {
  text-align: center; padding: var(--s8) var(--s5) var(--s6);
}
.masthead__eyebrow {
  font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .34em;
  color: var(--accent-deep); text-transform: none; margin: 0 0 var(--s3);
}
.masthead__title {
  font-family: var(--serif); font-weight: 900; font-size: var(--t-2xl);
  margin: 0; line-height: 1.15; letter-spacing: .04em;
}
.masthead__sub {
  font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft);
  max-width: 60ch; margin: var(--s4) auto 0; line-height: 1.7;
}
.masthead__rule {
  width: 64px; height: 3px; margin: var(--s5) auto 0;
  background: linear-gradient(90deg, var(--vermilion), transparent);
  border-radius: 2px;
}

/* ---------- 首頁 hero（水墨 + 朱砂印）---------- */
.hero-cover {
  position: relative; margin: var(--s5) var(--s5) 0; padding: var(--s8) var(--s6);
  border-radius: var(--radius-lg); overflow: hidden; isolation: isolate;
  background:
    radial-gradient(120% 90% at 80% -10%, oklch(0.55 0.10 200 /.14), transparent 60%),
    radial-gradient(90% 80% at 12% 110%, oklch(0.55 0.12 35 /.14), transparent 55%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  box-shadow: 0 18px 50px -28px oklch(0.30 0.02 60 /.5);
}
.hero-cover::before {  /* 水墨遠山 */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 38% at 18% 86%, oklch(0.55 0.03 220 /.18), transparent 70%),
    radial-gradient(48% 30% at 52% 92%, oklch(0.50 0.03 230 /.16), transparent 70%),
    radial-gradient(40% 26% at 82% 88%, oklch(0.60 0.04 200 /.14), transparent 70%);
  opacity: .9;
}
.hero-cover > * { position: relative; z-index: 1; }
.hero__seal { position: absolute; top: var(--s5); right: var(--s5); z-index: 2; width: 76px; height: 76px; opacity: .92; }
.hero__title {
  font-family: var(--serif); font-weight: 900; font-size: var(--t-hero);
  margin: 0; letter-spacing: .06em; line-height: 1.05;
}
.hero__sub { font-family: var(--sans); font-size: var(--t-lg); color: var(--ink-soft); margin: var(--s3) 0 0; }
.hero__blurb { max-width: 56ch; margin: var(--s5) 0 0; font-size: var(--t-base); line-height: 1.85; }
.hero__quote {
  margin: var(--s6) 0 0; padding: var(--s4) var(--s5); border-left: 3px solid var(--vermilion);
  background: var(--vermilion-w); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--t-lg); font-style: normal; color: var(--ink);
}
.hero__by { display: block; margin-top: var(--s2); font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); }
.btn-cta {
  display: inline-block; margin-top: var(--s6); font-family: var(--sans); font-weight: 600;
  letter-spacing: .1em; font-size: var(--t-base); color: var(--paper);
  background: var(--accent-deep); padding: var(--s3) var(--s6); border-radius: 999px;
  border: 0; cursor: pointer; transition: transform .15s, background .15s;
}
.btn-cta:hover { transform: translateY(-2px); background: var(--accent); color: var(--paper); }

/* ---------- 通用 band / section ---------- */
.section { padding: var(--s7) 0; }
.section--band { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section__head { text-align: center; margin-bottom: var(--s6); }
.section__eyebrow { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .28em; color: var(--accent-deep); }
.section__title { font-family: var(--serif); font-weight: 800; font-size: var(--t-xl); margin: var(--s2) 0 0; }
.section__sub { font-family: var(--sans); color: var(--ink-soft); max-width: 60ch; margin: var(--s3) auto 0; font-size: var(--t-base); }

/* ---------- 統計 ---------- */
.stat-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s6); margin-top: var(--s4); }
.stat { text-align: center; }
.stat__num { font-family: var(--serif); font-weight: 800; font-size: var(--t-xl); color: var(--accent-deep); }
.stat__label { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); letter-spacing: .1em; }

/* ---------- 導讀 / 指南 ---------- */
.guide { max-width: var(--measure); margin: 0 auto; }
.guide__p { margin: 0 0 var(--s4); }
.keymsg, .howto { list-style: none; padding: 0; margin: var(--s4) 0 0; max-width: var(--measure); }
.keymsg li, .howto li {
  position: relative; padding: var(--s3) var(--s4) var(--s3) var(--s6); margin-bottom: var(--s3);
  background: var(--paper-2); border-radius: var(--radius); border: 1px solid var(--line);
  font-family: var(--sans); font-size: var(--t-base); line-height: 1.7;
}
.keymsg li::before, .howto li::before {
  content: ""; position: absolute; left: var(--s4); top: var(--s5);
  width: 7px; height: 7px; border-radius: 50%; background: var(--vermilion);
}

/* ---------- 叢集地圖（知識星圖）---------- */
.chapter-map { display: grid; gap: var(--s5); }
.cmap-cluster {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--s5); border-left: 4px solid var(--accent);
}
.cmap-cluster__head { display: flex; align-items: baseline; flex-wrap: wrap; }
.cmap-cluster__name { font-family: var(--serif); font-weight: 800; font-size: var(--t-lg); }
.cmap-cluster__desc { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); margin-left: var(--s3); }
.cmap-chips { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.cchip {
  font-family: var(--sans); font-size: var(--t-base); text-decoration: none;
  padding: var(--s2) var(--s4); border-radius: 999px;
  background: oklch(0.55 0.14 var(--card-hue) /.12); color: oklch(0.42 0.12 var(--card-hue));
  border: 1px solid oklch(0.55 0.14 var(--card-hue) /.32); transition: transform .12s, background .12s;
}
.cchip:hover { transform: translateY(-2px); background: oklch(0.55 0.14 var(--card-hue) /.22); }
.cchip b { font-family: var(--serif); font-weight: 700; margin-right: var(--s2); }

/* ---------- 篇目表 ---------- */
.ctable { width: 100%; border-collapse: collapse; margin-top: var(--s4); }
.ctable td { padding: var(--s4) var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
.ctable__num { font-family: var(--serif); font-weight: 700; color: var(--accent-deep); width: 3.2em; white-space: nowrap; }
.ctable__name { font-family: var(--serif); font-weight: 700; font-size: var(--t-lg); width: 8em; }
.ctable__name a { color: var(--ink); }
.ctable__name a:hover { color: var(--accent-deep); }
.ctable__blurb { font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); }

/* ---------- 閱讀頁 ---------- */
.reader { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: var(--s6); align-items: start; }
.reader__main { min-width: 0; }
.reader__main p.z { font-family: var(--serif); font-size: var(--t-base); line-height: 2; margin: 0 0 var(--s4); text-align: justify; }
.reader__aside { position: sticky; top: 88px; display: grid; gap: var(--s4); }
.aside-panel { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.aside-panel__head { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .18em; color: var(--accent-deep); margin: 0 0 var(--s2); }
.aside-panel__body { font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); line-height: 1.7; }
.aside-panel__body .row { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s1) 0; border-bottom: 1px dashed var(--line); }
.aside-panel__body .row:last-child { border-bottom: 0; }

/* 本篇名句 */
.fame { margin-top: var(--s6); }
.fame__head { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .2em; color: var(--vermilion); margin: 0 0 var(--s3); }
.fame__item { background: var(--paper-2); border: 1px solid var(--line); border-left: 3px solid var(--vermilion); border-radius: 0 var(--radius) var(--radius) 0; padding: var(--s4); margin-bottom: var(--s3); }
.fame__text { font-family: var(--serif); font-size: var(--t-lg); font-weight: 600; }
.fame__anno { font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); margin-top: var(--s2); }

/* pager */
.pager { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s7); }
.pager a {
  font-family: var(--sans); font-size: var(--t-base); color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px;
  padding: var(--s3) var(--s5); transition: background .12s, transform .12s;
}
.pager a:hover { background: var(--accent-wash); transform: translateY(-2px); }
.pager a span { display: block; font-size: var(--t-sm); color: var(--ink-faint); }

/* ---------- 人物（分類模型）---------- */
.people-cat { margin-bottom: var(--s8); }
.people-cat__head { display: flex; align-items: baseline; gap: var(--s3); border-bottom: 2px solid var(--accent); padding-bottom: var(--s3); margin-bottom: var(--s5); }
.people-cat__name { font-family: var(--serif); font-weight: 800; font-size: var(--t-xl); color: var(--accent-deep); }
.people-cat__desc { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); }
.pcard {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--s5); margin-bottom: var(--s5); border-left: 4px solid var(--accent);
}
.pcard--tier-S { border-left-width: 6px; }
.pcard--tier-A { border-left-width: 4px; }
.pcard--tier-B { border-left-width: 3px; }
.pcard--tier-C { border-left-width: 3px; opacity: .96; }
.pcard__head { display: flex; flex-direction: column; gap: var(--s2); }
.pcard__name { font-family: var(--serif); font-weight: 800; font-size: var(--t-xl); line-height: 1.2; }
.pcard__title { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); }
.pcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); font-family: var(--sans); font-size: var(--t-sm); }
.pcard__tier { color: var(--accent-deep); font-weight: 700; letter-spacing: .08em; }
.pcard__badge { background: var(--vermilion); color: #fff; font-weight: 700; padding: 1px var(--s3); border-radius: 999px; letter-spacing: .1em; }
.pcard__stars { color: var(--star); letter-spacing: 1px; }
.star-empty { color: var(--star-empty); }
.pcard__role { color: var(--ink-faint); }
.pcard__summary { font-family: var(--serif); font-size: var(--t-lg); margin: var(--s4) 0; line-height: 1.75; }
.pcard__facts { margin: 0 0 var(--s4); padding-left: 1.1em; font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); }
.pcard__facts li { margin-bottom: var(--s2); }
.pcard__highlight { background: var(--accent-wash); border-radius: var(--radius); padding: var(--s3) var(--s4); margin: var(--s4) 0; font-family: var(--sans); font-size: var(--t-base); }
.pcard__highlight b { color: var(--accent-deep); font-family: var(--sans); }
.pbio { margin-top: var(--s4); }
.pbio__sec { margin-bottom: var(--s4); }
.pbio__h { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .16em; color: var(--accent-deep); margin: 0 0 var(--s2); }
.pbio__p { font-family: var(--serif); font-size: var(--t-base); line-height: 1.95; max-width: var(--measure); margin: 0; text-align: justify; }
.pcard__quotes { margin-top: var(--s4); border-top: 1px dashed var(--line); padding-top: var(--s4); }
.pbio__quote { margin: 0 0 var(--s3); }
.pbio__quote-text { font-family: var(--serif); font-size: var(--t-lg); font-weight: 600; }
.pbio__quote-anno { font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); margin-top: var(--s1); }
.pbio__quote-src { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); margin-top: var(--s1); }
.pbio__ref { background: var(--vermilion-w); border-left: 3px solid var(--vermilion); border-radius: 0 var(--radius) var(--radius) 0; padding: var(--s3); margin-top: var(--s4); font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); }

/* ---------- 主題卡片 ---------- */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s5); }
.tcard {
  display: block; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--s5); text-decoration: none; color: inherit;
  border-top: 4px solid var(--accent); transition: transform .14s, box-shadow .14s;
}
.tcard:hover { transform: translateY(-4px); box-shadow: 0 16px 36px -22px oklch(0.30 0.02 60 /.5); color: inherit; }
.tcard__cat { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .16em; color: var(--accent-deep); }
.tcard__title { font-family: var(--serif); font-weight: 800; font-size: var(--t-lg); margin: var(--s2) 0 0; line-height: 1.3; }
.tcard__sub { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); margin: var(--s2) 0 var(--s3); }
.tcard__summary { font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft); line-height: 1.7; }

/* 主題頁內文 */
.theme-body { max-width: var(--measure); margin: 0 auto; }
.theme-body p { font-family: var(--serif); font-size: var(--t-base); line-height: 2; margin: 0 0 var(--s4); text-align: justify; }
/* 主題深入頁的長文區（G2 依 .prose.theme-body 統計字數） */
.prose.theme-body { margin: 0 auto var(--s5); }
.theme-meta { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; margin: var(--s5) 0; font-family: var(--sans); font-size: var(--t-sm); }
.theme-meta .chip { background: var(--accent-wash); color: var(--accent-deep); padding: var(--s1) var(--s4); border-radius: 999px; border: 1px solid var(--accent-line); }
.trel, .tref { margin-top: var(--s6); }
.trel__h, .tref__h { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .18em; color: var(--vermilion); margin: 0 0 var(--s3); }
.trel a, .tref a { display: inline-block; font-family: var(--sans); font-size: var(--t-base); margin: 0 var(--s3) var(--s3) 0; padding: var(--s2) var(--s4); background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
.trel a:hover, .tref a:hover { background: var(--accent-wash); }

/* ---------- 頁腳 ---------- */
.foot { background: oklch(0.22 0.02 60); color: oklch(0.82 0.02 80); margin-top: var(--s8); padding: var(--s6) 0; }
.foot__inner { max-width: 1120px; margin: 0 auto; padding: 0 var(--s5); text-align: center; font-family: var(--sans); font-size: var(--t-sm); line-height: 1.9; }
.foot__links { margin-top: var(--s3); display: flex; gap: var(--s4); justify-content: center; flex-wrap: wrap; }
.foot__links a { color: oklch(0.82 0.02 80); }
.foot__links a:hover { color: var(--gold); }

/* ---------- 響應式 ---------- */
@media (max-width: 920px) {
  .topbar__nav { display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: oklch(0.22 0.02 60); padding: var(--s3) var(--s5); gap: var(--s1); }
  .topbar__nav.is-open { display: flex; }
  .topbar__toggle { display: block; }
  .reader { grid-template-columns: 1fr; }
  .reader__aside { position: static; }
  .hero-cover { margin: var(--s4) var(--s4) 0; padding: var(--s6) var(--s5); }
  .hero__title { font-size: 2.2rem; }
  .masthead { padding: var(--s6) var(--s4) var(--s5); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .tcard { padding: var(--s4); }
  .pcard { padding: var(--s4); }
}

/* ============================================================
   READING LAYOUT + MODULES A–F                    (added v2)
   3-column grid, hover glossary, 白話譯文, toggles.
   Uses the OKLCH tokens above — no hex accents, no hsl().
   ============================================================ */

:root {
  /* aliases so the canonical module class names can use familiar tokens */
  --paper-raised: var(--paper-2);
  --paper-sunk:   var(--paper-3);
  --rule:         var(--line);
  --hei:          var(--sans);
  --song:         var(--serif);
  --gold-deep:    oklch(0.55 0.105 75);
  --gold-lo:      oklch(0.68 0.100 75);
  --gold-soft:    oklch(0.86 0.075 82);
  --gold-line:    oklch(0.72 0.110 75 /.45);
  --s9:           96px;
  --t-xs:         0.72rem;
}

/* ---- 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(--s7) 0 var(--s8);
  max-width: 1480px;
  margin: 0 auto;
}
.layout > .main { min-width: 0; max-width: 880px; margin: 0 auto; width: 100%; }
.lhs {
  position: sticky; top: 88px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  font-family: var(--hei);
}
.rhs {
  position: sticky; top: 88px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  display: grid; gap: var(--s5); align-content: start;
}

/* RHS collapsible (site.js sets body[data-rhs="collapsed"]) — Module D */
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: 88px; z-index: 5;
  align-self: start; justify-self: end;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--hei); font-size: 12px; cursor: pointer;
  color: var(--ink-soft); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; white-space: nowrap;
}
.rhs__toggle:hover {
  background: var(--vermilion); color: var(--paper);
  border-color: var(--vermilion);
}
body:not([data-rhs="collapsed"]) .rhs__toggle::before { content: "›"; margin-right: 4px; }
body:not([data-rhs="collapsed"]) .rhs__toggle::after  { content: "隱藏背景"; }
body[data-rhs="collapsed"] .rhs__toggle {
  position: static; margin: var(--s5) auto 0; justify-self: center;
  width: 44px; 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: "顯示背景"; }

/* ---- left nav (章 table of contents) ---- */
.nav-lhs__title {
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .28em;
  color: var(--ink-faint); margin: 0 0 var(--s3);
  padding-bottom: var(--s2); border-bottom: 1px solid var(--line);
}
.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: 3px;
  transition: background .15s, color .15s;
}
.nav-lhs a:hover {
  background: var(--accent-wash); color: var(--ink);
  border-left-color: var(--accent);
}
.nav-lhs a.is-current {
  background: var(--accent-wash); color: var(--ink);
  border-left-color: var(--accent); font-weight: 700;
}
.nav-lhs__n { color: var(--ink-faint); font-size: var(--t-xs); min-width: 2.2em; }
.nav-lhs__x { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- RHS panels ---- */
.panel {
  background: var(--paper-2); border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
}
.panel--gold { border-top-color: var(--gold); }
.panel__title {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .22em; color: var(--ink-faint);
  margin: 0 0 var(--s3);
}
.panel__body { font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft); }
.panel__body p { margin: 0 0 var(--s3); }
.panel__body p:last-child { margin-bottom: 0; }

/* ---- RHS 人物亮點 aggregate (Module C) ---- */
.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.65;
}
.hl-list li b { font-family: var(--song); color: var(--ink); font-weight: 700; }
.hl-list li a:hover { color: var(--vermilion); }

/* ---- hover glossary term / famous quote (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: var(--gold-soft); color: oklch(0.38 0.075 70);
  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: oklch(0.90 0.085 84); outline: none; }

/* tooltip (positioned by site.js) */
#anno-tip {
  position: fixed; z-index: 9999; max-width: 320px;
  background: oklch(0.24 0.030 60); color: oklch(0.94 0.020 85);
  border: 1px solid var(--gold); border-radius: 9px;
  padding: 10px 13px; font-family: var(--hei); font-size: 13px;
  line-height: 1.7; pointer-events: none; opacity: 0;
  transition: opacity .12s;
}
#anno-tip.show { opacity: 1; }

/* control bar: 繁/簡 · 字詞註 · 白話 */
#anno-ctrl {
  position: fixed; right: 14px; bottom: 14px; z-index: 9998;
  display: flex; gap: 6px; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 8px; box-shadow: 0 3px 14px oklch(0.30 0.02 60 /.16);
}
#anno-ctrl button {
  font: inherit; font-family: var(--hei); font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-soft); border-radius: 999px; padding: 3px 10px;
}
#anno-ctrl button:hover { border-color: var(--accent); color: var(--ink); }
#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; }
body.no-baihua .zhang__baihua { display: none; }

/* ---- 章 (paragraph unit) ---- */
.zhang { margin: 0 0 var(--s6); scroll-margin-top: 96px; }
.zhang__no {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .18em; color: var(--ink-faint);
  margin: 0 0 var(--s2); display: flex; align-items: baseline; gap: var(--s3);
}
.zhang__t {
  font-family: var(--serif); font-size: var(--t-lg); line-height: 2.05;
  color: var(--ink); margin: 0; max-width: var(--measure);
  text-align: justify;
}
.zhang__speaker { color: var(--accent); font-weight: 700; letter-spacing: .1em; }

/* ---- 白話 + 解讀 (Module E) ---- */
.zhang__baihua {
  margin: var(--s4) 0 0; max-width: var(--measure);
  padding: var(--s3) var(--s4);
  background: color-mix(in oklch, var(--gold-soft) 26%, var(--paper));
  border-left: 3px solid var(--gold-lo);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.zhang__line { margin: 0 0 var(--s2); font-family: var(--hei);
  font-size: 0.95rem; line-height: 1.9; color: var(--ink-soft); }
.zhang__line:last-child { margin-bottom: 0; }
.zhang__baihua-label, .zhang__interp-label {
  display: inline-block; font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .16em; color: var(--gold-deep);
  margin-right: var(--s3); vertical-align: 1px;
}
.zhang__interp-label { color: var(--vermilion); }
.zhang__baihua-text { color: var(--ink); }
.zhang__interp-text { color: var(--ink-soft); }

/* ---- 異文校記 ---- */
.appa {
  margin: var(--s3) 0 0; max-width: var(--measure);
  font-family: var(--hei); font-size: var(--t-sm);
  color: var(--ink-faint); line-height: 1.8;
}
.appa__tag {
  display: inline-block; font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .16em; color: var(--vermilion); margin-right: var(--s3);
}
.appa__var { margin: 0; }

/* ---- inline person cross-link ---- */
.charlink {
  color: var(--gold-deep); text-decoration: none;
  border-bottom: 1px solid var(--gold-line);
}
.charlink:hover { color: var(--vermilion); border-bottom-color: var(--vermilion); }

/* ---- people page additions ---- */
.pcard__highlight-tag {
  display: inline-block; font-family: var(--hei); font-size: var(--t-xs);
  font-weight: 700; letter-spacing: .16em; color: var(--vermilion);
  margin-right: var(--s3);
}
.pcard__highlight-txt { color: var(--ink); }
.pbio__quotes { margin-top: var(--s5); }
.pbio__quotes-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); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.pcard__tier--minor { opacity: .62; }
.pcard__wc {
  font-family: var(--hei); font-size: var(--t-xs);
  color: var(--ink-faint); letter-spacing: .1em; margin-left: var(--s3);
}

/* ---- theme deep-dive additions ---- */
.srcq {
  margin: var(--s4) 0; padding: var(--s3) var(--s5);
  border-left: 3px solid var(--accent);
  background: var(--accent-wash); border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--serif); font-size: var(--t-lg); line-height: 1.95;
  color: var(--ink);
}
.srcq__src {
  display: block; margin-top: var(--s2); font-family: var(--hei);
  font-size: var(--t-xs); letter-spacing: .12em; color: var(--ink-faint);
  font-style: normal;
}
.tsec { margin: 0 0 var(--s7); }
.tsec__h {
  font-family: var(--serif); font-size: var(--t-xl); color: var(--ink);
  margin: 0 0 var(--s4); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.tsub {
  display: grid; gap: var(--s4);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: var(--s5) 0;
}
.tsub__card {
  background: var(--paper-2); border: 1px solid var(--line);
  border-top: 3px solid var(--accent); border-radius: var(--radius);
  padding: var(--s4) var(--s5); text-decoration: none; display: block;
}
.tsub__card:hover { background: var(--paper-3); }
.tsub__n {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .2em; color: var(--accent);
}
.tsub__t {
  font-family: var(--serif); font-size: var(--t-lg);
  color: var(--ink); margin: var(--s2) 0;
}
.tsub__d { font-size: var(--t-sm); color: var(--ink-soft); line-height: 1.75; }
.tmap { width: 100%; border-collapse: collapse; margin: var(--s5) 0;
  font-size: var(--t-sm); }
.tmap th, .tmap td {
  border: 1px solid var(--line); padding: var(--s3) var(--s4);
  text-align: left; vertical-align: top; line-height: 1.7;
}
.tmap th {
  background: var(--paper-3); font-family: var(--hei);
  font-size: var(--t-xs); letter-spacing: .14em; color: var(--ink-soft);
}
.tflow {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  margin: var(--s5) 0; font-family: var(--hei); font-size: var(--t-sm);
}
.tflow__node {
  background: var(--paper-2); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: var(--s2) var(--s4); color: var(--ink);
}
.tflow__arrow { color: var(--accent); font-weight: 700; }
.tcmp { display: grid; gap: var(--s4); grid-template-columns: 1fr 1fr;
  margin: var(--s5) 0; }
.tcmp__col {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
}
.tcmp__h {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .16em; margin: 0 0 var(--s3); color: var(--accent);
}
.tcmp__col p { margin: 0; font-size: var(--t-sm); line-height: 1.8;
  color: var(--ink-soft); }
.tpolicy {
  background: var(--paper-3); border: 1px solid var(--line);
  border-left: 3px solid var(--vermilion);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--s4) var(--s5); margin: var(--s5) 0;
}
.tpolicy__h {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .18em; color: var(--vermilion); margin: 0 0 var(--s3);
}
.tpolicy ul { margin: 0; padding-left: 1.3em; }
.tpolicy li { font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft);
  margin-bottom: var(--s2); }

/* ---- guide / 404 ---- */
.guide__sec { margin: 0 0 var(--s7); max-width: var(--measure); }
.guide__h {
  font-family: var(--serif); font-size: var(--t-xl); color: var(--ink);
  margin: 0 0 var(--s3);
}
.nf { text-align: center; padding: var(--s8) var(--s4); }
.nf__code {
  font-family: var(--serif); font-size: 5rem; font-weight: 700;
  color: var(--accent); line-height: 1; margin: 0;
}
.nf__msg { font-size: var(--t-lg); color: var(--ink-soft); margin: var(--s4) 0 var(--s6); }

/* ---- reading-page responsive ---- */
@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; }
  .rhs__toggle { display: none; }
  body[data-rhs="collapsed"] .layout { grid-template-columns: minmax(0,200px) minmax(0,1fr); }
  body[data-rhs="collapsed"] .rhs { width: auto; min-width: 0; }
  body[data-rhs="collapsed"] .rhs > *:not(.rhs__toggle) { display: block; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: var(--s6); }
  .lhs {
    position: static; max-height: none;
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s4) var(--s5); background: var(--paper-2);
  }
  .rhs { grid-template-columns: 1fr; }
  .tcmp { grid-template-columns: 1fr; }
}

/* ============================================================
   主題深讀 — hub + 子頁結構 (G8 所需類別，全 OKLCH)
   ============================================================ */

/* ---- 主題頁 hub 區塊（注入 themes/tNN.html）---- */
.theme-hub { margin: var(--s7) 0 0; padding: var(--s6) 0 0;
  border-top: 2px solid var(--accent-line); }
.theme-hub__intro { max-width: var(--measure); margin: 0 auto var(--s6);
  font-family: var(--serif); font-size: var(--t-lg); line-height: 2;
  color: var(--ink-soft); text-align: justify; }

/* ---- 子頁卡片（hub 內，連往 tNN{a,b,c}.html）---- */
.subcards { display: grid; gap: var(--s5);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: var(--s5) 0; }
.subcard { display: block; background: var(--paper-2); border: 1px solid var(--line);
  border-top: 3px solid var(--accent); border-radius: var(--radius);
  padding: var(--s5); text-decoration: none; color: var(--ink);
  transition: background .15s ease; }
.subcard:hover { background: var(--paper-3); }
.subcard__k { font-family: var(--sans); font-size: var(--t-xs); letter-spacing: .2em;
  color: var(--accent-deep); margin: 0 0 var(--s2); }
.subcard__t { font-family: var(--serif); font-size: var(--t-lg); font-weight: 600;
  margin: 0 0 var(--s2); }
.subcard__d { font-family: var(--sans); font-size: var(--t-sm); line-height: 1.8;
  color: var(--ink-soft); margin: 0; }

/* ---- 關係 / 組織圖 ---- */
.org { margin: var(--s6) 0; padding: var(--s5); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--radius); }
.org__h { font-family: var(--sans); font-size: var(--t-xs); letter-spacing: .2em;
  color: var(--ink-faint); margin: 0 0 var(--s4); }
.org__nodes { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.org__node { font-family: var(--sans); font-size: var(--t-sm); padding: var(--s2) var(--s4);
  background: var(--accent-wash); border: 1px solid var(--accent-line);
  border-radius: 999px; color: var(--accent-deep); }
.org__edge { color: var(--ink-faint); font-family: var(--sans); }

/* ---- 對照表 ---- */
.maptable { width: 100%; border-collapse: collapse; margin: var(--s5) 0; font-size: var(--t-sm); }
.maptable th, .maptable td { border: 1px solid var(--line); padding: var(--s3) var(--s4);
  text-align: left; vertical-align: top; line-height: 1.7; }
.maptable th { background: var(--paper-3); font-family: var(--sans);
  font-size: var(--t-xs); letter-spacing: .14em; color: var(--ink-soft); }
.maptable td b { color: var(--accent-deep); }

/* ---- 子頁：中文數字區塊標題 ---- */
.theme-h { font-family: var(--serif); font-size: var(--t-xl); color: var(--ink);
  margin: var(--s7) 0 var(--s4); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line); }
.theme-h:first-of-type { margin-top: 0; }

/* ---- 解讀 callout ---- */
.insight { margin: var(--s5) 0; padding: var(--s4) var(--s5);
  border-left: 3px solid var(--gold); background: oklch(0.72 0.110 75 /.12);
  border-radius: 0 var(--radius) var(--radius) 0; }
.insight__h { font-family: var(--sans); font-size: var(--t-xs); letter-spacing: .2em;
  color: oklch(0.55 0.105 75); margin: 0 0 var(--s2); font-weight: 700; }
.insight__b { font-family: var(--serif); font-size: var(--t-base); line-height: 1.9;
  color: var(--ink); margin: 0; }

/* ---- 流程圖 ---- */
.flow { margin: var(--s5) 0; display: grid; gap: var(--s4);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.flow__step { background: var(--paper-2); border: 1px solid var(--line);
  border-top: 3px solid var(--accent); border-radius: var(--radius); padding: var(--s4) var(--s5); }
.flow__n { font-family: var(--sans); font-size: var(--t-xs); color: var(--accent-deep);
  letter-spacing: .15em; margin: 0 0 var(--s2); }
.flow__t { font-family: var(--serif); font-weight: 600; font-size: var(--t-base); margin: 0 0 var(--s1); }
.flow__d { font-family: var(--sans); font-size: var(--t-sm); line-height: 1.7; color: var(--ink-soft); margin: 0; }

/* ---- 對比專欄 ---- */
.cmp { margin: var(--s5) 0; display: grid; gap: var(--s5); grid-template-columns: 1fr 1fr; }
.cmp__col { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s4) var(--s5); }
.cmp__col h4 { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .12em;
  margin: 0 0 var(--s3); color: var(--accent-deep); }
.cmp__col p { font-family: var(--serif); font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft);
  margin: 0 0 var(--s3); }
.cmp__col p:last-child { margin-bottom: 0; }
@media (max-width: 640px) { .cmp { grid-template-columns: 1fr; } }

/* ---- 子頁導讀頭 ---- */
.juan-lead { text-align: center; max-width: 56em; margin: 0 auto var(--s6); }
.juan-lead__kicker { font-family: var(--sans); font-size: var(--t-sm); letter-spacing: .28em;
  color: var(--accent-deep); margin: 0 0 var(--s3); }
.juan-lead__title { font-family: var(--serif); font-size: var(--t-2xl); font-weight: 700;
  color: var(--ink); margin: 0 0 var(--s3); line-height: 1.3; }
.juan-lead__sub { font-family: var(--sans); font-size: var(--t-base); color: var(--ink-soft);
  margin: 0; line-height: 1.8; }
