@charset "UTF-8";

/* =========================================================
   《資治通鑑》閱讀站
   Direction: 黄卷朱批 — imperial manuscript, vermilion-brush commentary.
   Warm rice paper / lacquer ink / 朱砂 vermilion (臣光曰) / 赭金 gold (chrome).
   Deliberately a sibling of 華杉講透孫子兵法 (玄漆简牍): same "physical
   classical artifact" family, opposite temperature and chrome —
   cool bamboo + bronze there, warm scroll + gold here.
   ========================================================= */

: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 — 臣光曰 panel */

  --ink:          oklch(0.272 0.020 50);    /* warm lacquer ink */
  --ink-soft:     oklch(0.430 0.022 50);
  --ink-faint:    oklch(0.520 0.020 50);   /* AA-cleared on all paper tones */

  --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);    /* 朱砂 — 臣光曰 + active state */
  --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);
  --gold-text:    oklch(0.640 0.095 80);    /* gold lifted for small text on ink */

  /* ---- 每紀色相（各頁覆写 --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 對齊） */
  --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;
  --slip-w: 58px;          /* manuscript column pitch */
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

/* descendants that override --hue must re-declare the accents */
.jcard, .vrow, .gcase {
  --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: 92px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--song);
  font-size: var(--t-base);
  line-height: 1.95;
  color: var(--ink);
  background-color: var(--paper);
  /* faint vertical ruling — the page reads as a bound manuscript */
  background-image: repeating-linear-gradient(90deg,
    transparent 0 calc(var(--slip-w) - 1px),
    oklch(0.272 0.020 50 / 0.030) calc(var(--slip-w) - 1px) var(--slip-w));
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--song); font-weight: 900; text-wrap: balance; line-height: 1.4; margin: 0; }

a { color: var(--accent-deep); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: var(--vermilion); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--vermilion); color: #fff; padding: var(--s3) var(--s5);
  font-family: var(--hei); font-size: var(--t-sm);
}
.skip:focus { left: 0; }

/* =========================================================
   導覽 — 漆金橫楣
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--ink);
  border-bottom: 1px solid var(--gold);
  box-shadow: 0 1px 0 oklch(0.720 0.095 80 / 0.35);
}
.topbar__inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: stretch; justify-content: space-between;
  gap: var(--s4); padding: 0 var(--s5);
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--s3);
  color: var(--paper); text-decoration: none;
  font-size: var(--t-md); font-weight: 900; letter-spacing: .16em;
  padding: var(--s3) 0;
}
.topbar__brand:hover { color: var(--gold-text); }
.topbar__brand .mark {
  font-family: var(--hei); font-size: var(--t-sm); font-weight: 700; letter-spacing: .08em;
  border: 1px solid var(--gold); color: var(--paper);
  padding: 2px var(--s2); border-radius: var(--radius);
}
.nav { display: flex; align-items: stretch; font-family: var(--hei); font-size: var(--t-sm); }
.nav a {
  display: flex; align-items: center; padding: 0 var(--s4);
  color: oklch(0.952 0.018 85 / 0.80); text-decoration: none;
  letter-spacing: .12em; transition: background .2s, color .2s;
}
.nav a:hover, .nav a[aria-current="page"] { background: var(--vermilion); color: #fff; }

.nav__group { position: relative; display: flex; }
.nav__panel {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  min-width: 460px;
  display: none; grid-template-columns: repeat(2, 1fr);
  background: var(--ink);
  border: 1px solid var(--rule-strong); border-top: 2px solid var(--gold);
  box-shadow: 0 12px 28px oklch(0.272 0.020 50 / 0.4);
}
.nav__group:hover .nav__panel, .nav__group:focus-within .nav__panel { display: grid; }
.nav__panel a { padding: var(--s3) var(--s4); }
.nav__panel .n {
  font-size: var(--t-xs); color: var(--gold-text); margin-right: var(--s2); letter-spacing: .1em;
}
.nav__toggle {
  display: none; background: none; border: 1px solid oklch(0.952 0.018 85 / 0.4);
  color: var(--paper); font-family: var(--hei); font-size: var(--t-sm);
  padding: var(--s2) var(--s3); margin: var(--s3) 0; border-radius: var(--radius); cursor: pointer;
}

/* =========================================================
   版式骨架
   ========================================================= */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--s5); }
.wrap--narrow { max-width: 800px; }

.band { padding: var(--s9) 0; }
.band + .band { border-top: 1px solid var(--rule); }
.band--sunk { background: var(--paper-sunk); }

.band-head { text-align: center; margin-bottom: var(--s8); }
.band-head__eyebrow {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: .42em; color: var(--ink-faint); margin: 0 0 var(--s3);
}
.band-head h2 { font-size: var(--t-2xl); letter-spacing: .12em; color: var(--ink); }
/* 雙金線 — 編簡之飾 */
.band-head__rule {
  width: 140px; height: 0; margin: var(--s4) auto 0;
  border-top: 1px solid var(--gold); border-bottom: 3px double var(--gold);
  position: relative;
}
.band-head__rule::after {
  content: "❖"; position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--paper); color: var(--gold-text); font-size: 12px; padding: 0 var(--s2);
}
.band--sunk .band-head__rule::after { background: var(--paper-sunk); }
.band-head p { max-width: 46em; margin: var(--s5) auto 0; color: var(--ink-soft); }

/* =========================================================
   卷首 — 御題題簽
   ========================================================= */
.slip-head {
  background-color: var(--paper-raised);
  color: var(--ink);
  border-top: 3px solid var(--gold);
  border-bottom: 3px double var(--gold);
  position: relative; overflow: hidden;
}
/* faint vertical ruling on the head, like a title page of a thread-bound book */
.slip-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(90deg,
      transparent 0 calc(var(--slip-w) - 1px),
      oklch(0.272 0.020 50 / 0.05) calc(var(--slip-w) - 1px) var(--slip-w));
}
.slip-head__inner { max-width: 1180px; margin: 0 auto; padding: var(--s9) var(--s5); position: relative; z-index: 1; }

.slip-head--site { text-align: center; }
.slip-head--site .seal-big {
  display: inline-block; font-family: var(--kai); font-weight: 900;
  font-size: var(--t-2xl); letter-spacing: .1em; color: #fff;
  background: var(--vermilion); border: 2px solid var(--gold);
  padding: var(--s4) var(--s6); border-radius: var(--radius);
  box-shadow: 0 6px 18px oklch(0.548 0.185 28 / 0.25);
  margin-bottom: var(--s6);
}
.slip-head--site h1 { font-size: clamp(2.4rem, 6.4vw, var(--t-4xl)); letter-spacing: .24em; margin-left: .24em; }
.slip-head--site .sub {
  font-family: var(--kai); font-size: var(--t-md); letter-spacing: .28em;
  color: var(--accent-deep); margin: var(--s5) 0 0;
}
.slip-head--site .lede {
  max-width: 44em; margin: var(--s6) auto 0;
  color: var(--ink-soft); font-size: var(--t-md);
}
.slip-head--site .byline {
  font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .3em;
  color: var(--ink-faint); margin-top: var(--s6);
}

/* 卷頁題頭：卷次 + 紀 + 紀年 */
.slip-head--juan .slip-head__inner {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s8); align-items: center; text-align: left;
}
.juan-plate {
  display: flex; flex-direction: column; align-items: center; gap: var(--s4);
  padding: var(--s5) var(--s6);
  background: var(--accent); border: 1px solid var(--gold); border-radius: var(--radius);
}
.juan-plate__zi {
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: clamp(2rem, 4.6vw, 3rem); font-weight: 900;
  letter-spacing: .2em; color: var(--paper);
}
.juan-plate__no { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .2em; color: var(--paper); opacity: .85; }
.juan-lead__kicker {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: .4em; color: var(--accent-deep); margin: 0 0 var(--s4);
}
.juan-lead h1 { font-size: clamp(1.7rem, 4vw, var(--t-2xl)); letter-spacing: .06em; }
.juan-lead__span {
  font-family: var(--kai); font-size: var(--t-md); line-height: 2.2;
  color: var(--ink-soft); margin: var(--s6) 0 0; padding-left: var(--s5);
  border-left: 2px solid var(--vermilion);
}
.juan-lead__span 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(--s3);
}

/* =========================================================
   卷概 dossier
   ========================================================= */
.dossier {
  border: 1px solid var(--rule-strong); border-top: 3px solid var(--accent);
  background: var(--paper-raised);
  padding: var(--s6); border-radius: var(--radius);
  margin-top: var(--s7);
}
.dossier__title {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .36em; color: var(--ink-faint);
  margin: 0 0 var(--s5); padding-bottom: var(--s3); border-bottom: 1px solid var(--rule);
}
.dossier__lede { margin: 0 0 var(--s5); color: var(--ink-soft); }
.dossier dl {
  margin: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s5) var(--s6);
}
.dossier dt {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: .22em; color: var(--ink-faint); margin-bottom: var(--s1);
}
.dossier dd { margin: 0; font-size: var(--t-sm); line-height: 1.8; }
.dossier dd b { color: var(--accent-deep); font-weight: 700; }

/* =========================================================
   臣光曰 — THE signature element.
   朱筆御批：manuscript face, vertical column ruling, gold binding cords,
   kai type, vermilion 「臣光曰」. Nothing else uses this treatment.
   ========================================================= */
.guang {
  position: relative;
  background-color: var(--slip);
  background-image: repeating-linear-gradient(90deg,
    transparent 0 calc(var(--slip-w) - 1px),
    oklch(0.272 0.020 50 / 0.08) calc(var(--slip-w) - 1px) var(--slip-w));
  border-top: 3px double var(--gold);
  border-bottom: 3px double var(--gold);
  border-left: 1px solid var(--gold-lo);
  border-right: 1px solid var(--gold-lo);
  padding: var(--s7) var(--s6) var(--s6);
  margin: var(--s7) 0;
  border-radius: var(--radius);
}
.guang__tag {
  position: absolute; top: -14px; left: var(--s5);
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .3em; color: #fff; background: var(--vermilion);
  padding: var(--s1) var(--s3); border-radius: var(--radius);
}
.guang p {
  font-family: var(--kai);
  font-size: var(--t-md);
  line-height: 2.35;
  letter-spacing: .03em;
  color: oklch(0.300 0.045 30);       /* ink with a faint vermilion cast */
  margin: 0 0 var(--s5);
  text-indent: 2em;
}
.guang p:last-child { margin-bottom: 0; }

/* =========================================================
   正文 — 叙事
   ========================================================= */
.reading {
  display: grid; grid-template-columns: 230px minmax(0, 1fr);
  gap: var(--s9); align-items: start;
  padding: var(--s8) 0 var(--s9);
}
.toc { position: sticky; top: 108px; font-family: var(--hei); max-height: calc(100vh - 140px); overflow-y: auto; }
.toc__title {
  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);
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: var(--s1); }
.toc a {
  display: block; padding: var(--s2) var(--s3);
  font-size: var(--t-sm); line-height: 1.5; color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid transparent; transition: all .2s;
}
.toc__n { display: block; font-size: var(--t-xs); font-weight: 500; letter-spacing: .2em; color: var(--ink-faint); margin-bottom: 2px; }
.toc a:hover { color: var(--ink); background: var(--accent-wash); }
.toc a:hover .toc__n, .toc a.is-active .toc__n { color: var(--accent); }
.toc a.is-active {
  color: var(--accent-deep); font-weight: 700;
  border-left-color: var(--accent); background: var(--accent-wash);
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 var(--s5); text-align: justify; }
.prose p:last-child { margin-bottom: 0; }

/* 卷內紀年小題 — 一年的開始 */
.vhead {
  margin: var(--s8) 0 var(--s5);
  scroll-margin-top: 108px;
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule-strong);
}
.vhead__reign {
  display: block; font-family: var(--hei); font-size: var(--t-xs);
  letter-spacing: .26em; color: var(--accent-deep); margin-bottom: var(--s2);
}
.vhead h3 {
  font-size: var(--t-lg); letter-spacing: .04em; color: var(--ink);
  display: flex; align-items: baseline; gap: var(--s3);
}
.vhead h3::before { content: ""; flex: 0 0 14px; height: 1px; background: var(--accent); }

/* 事件標籤 〔九鼎震〕 */
.event {
  display: inline-block; font-family: var(--hei); font-size: var(--t-xs);
  letter-spacing: .12em; color: var(--ink-faint);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 1px var(--s2); margin: 0 0 var(--s4);
}

/* =========================================================
   首頁 — 十六紀卡片
   ========================================================= */
.jis { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--s5); }
.jcard {
  --card-hue: 30;
  display: flex; text-decoration: none; color: inherit;
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.jcard:hover {
  transform: translateY(-4px); border-color: var(--accent);
  box-shadow: 0 10px 24px oklch(0.272 0.020 50 / 0.14);
}
.jcard__spine {
  flex: 0 0 auto; background: var(--accent);
  display: flex; flex-direction: column; align-items: center; gap: var(--s4);
  padding: var(--s5) var(--s3);
}
.jcard__spine .zi {
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: var(--t-lg); font-weight: 900; letter-spacing: .14em; color: var(--paper);
}
.jcard__spine .ord {
  font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .14em; color: var(--paper); opacity: .85;
}
.jcard__body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.jcard__meta { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .16em; color: var(--ink-faint); }
.jcard__body h3 { font-size: var(--t-md); letter-spacing: .04em; color: var(--ink); }
.jcard__body p { margin: 0; font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft); }
.jcard__more {
  margin-top: auto; font-family: var(--hei); font-size: var(--t-xs);
  font-weight: 700; letter-spacing: .2em; color: var(--accent-deep);
}
.jcard:hover .jcard__more { color: var(--vermilion); }

/* 紀頁卷次列表 */
.vollist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
.vrow {
  --card-hue: 30;
  display: flex; align-items: baseline; gap: var(--s4);
  text-decoration: none; color: inherit;
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: var(--s4) var(--s5); border-radius: var(--radius);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.vrow:hover {
  transform: translateY(-2px); border-color: var(--accent);
  box-shadow: 0 8px 18px oklch(0.272 0.020 50 / 0.12);
}
.vrow__no {
  font-family: var(--hei); font-size: var(--t-md); font-weight: 700;
  color: var(--accent-deep); letter-spacing: .04em; flex: 0 0 auto;
}
.vrow__span { font-size: var(--t-sm); line-height: 1.7; color: var(--ink-soft); }
.vrow:hover .vrow__no { color: var(--vermilion); }

/* 臣光曰 精選 band on index */
.guang-pick {
  border: 1px solid var(--vermilion); border-left-width: 4px;
  background: var(--vermilion-lo);
  padding: var(--s6); border-radius: var(--radius); margin-top: var(--s7);
}
.guang-pick__tag {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .3em; color: var(--vermilion); margin: 0 0 var(--s3);
}
.guang-pick blockquote {
  margin: 0; font-family: var(--kai); font-size: var(--t-md); line-height: 2.1;
  color: oklch(0.300 0.045 30); text-indent: 2em;
}
.guang-pick cite { display: block; font-family: var(--hei); font-style: normal; font-size: var(--t-xs); letter-spacing: .16em; color: var(--ink-faint); margin-top: var(--s4); }

/* =========================================================
   臣光曰 索引
   ========================================================= */
.gfilters {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s6); font-family: var(--hei);
}
.gfilters button {
  font-family: inherit; font-size: var(--t-sm); letter-spacing: .1em;
  color: var(--ink-soft); background: var(--paper-raised);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: var(--s2) var(--s4); cursor: pointer; transition: all .2s;
}
.gfilters button:hover { border-color: var(--vermilion); color: var(--ink); }
.gfilters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.glist { display: grid; gap: var(--s4); }
.gcase {
  --card-hue: 30;
  display: grid; grid-template-columns: 120px 1fr; gap: var(--s5);
  background: var(--paper-raised);
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  padding: var(--s5); border-radius: var(--radius);
}
.gcase__loc { font-family: var(--hei); }
.gcase__vol { font-size: var(--t-md); font-weight: 700; color: var(--accent-deep); letter-spacing: .04em; }
.gcase__ji {
  display: inline-block; margin-top: var(--s2);
  font-size: var(--t-xs); letter-spacing: .16em; color: var(--ink-faint);
  border: 1px solid var(--rule-strong); padding: 1px var(--s2); border-radius: var(--radius);
}
.gcase__text { margin: 0; font-family: var(--kai); font-size: var(--t-base); line-height: 2; color: oklch(0.300 0.045 30); text-indent: 2em; }
.gcase__goto {
  display: inline-block; margin-top: var(--s3);
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .14em; color: var(--accent-deep); text-decoration: none;
}
.gcase__goto:hover { color: var(--vermilion); text-decoration: underline; }
.gcase__ell { color: var(--ink-faint); font-family: var(--song); }

/* =========================================================
   翻頁 / 頁尾
   ========================================================= */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4);
  padding: var(--s7) 0; border-top: 3px double var(--gold);
}
.pager a {
  display: block; padding: var(--s5);
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius); text-decoration: none; transition: all .2s;
}
.pager a:hover { border-color: var(--vermilion); background: var(--paper-sunk); }
.pager .dir {
  display: block; font-family: var(--hei); font-size: var(--t-xs);
  letter-spacing: .24em; color: var(--ink-faint); margin-bottom: var(--s2);
}
.pager .who { display: block; font-size: var(--t-md); font-weight: 900; color: var(--ink); }
.pager .pager__next { text-align: right; }
.pager .pager__empty { visibility: hidden; }

.site-foot {
  background: var(--ink); color: oklch(0.952 0.018 85 / 0.72);
  border-top: 4px solid var(--vermilion);
  padding: var(--s8) 0 var(--s7); font-size: var(--t-sm);
}
.site-foot__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s6); margin-bottom: var(--s7);
}
.site-foot h4 {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .28em; color: var(--gold-text); margin-bottom: var(--s4);
}
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: var(--s2); }
.site-foot a { color: oklch(0.952 0.018 85 / 0.72); text-decoration: none; }
.site-foot a:hover { color: var(--gold-text); text-decoration: underline; }
.site-foot__coda {
  border-top: 1px solid oklch(0.952 0.018 85 / 0.18);
  padding-top: var(--s5); text-align: center;
  font-family: var(--kai); font-size: var(--t-base);
  color: oklch(0.952 0.018 85 / 0.62); letter-spacing: .08em;
}
.site-foot__legal {
  text-align: center; font-family: var(--hei); font-size: var(--t-xs);
  color: oklch(0.952 0.018 85 / 0.62); margin-top: var(--s4); line-height: 1.9;
}

/* legend — 凡例 */
.legend {
  display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6);
  font-family: var(--hei); font-size: var(--t-xs); color: var(--ink-soft);
  background: var(--paper-raised); border: 1px dashed var(--rule-strong);
  padding: var(--s4) var(--s5); margin: var(--s6) 0 0; border-radius: var(--radius);
}
.legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.legend i { font-style: normal; }
.legend .sw { display: inline-block; width: 26px; height: 12px; border-radius: 2px; flex: 0 0 auto; }
.legend .sw--narr { background: var(--ink-faint); }
.legend .sw--guang { background: var(--vermilion); }

/* =========================================================
   響應式
   ========================================================= */
@media (max-width: 1040px) {
  .reading { grid-template-columns: 1fr; gap: var(--s6); }
  .toc {
    position: static; max-height: none;
    border: 1px solid var(--rule); border-radius: var(--radius);
    padding: var(--s4) var(--s5); background: var(--paper-raised);
  }
  .toc ol { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); }
  .toc a { border-left: none; border-bottom: 2px solid transparent; padding: var(--s3) var(--s4); min-height: 44px; display: flex; align-items: center; }
  .toc__n { display: inline; margin-right: var(--s2); }
  .toc a.is-active { border-left: none; border-bottom-color: var(--accent); }
}

@media (max-width: 860px) {
  :root { --s9: 56px; --s8: 40px; --t-2xl: 1.95rem; --t-xl: 1.5rem; --slip-w: 40px; }
  .topbar__inner { flex-wrap: wrap; padding: 0 var(--s4); }
  .nav__toggle { display: block; }
  .nav {
    display: none; width: 100%; flex-direction: column;
    border-top: 1px solid oklch(0.952 0.018 85 / 0.2); padding-bottom: var(--s3);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: var(--s3) 0; }
  .nav__group { flex-direction: column; }
  .nav__panel {
    position: static; transform: none; display: grid; min-width: 0;
    grid-template-columns: 1fr 1fr;
    border: none; border-left: 2px solid var(--gold); box-shadow: none; margin-left: var(--s3);
  }
  .slip-head--juan .slip-head__inner { grid-template-columns: 1fr; gap: var(--s6); }
  .juan-plate { flex-direction: row; justify-content: center; padding: var(--s4); }
  .juan-plate__zi { writing-mode: horizontal-tb; letter-spacing: .3em; margin-left: .3em; }
  .pager { grid-template-columns: 1fr; }
  .pager .pager__next { text-align: left; }
  .pager .pager__empty { display: none; }
  .wrap { padding: 0 var(--s4); }
  .slip-head__inner { padding: var(--s8) var(--s4); }
  .guang { padding: var(--s7) var(--s4) var(--s5); }
  .guang p { font-size: 1.15rem; line-height: 2.2; }
  .gcase { grid-template-columns: 1fr; gap: var(--s3); }
  .site-foot li { margin-bottom: 0; }
  .site-foot li a { display: flex; align-items: center; min-height: 44px; }
}

@media print {
  .topbar, .toc, .pager, .nav__toggle, .gfilters, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.7; }
  .slip-head { background: #fff; color: #000; border-bottom: 2px solid #000; }
  .slip-head::before { display: none; }
  .juan-plate { background: none; border: 1px solid #000; }
  .juan-plate__zi, .juan-lead__span { color: #000; }
  .reading { grid-template-columns: 1fr; padding: 0; }
  .guang { background: #fff; border: 1px solid #000; break-inside: avoid; }
  .guang p { color: #000; }
  .vhead { break-after: avoid; }
  .site-foot { background: #fff; color: #000; border-top: 1px solid #000; }
}

/* =========================================================
   PHASE 1 — 三欄版式：左欄 TOC 導覽 / 中欄正文 / 右欄背景面板
   ========================================================= */
.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: 100px; max-height: calc(100vh - 128px); overflow-y: auto;
       font-family: var(--hei); }
.rhs { position: sticky; top: 100px; max-height: calc(100vh - 128px); overflow-y: auto;
       display: grid; gap: var(--s5); align-content: start; }
/* 中欄在寬螢幕上保持最佳可讀寬度（≈ 65 字） */
.layout > .main { min-width: 0; max-width: 880px; margin: 0 auto; width: 100%; }

/* —— 右欄可收合 —— */
body[data-rhs="collapsed"] .layout {
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 48px;
}
/* 收合時不 display:none（那會連切換鈕一起消滅），改為窄軌道、只留切換鈕 */
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: 100px; 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 rgba(0,0,0,.04);
  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; }
  /* 人物頁：行動版隱藏卷次清單，讓人物導覽置頂，避免首篇傳記被埋 */
  .lhs.nav-vols .nav-lhs__title,
  .lhs.nav-vols .nav-vols__list { display: none; }
  .lhs.nav-vols .band-head { margin-top: var(--s4) !important; }
}

/* ---- 左欄：垂直導覽清單 ---- */
.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; transition: all .2s; border-radius: 0 var(--radius) var(--radius) 0;
}
.nav-lhs .nl__ord { font-size: var(--t-xs); font-weight: 500; letter-spacing: .18em; color: var(--ink-faint); flex: 0 0 auto; }
.nav-lhs .nl__name { color: var(--ink); }
.nav-lhs .nl__col { display: flex; flex-direction: column; line-height: 1.3; }
.nav-lhs .nl__date { display: block; font-size: 10.5px; letter-spacing: .02em; color: var(--ink-faint); margin-top: 1px; }
.nav-lhs a:hover { background: var(--accent-wash); color: var(--ink); border-left-color: var(--accent); }
.nav-lhs a:hover .nl__ord { color: var(--accent); }
.nav-lhs a.is-current { background: var(--accent-wash); color: var(--accent-deep); font-weight: 700; border-left-color: var(--accent); }

/* 左欄卷次清單（紀頁用） */
.nav-vols a {
  display: flex; align-items: baseline; gap: var(--s3);
  padding: var(--s2) var(--s3); text-decoration: none;
  font-family: var(--hei); 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-vols .nv__no { font-weight: 700; color: var(--accent-deep); letter-spacing: .04em; flex: 0 0 auto; }
.nav-vols .nv__span { font-family: var(--song); font-size: var(--t-xs); color: var(--ink-faint); }
.nav-vols a:hover { background: var(--accent-wash); border-left-color: var(--accent); }
.nav-vols a:hover .nv__no { color: var(--vermilion); }

/* =========================================================
   一頁速讀 — 子頁頂端摘要盒
   ========================================================= */
.summary {
  position: relative; background: var(--paper-raised);
  border: 1px solid var(--rule-strong); border-left: 4px solid var(--vermilion);
  border-radius: var(--radius); padding: var(--s6) var(--s6) var(--s5);
  margin-bottom: var(--s7);
}
.summary__tag {
  position: absolute; top: -13px; left: var(--s5);
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .26em; color: #fff; background: var(--vermilion);
  padding: var(--s1) var(--s3); border-radius: var(--radius);
}
.summary p { margin: 0; font-size: var(--t-base); line-height: 2; color: var(--ink-soft); }
.summary p + p { margin-top: var(--s4); }
.summary__meta {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s5);
  padding-top: var(--s4); border-top: 1px dashed var(--rule);
  font-family: var(--hei); font-size: var(--t-xs); color: var(--ink-faint); letter-spacing: .04em;
}
.summary__meta b { color: var(--accent-deep); font-weight: 700; }

/* =========================================================
   右欄面板 — 時代背景 / 讀史鏡鑑 / 導覽
   ========================================================= */
.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--vermilion { border-top-color: var(--vermilion); }
.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 dl { margin: 0; display: grid; gap: var(--s3); }
.panel dt {
  font-family: var(--hei); font-size: 10.5px; font-weight: 500;
  letter-spacing: .2em; color: var(--ink-faint); margin-bottom: 2px;
}
.panel dd { margin: 0; font-size: var(--t-sm); line-height: 1.8; color: var(--ink); }
.panel dd b { color: var(--accent-deep); font-weight: 700; }
.panel ul.world { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s3); }
.panel ul.world li {
  font-size: var(--t-sm); line-height: 1.8; color: var(--ink-soft);
  padding-left: var(--s4); position: relative;
}
.panel ul.world li::before {
  content: "\203A"; position: absolute; left: 2px; top: 0; color: var(--accent); font-weight: 700;
}
.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;
}

/* 導覽面板：關鍵數字 + 導讀 */
.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); }
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.guide-list li { font-size: var(--t-sm); line-height: 1.8; color: var(--ink-soft); padding-left: var(--s4); position: relative; }
.guide-list li::before { content: "\25C6"; position: absolute; left: 0; top: 0; color: var(--vermilion); font-size: 10px; }
.guide-list li b { color: var(--accent-deep); font-weight: 700; }

/* =========================================================
   導論區塊（首頁 main 欄）
   ========================================================= */
.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: var(--t-xs); font-weight: 700;
  letter-spacing: .3em; color: var(--accent-deep); margin: 0 0 var(--s4);
  display: flex; align-items: center; gap: var(--s3);
}
.guide-block__head::before { content: ""; width: 22px; height: 2px; background: var(--vermilion); }
.guide-intro { font-size: var(--t-md); line-height: 2.15; color: var(--ink); margin: 0; }
.guide-keymsg { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.guide-keymsg li {
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: var(--s4) var(--s5); font-size: var(--t-sm); line-height: 1.9; color: var(--ink-soft);
}
.guide-keymsg li b { color: var(--accent-deep); font-weight: 700; }
.guide-howto { list-style: none; margin: 0; padding: 0; counter-reset: hk; display: grid; gap: var(--s4); }
.guide-howto li {
  counter-increment: hk; position: relative; padding-left: var(--s8);
  font-size: var(--t-sm); line-height: 1.9; color: var(--ink-soft);
}
.guide-howto li::before {
  content: counter(hk); position: absolute; left: 0; top: 2px;
  width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--accent); color: var(--paper); font-family: var(--hei); font-weight: 700;
  border-radius: 50%; font-size: var(--t-xs);
}
.snap {
  background: var(--paper-sunk); border: 1px dashed var(--rule-strong);
  border-radius: var(--radius); padding: var(--s5); font-size: var(--t-sm);
  line-height: 1.95; color: var(--ink-soft); margin-top: var(--s4);
}
.snap b { color: var(--accent-deep); }

/* 鏡鑑索引頁 */
.jj-grid { display: grid; gap: var(--s5); }
.jj-row {
  display: grid; grid-template-columns: 150px 1fr; gap: var(--s6);
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: var(--s6); scroll-margin-top: 100px;
}
.jj-row__head { font-family: var(--hei); }
.jj-row__ord { font-size: var(--t-xs); letter-spacing: .2em; color: var(--ink-faint); }
.jj-row__name { font-family: var(--song); font-size: var(--t-lg); font-weight: 900; color: var(--accent-deep); margin: var(--s2) 0; }
.jj-row__dynasty { font-size: var(--t-xs); letter-spacing: .16em; color: var(--ink-faint); }
.jj-row__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; }
@media (max-width: 720px) { .jj-row { grid-template-columns: 1fr; gap: var(--s4); } }

/* 導覽條目在窄屏時改為橫向 */
@media (max-width: 920px) {
  .nav-lhs ol { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); }
  .nav-lhs a { border-left: none; border-bottom: 2px solid transparent; padding: var(--s3) var(--s4); min-height: 44px; align-items: center; }
  .nav-lhs a.is-current { border-left: none; border-bottom-color: var(--accent); }
  .nav-lhs .nl__date { display: none; }
}

@media print {
  .lhs, .rhs, .nav__toggle { display: none !important; }
  .layout { grid-template-columns: 1fr; padding: 0; }
  .summary, .panel, .guang { break-inside: avoid; }
}


/* =========================================================
   PHASE 3 — 註釋系統：術語 hover / 名言金句 / 白話譯
   ========================================================= */
:root{
  --gold:#c08a1e;
  --gold-deep:#8a5e12;
  --gold-soft:#f6e8c6;
  --gold-line:rgba(192,138,30,.45);
}

/* 難字術語：點線底，懸停釋義 */
.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 */
#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); }

/* 臣光曰 白話譯文 */
.guang__trans{
  margin-top:var(--s4);
  padding:var(--s4) var(--s5);
  background:var(--paper-sunk);
  border-left:3px solid var(--gold);
  border-radius:var(--radius);
}
.guang__trans-label{
  font-family:var(--hei); font-size:10.5px; letter-spacing:.26em;
  color:var(--gold-deep); margin:0 0 var(--s2); font-weight:700;
}
.guang__trans p{
  margin:0; font-family:var(--hei); font-size:var(--t-sm);
  line-height:2; color:var(--ink-soft);
}

/* 圖例 */
.legend{ list-style:none; margin:0; padding:0; display:grid; gap:var(--s3); }
.legend li{
  display:flex; align-items:center; gap:var(--s3);
  font-family:var(--hei); font-size:var(--t-xs); color:var(--ink-soft);
}
.sw{ width:16px; height:16px; border-radius:4px; flex:0 0 auto; display:inline-block; }
.sw--narr{ background:var(--paper); border:1px solid var(--rule-strong); }
.sw--guang{ background:var(--vermilion); }
.sw--famous{ background:linear-gradient(180deg,#fbeec4,#f3dd9c); border:1px solid var(--gold-line); }
.sw--term{ background:transparent; border-bottom:2px dotted var(--gold-deep); }

/* RHS 圖例面板 */
.panel--legend{ border-top-color:var(--gold); }
.panel--legend .panel__lede{ margin-top:var(--s4); font-size:var(--t-xs); line-height:1.9; }
.panel--legend .term,.panel--legend .q-famous{ border-radius:2px; }

/* 臣光曰 索引頁：白話譯附註 */
.gcase__trans{
  margin-top:var(--s3); padding-left:var(--s4);
  border-left:2px solid var(--gold-line);
  font-family:var(--hei); font-size:var(--t-xs); line-height:1.9; color:var(--ink-soft);
}
.gcase__trans-label{
  font-weight:700; letter-spacing:.2em; color:var(--gold-deep);
  margin-right:var(--s2); font-size:10px;
}

/* 註釋開關 */
#anno-ctrl{
  position:fixed; right:16px; bottom:16px; z-index:900;
  display:flex; gap:6px;
  background:var(--paper-raised); border:1px solid var(--rule-strong);
  border-radius:999px; padding:6px 8px;
  box-shadow:0 6px 22px rgba(0,0,0,.18);
  font-family:var(--hei);
}
#anno-ctrl button{
  border:1px solid var(--rule); background:var(--accent-wash);
  color:var(--accent-deep); font-size:12px; font-weight:700;
  padding:5px 11px; border-radius:999px; cursor:pointer;
  letter-spacing:.08em; transition:all .15s;
}
#anno-ctrl button[aria-pressed="false"],
#anno-ctrl button.is-off{ background:var(--paper-sunk); color:var(--ink-faint); }
#anno-ctrl button:hover{ border-color:var(--accent); }

/* 隱藏開關 */
body.no-trans .guang__trans,
body.no-trans .gcase__trans{ display:none; }
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; }

@media (max-width:920px){
  #anno-ctrl{ right:10px; bottom:10px; }
}


/* =========================================================
   PHASE 4 — 主題閱讀 / 年表
   ========================================================= */
.slip-head--theme { background:
   radial-gradient(120% 140% at 0% 0%, hsl(var(--hue) 55% 96%), var(--paper)); }
.slip-head--theme .slip-head__inner { display: flex; align-items: center; gap: var(--s6);
   max-width: 1180px; margin: 0 auto; padding: var(--s9) var(--s5); position: relative; z-index: 1; }
.theme-mark { width: 92px; height: 92px; border-radius: var(--radius);
   background: linear-gradient(135deg, hsl(var(--mhue,30) 55% 93%), 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: hsl(var(--mhue,30) 52% 40%); writing-mode: vertical-rl; }
.slip-head--theme .juan-lead__kicker { color: hsl(var(--hue) 45% 42%); }

/* 主題正文 */
.theme-body .theme-h { font-family: var(--song); font-size: var(--t-xl); font-weight: 900;
   color: var(--accent-deep); margin: var(--s8) 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: hsl(var(--chue,30) 55% 40%); 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; }
.nav-cats { list-style: none; margin: 0; padding: 0; }
.nav-cats a { display: flex; flex-direction: column; padding: var(--s2) var(--s3); text-decoration: none;
   color: var(--ink-soft); border-left: 2px solid transparent; border-radius: 0 var(--radius) var(--radius) 0; }
.nav-cats a:hover { background: var(--accent-wash); border-left-color: var(--accent); }

/* 右欄：相關卷次 / 關聯主題 */
.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); }

/* 主題 landing：分類 + 卡片 */
.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; }
.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 hsl(var(--card-hue,30) 60% 45%); border-radius: var(--radius); padding: var(--s5);
   text-decoration: none; color: inherit; box-shadow: 0 2px 0 var(--gold-lo);
   transition: transform .15s, box-shadow .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: hsl(var(--card-hue,30) 55% 40%); }
.tcard h3 { font-family: var(--song); font-size: var(--t-lg); font-weight: 900; color: var(--ink);
   margin: var(--s2) 0 var(--s3); 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); }

/* 年表：時間軸 */
.tl { position: relative; padding-left: 108px; margin: var(--s7) 0; }
.tl::before { content: ""; position: absolute; left: 92px; top: 6px; bottom: 6px; width: 3px;
   background: linear-gradient(var(--accent), var(--vermilion)); border-radius: 2px; }
.tl-item { position: relative; margin-bottom: var(--s7); }
.tl-item::before { content: ""; position: absolute; left: -24px; top: 7px; width: 14px; height: 14px;
   border-radius: 50%; background: hsl(var(--hue) 70% 45%); border: 3px solid var(--paper);
   box-shadow: 0 0 0 2px hsl(var(--hue) 70% 45%); }
.tl-rail { position: absolute; left: -108px; width: 80px; text-align: right; padding-top: 2px; }
.tl-year { font-family: var(--hei); font-weight: 700; font-size: var(--t-sm); color: var(--ink-soft);
   letter-spacing: .04em; }
.tl-card { background: var(--paper-raised); border: 1px solid var(--rule);
   border-left: 4px solid hsl(var(--hue) 70% 45%); border-radius: var(--radius); padding: var(--s5); }
.tl-card__top { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.tl-tag { font-family: var(--hei); font-size: 10.5px; letter-spacing: .12em; color: #fff;
   background: hsl(var(--hue) 65% 42%); padding: 2px var(--s3); border-radius: 99px; white-space: nowrap; }
.tl-title { font-family: var(--song); font-size: var(--t-lg); font-weight: 900; color: var(--accent-deep);
   text-decoration: none; }
.tl-title:hover { color: var(--vermilion); }
.tl-ji { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .1em; color: var(--ink-faint);
   margin: var(--s2) 0; }
.tl-note { font-size: var(--t-sm); line-height: 1.9; color: var(--ink-soft); margin: 0; }

@media (max-width: 720px) {
  .tl { padding-left: 0; }
  .tl::before { display: none; }
  .tl-rail { position: static; width: auto; text-align: left; margin-bottom: var(--s2); }
  .tl-item::before { display: none; }
  .slip-head--theme .slip-head__inner { flex-direction: column; align-items: flex-start; gap: var(--s4); }
}

/* =========================================================
   PHASE 4 — 主題閱讀 視覺強化 (polish layer)
   ========================================================= */

/* 分類主色：依 id 注入 --cat-hue，驅動整段配色 */
#cat-rise  { --cat-hue: 210; }
#cat-power { --cat-hue: 8;   }
#cat-state { --cat-hue: 285; }

/* 分類區塊：淡彩底 + 描邊，形成清晰視覺分組 */
.tsec {
  background: linear-gradient(180deg,
    hsl(var(--cat-hue) 58% 96.5%) 0%,
    hsl(var(--cat-hue) 58% 98.5%) 55%,
    transparent 100%);
  border: 1px solid hsl(var(--cat-hue) 52% 88%);
  border-radius: var(--radius);
  padding: var(--s7) var(--s6) var(--s6);
  margin-top: var(--s8);
  scroll-margin-top: 100px;
}
.tsec .band-head { text-align: left; align-items: flex-start; margin-bottom: var(--s5); }
.tsec .band-head__eyebrow {
  display: inline-block;
  font-family: var(--hei); font-size: 10.5px; font-weight: 700; letter-spacing: .24em;
  color: hsl(var(--cat-hue) 55% 34%);
  background: hsl(var(--cat-hue) 60% 92%);
  border: 1px solid hsl(var(--cat-hue) 52% 84%);
  padding: 3px 12px; border-radius: 99px; margin: 0 0 var(--s3);
}
.tsec .band-head h2 { color: hsl(var(--cat-hue) 55% 32%); letter-spacing: .1em; }
.tsec .band-head__rule {
  margin: var(--s4) 0 0; width: 132px; height: 3px;
  border: none; border-radius: 2px;
  background: linear-gradient(90deg, hsl(var(--cat-hue) 65% 48%), transparent);
}
.tsec .band-head__rule::after { display: none; }

/* =========================================================
   一致性修補 — QA 2026-08-04
   ========================================================= */

/* 紀頁「看全部 N 位人物小傳 →」連結：與 .gcase__goto 同款 */
.gcase__more {
  display: inline-block; margin-top: var(--s3);
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .14em; color: var(--accent-deep); text-decoration: none;
}
.gcase__more:hover { color: var(--vermilion); text-decoration: underline; }

/* 索引頁眉 kicker（主題閱讀 / 年表），與主題子頁 juan-lead__kicker 對齊 */
.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 { letter-spacing: .04em; }

/* 左欄卷次清單容器：條目間留細縫 */
.nav-vols__list { display: flex; flex-direction: column; gap: 2px; }
.tsec .tsec__desc { max-width: 62ch; }

/* 主題卡片：強化層次與互動回饋 */
.tcard { position: relative; overflow: hidden; border-top-width: 4px; }
.tcard::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 0% 0%, hsl(var(--card-hue,30) 60% 94%), transparent 60%);
  opacity: 0; transition: opacity .2s;
}
.tcard:hover::before { opacity: 1; }
.tcard p, .tcard__era { position: relative; z-index: 1; }
.tcard__cat { display: inline-flex; align-items: center; gap: 7px; }
.tcard__cat::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: hsl(var(--card-hue,30) 62% 48%); }
.tcard h3 { position: relative; z-index: 1; transition: color .18s; }
.tcard:hover h3 { color: hsl(var(--card-hue,30) 55% 38%); }
.tcard__era { display: flex; align-items: center; gap: 6px; margin-top: var(--s3); }
.tcard__era::after {
  content: "閱讀 →"; margin-left: auto;
  font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .12em;
  color: hsl(var(--card-hue,30) 55% 45%);
  opacity: 0; transform: translateX(-6px); transition: .18s;
}
.tcard:hover .tcard__era::after { opacity: 1; transform: none; }

/* 左欄分類導覽：懸停色帶 */
.nav-cats a { transition: background .15s, border-color .15s; }
.nav-cats .nl__name { font-family: var(--song); font-weight: 700; }
.nav-cats .nl__date { font-family: var(--hei); font-size: 10.5px; letter-spacing: .04em; color: var(--ink-faint); }
.nav-cats a:hover { border-left-color: var(--vermilion); }

/* =========================================================
   PHASE 4 — 合併視圖：鏡鑑 · 年表 (mirror.html)
   ========================================================= */

/* 加寬鏡鑑年表軸的留白，容納「紀」的起訖年 */
.tl--mirror { padding-left: 124px; }
.tl--mirror::before { left: 108px; }
.tl--mirror .tl-rail { width: 108px; left: -124px; text-align: right; padding-top: 4px; }
.tl--mirror .tl-year { font-size: var(--t-xs); line-height: 1.4; }
.tl--mirror .tl-item::before { left: -16px; }

.mirror-ji { margin-bottom: var(--s8); }
.mirror-card { padding: var(--s6); }
.mirror-ji__head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.mirror-ji__ord {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--song); font-weight: 900; font-size: var(--t-md); color: #fff;
  background: hsl(var(--hue) 62% 42%);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px hsl(var(--hue) 62% 42% / .45);
}
.mirror-ji__name { font-family: var(--song); font-size: var(--t-xl); font-weight: 900; color: hsl(var(--hue) 55% 32%); margin: 0; line-height: 1.1; }
.mirror-ji__dyn { font-family: var(--hei); font-size: var(--t-xs); letter-spacing: .08em; color: var(--ink-faint); margin-left: auto; }
.mirror-ji__lesson {
  font-family: var(--song); font-size: var(--t-md); line-height: 2.05; color: var(--ink);
  margin: 0 0 var(--s5); padding: var(--s4) var(--s5);
  background: hsl(var(--hue) 55% 97%);
  border-left: 4px solid hsl(var(--hue) 60% 50%);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.mirror-evs { display: grid; gap: var(--s3); padding-left: var(--s5); border-left: 2px dashed var(--rule); }
.mirror-ev {
  display: grid; grid-template-columns: 62px 116px 1fr; gap: var(--s3); align-items: baseline;
  text-decoration: none; color: inherit;
  padding: var(--s3) var(--s4); background: var(--paper-raised);
  border: 1px solid var(--rule); border-radius: var(--radius);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mirror-ev:hover { border-color: hsl(var(--hue) 60% 50%); transform: translateX(3px); box-shadow: 0 3px 12px rgba(0,0,0,.06); }
.mirror-ev__yr { font-family: var(--hei); font-weight: 700; font-size: var(--t-sm); color: hsl(var(--hue) 55% 38%); }
.mirror-ev__tag { font-family: var(--hei); font-size: 10.5px; letter-spacing: .08em; color: #fff; background: hsl(var(--hue) 60% 45%); padding: 2px 8px; border-radius: 99px; white-space: nowrap; text-align: center; }
.mirror-ev__title { font-family: var(--song); font-weight: 700; font-size: var(--t-sm); color: var(--accent-deep); }
.mirror-ev__note { grid-column: 3; font-size: var(--t-xs); line-height: 1.7; color: var(--ink-soft); margin-top: 1px; }
.mirror-ev:hover .mirror-ev__title { color: var(--vermilion); }
.mirror-empty { font-family: var(--hei); font-size: var(--t-xs); color: var(--ink-faint); padding: var(--s2) 0 var(--s2) var(--s5); letter-spacing: .05em; }

@media (max-width: 720px) {
  .tl--mirror { padding-left: 0; }
  .tl--mirror::before { display: none; }
  .tl--mirror .tl-rail { position: static; width: auto; left: auto; text-align: left; margin-bottom: var(--s2); }
  .tl--mirror .tl-item::before { display: none; }
  .mirror-ev { grid-template-columns: 1fr; gap: var(--s1); }
  .mirror-ev__note { grid-column: 1; }
  .mirror-ji__dyn { margin-left: 0; width: 100%; }
}
/* =========================================================
   PHASE 5 — 人物小傳 + 內文名稱連結 + 收合右欄
   ========================================================= */

/* 內文中的人物連結：朱紅色虛線下劃，與 tlink 金色主題連結區分 */
a.charlink {
  color: #b3321a;
  text-decoration: none;
  border-bottom: 1px dashed oklch(0.55 0.13 28 / 0.6);
  padding: 0 1px;
  transition: background .12s, color .12s, border-color .12s;
}
a.charlink:hover {
  color: #fff;
  background: #b3321a;
  border-bottom-color: #b3321a;
  border-radius: 2px;
}
/* 名稱在註釋內（金色）時保留金色，避免重疊 */
.term, .q-famous { border-bottom-color: transparent; }

/* 紀頁：人物小傳預覽卡片 */
.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 {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  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); }
.plcard__goto {
  display: inline-block;
  margin-top: var(--s3);
  font-family: var(--hei);
  font-size: var(--t-xs);
  color: var(--vermilion);
  opacity: .6;
}
.plcard:hover .plcard__goto { opacity: 1; }

/* 人物小傳全頁：左欄人物 TOC、卡片大列 */
.nav-people { margin-top: var(--s3); font-family: var(--hei); }
.nav-people ul { list-style: none; padding: 0; margin: 0; }
.nav-people li a {
  display: block;
  padding: 6px 10px;
  font-size: var(--t-sm);
  color: var(--ink-2);
  border-left: 2px solid transparent;
  text-decoration: none !important;
  transition: background .12s, color .12s, border-color .12s;
}
.nav-people li a:hover {
  color: var(--vermilion);
  background: oklch(0.55 0.18 28 / 0.06);
  border-left-color: var(--vermilion);
}

.people-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s5);
  margin-top: var(--s5);
}
.pcard {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-left: 4px solid oklch(0.55 0.12 var(--card-hue));
  border-radius: var(--radius);
  padding: var(--s5) var(--s6);
  scroll-margin-top: 110px;
}
.pcard__head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); }
.pcard__name {
  font-family: var(--serif);
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--ink);
}
.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); }
  .pcard__name { font-size: var(--t-lg); }
}

/* —— 人物小傳：生平分段 —— */
.pbio {
  display: grid; gap: var(--s6);
  margin-top: var(--s6); padding-top: var(--s6);
  border-top: 1px solid var(--rule);
}
.pbio__sec { }  /* 留白由 gap 控制 */
.pbio__h {
  font-family: var(--hei); font-size: 14px; font-weight: 600;
  letter-spacing: .12em; color: var(--vermilion);
  margin: 0 0 6px; padding-left: 11px;
  border-left: 3px solid var(--vermilion);
}
.pbio__sec p {
  margin: 0 0 12px; font-size: 15px; line-height: 1.9; color: var(--ink);
  max-width: var(--measure);
  text-align: justify;
}
.pbio__sec p:last-child { margin-bottom: 0; }
/* 手機：切換鈕本就不顯（窄屏右欄轉全寬堆疊），生平段維持易讀 */
@media (max-width: 920px) {
  .pbio { gap: var(--s5); }
}

/* —— 高影響人物：分級標記 —— */
.pcard--tier-S {
  border-left-width: 6px;
  box-shadow: 0 2px 22px oklch(0.55 0.12 var(--card-hue) / 0.10);
}
.pcard__badge {
  font-family: var(--hei); font-size: 12px; 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;
}

/* —— 人物分級標記：深讀(S/A/B) + 中文級別 + 星級 —— */
.pcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: 4px; }
.pcard__tier {
  font-family: var(--hei); font-size: 12px; font-weight: 600;
  color: var(--ink-2); letter-spacing: .03em; white-space: nowrap;
}
.pcard__tier--minor { color: #9a9488; font-weight: 500; }
.pcard__stars { color: #8a6500; font-size: 13px; letter-spacing: 1px; }
.star-empty { color: #d6c9a8; }
.pcard--tier-A { border-left-width: 4px; }
.pcard--tier-B { border-left-width: 3px; }

/* —— 紀 landing 預覽卡上的精簡級別 —— */
.plcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0; }
.plcard__tier { font-family: var(--hei); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.plcard__tier--minor { color: #9a9488; }
.plcard__stars { color: #8a6500; font-size: 12px; letter-spacing: 1px; }

/* —— 供參考：考古 / 正史新證 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: 12px; font-weight: 700;
  letter-spacing: .12em; color: #fff; background: oklch(0.55 0.11 var(--card-hue));
  padding: 2px 11px; border-radius: 999px; margin-bottom: 10px;
}
.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; }
