@charset "UTF-8";

/* =========================================================
   八仙列傳 · 凡人成仙錄
   Direction: 線裝古籍列傳 (woodblock 界欄 / 印章 / 宋楷黑三體)
   ========================================================= */

:root {
  /* ---- 色 ---- */
  --paper:        oklch(0.949 0.020 82);
  --paper-raised: oklch(0.978 0.014 84);
  --paper-sunk:   oklch(0.915 0.024 80);
  --ink:          oklch(0.285 0.014 60);
  --ink-soft:     oklch(0.435 0.016 62);
  --ink-faint:    oklch(0.615 0.018 66);
  --rule:         oklch(0.285 0.014 60 / 0.18);
  --rule-strong:  oklch(0.285 0.014 60 / 0.42);
  --gold:         oklch(0.685 0.095 78);
  --cinnabar:     oklch(0.505 0.155 30);
  --cinnabar-ink: oklch(0.455 0.150 30);

  /* ---- 每仙色相（各頁覆寫 --hue）---- */
  --hue: 30;
  --accent:       oklch(0.480 0.115 var(--hue));
  --accent-deep:  oklch(0.380 0.095 var(--hue));
  --accent-wash:  oklch(0.480 0.115 var(--hue) / 0.08);
  --accent-line:  oklch(0.480 0.115 var(--hue) / 0.30);

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

  /* ---- 字 ---- */
  --song: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --kai:  "LXGW WenKai TC", "Kaiti TC", "DFKai-SB", var(--song);
  --hei:  "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;

  --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: 34em; /* ≈34 漢字 */
}

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

/* Custom properties are substituted where they are declared, so a descendant
   that overrides --hue must re-declare the accents for them to recompute. */
.fcard, .relic, .eight-states li {
  --hue: var(--card-hue);
  --accent:      oklch(0.480 0.115 var(--hue));
  --accent-deep: oklch(0.380 0.095 var(--hue));
  --accent-wash: oklch(0.480 0.115 var(--hue) / 0.08);
  --accent-line: oklch(0.480 0.115 var(--hue) / 0.30);
}

html { scroll-behavior: smooth; scroll-padding-top: 92px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.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);
  background-image:
    radial-gradient(oklch(0.285 0.014 60 / 0.035) 1px, transparent 1px),
    radial-gradient(oklch(0.285 0.014 60 / 0.025) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
  background-position: 0 0, 12px 12px;
  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(--cinnabar); }
a:focus-visible,
button:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; }

/* =========================================================
   導覽 — 版心橫楣
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--ink);
  border-bottom: 3px double var(--gold);
}
.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: 0.18em;
  padding: var(--s3) 0;
}
.topbar__brand:hover { color: var(--gold); }
.topbar__brand .mark {
  font-family: var(--hei); font-size: var(--t-sm); font-weight: 700;
  letter-spacing: 0.1em;
  border: 1px solid var(--gold); color: var(--gold);
  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.949 0.020 82 / 0.82); text-decoration: none;
  letter-spacing: 0.14em; transition: background 0.2s, color 0.2s;
}
.nav a:hover, .nav a[aria-current="page"] { background: var(--cinnabar); color: #fff; }

.nav__group { position: relative; display: flex; }
.nav__panel {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  min-width: 320px;
  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.285 0.014 60 / 0.35);
}
.nav__group:hover .nav__panel,
.nav__group:focus-within .nav__panel { display: grid; }
.nav__panel a { padding: var(--s3) var(--s4); font-size: var(--t-sm); }

.nav__toggle {
  display: none; background: none; border: 1px solid oklch(0.949 0.020 82 / 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: 780px; }

.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: 0.42em; color: var(--ink-faint); text-transform: uppercase;
  margin: 0 0 var(--s3);
}
.band-head h2 { font-size: var(--t-2xl); letter-spacing: 0.14em; color: var(--cinnabar-ink); }
.band-head__rule {
  width: 132px; 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); 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); }

/* =========================================================
   卷首 — 頁面題頭
   ========================================================= */
.scroll-head {
  background-color: var(--ink);
  background-image:
    linear-gradient(oklch(0.20 0.012 60 / 0.80), oklch(0.18 0.012 60 / 0.93)),
    url("img/hero-waves.webp");
  background-size: auto, cover;
  background-position: center, center bottom;
  background-repeat: no-repeat;
  color: var(--paper);
  border-bottom: 6px double var(--gold);
  position: relative; overflow: hidden;
}
.scroll-head::before {
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, oklch(0.949 0.020 82 / 0.05) 0 1px, transparent 1px 92px);
  pointer-events: none;
}
.scroll-head__inner {
  max-width: 1180px; margin: 0 auto; padding: var(--s9) var(--s5);
  position: relative;
}
.scroll-head--site { text-align: center; }
.scroll-head--site h1 {
  font-size: clamp(2.6rem, 7vw, var(--t-4xl));
  letter-spacing: 0.22em; margin-left: 0.22em;
}
.scroll-head--site .sub {
  font-family: var(--kai); font-size: var(--t-md);
  letter-spacing: 0.3em; color: var(--gold); margin: var(--s5) 0 0;
}
.scroll-head--site .lede {
  max-width: 40em; margin: var(--s6) auto 0;
  color: oklch(0.949 0.020 82 / 0.78); font-size: var(--t-md);
}

/* 人物頁題頭：直式名 + 印 */
.scroll-head--figure .scroll-head__inner {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s8); align-items: center;
}
.figure-name {
  display: flex; flex-direction: column; align-items: center; gap: var(--s5);
  padding: var(--s5) var(--s6);
  background: var(--accent); border: 1px solid var(--gold);
  border-radius: var(--radius);
}
.figure-name__zi {
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 900;
  letter-spacing: 0.22em; color: var(--paper);
}
.seal {
  display: inline-block;
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--hei); font-weight: 700; font-size: var(--t-sm);
  letter-spacing: 0.28em;
  color: #fff; background: var(--cinnabar);
  border: 2px solid oklch(0.949 0.020 82 / 0.55);
  padding: var(--s3) var(--s2); border-radius: var(--radius);
}
.figure-lead__title {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: 0.4em; color: var(--gold); margin: 0 0 var(--s4);
}
.figure-lead h1 { font-size: clamp(1.8rem, 4.2vw, var(--t-2xl)); letter-spacing: 0.1em; }
.figure-lead__verse {
  font-family: var(--kai); font-size: var(--t-md); line-height: 2.2;
  color: oklch(0.949 0.020 82 / 0.86);
  margin: var(--s6) 0 0; padding-left: var(--s5);
  border-left: 2px solid var(--gold);
}
.figure-lead__verse cite {
  display: block; font-family: var(--hei); font-style: normal;
  font-size: var(--t-xs); letter-spacing: 0.2em; color: var(--gold); 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);
}
.dossier__title {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: 0.36em; color: var(--ink-faint);
  margin: 0 0 var(--s5); padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
}
.dossier dl {
  margin: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s5) var(--s6);
}
.dossier dt {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: 0.24em; color: var(--ink-faint); margin-bottom: var(--s1);
}
.dossier dd { margin: 0; font-size: var(--t-base); line-height: 1.7; }
.dossier dd strong { color: var(--accent-deep); font-weight: 700; }

/* =========================================================
   正文 — 卷 / 章
   ========================================================= */
.reading {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--s9);
  align-items: start;
  padding: var(--s8) 0 var(--s9);
}

.toc { position: sticky; top: 108px; font-family: var(--hei); }
.toc__title {
  font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.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); color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid transparent; transition: all 0.2s;
}
.toc__n {
  display: block; font-size: var(--t-xs); font-weight: 500;
  letter-spacing: 0.22em; 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); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 700; color: var(--cinnabar-ink); }
.prose em { font-style: normal; border-bottom: 1px dotted var(--accent); padding-bottom: 1px; }

.chapter { margin-bottom: var(--s9); scroll-margin-top: 108px; }
.chapter:last-child { margin-bottom: 0; }
.chapter__head { margin-bottom: var(--s6); }
.chapter__num {
  display: inline-block; font-family: var(--hei); font-size: var(--t-xs);
  font-weight: 700; letter-spacing: 0.3em;
  color: var(--paper); background: var(--accent);
  padding: var(--s1) var(--s3); border-radius: var(--radius);
  margin-bottom: var(--s3);
}
.chapter__head h2 {
  font-size: var(--t-xl); letter-spacing: 0.08em; color: var(--ink);
  padding-bottom: var(--s3); border-bottom: 1px solid var(--rule);
}
.chapter__head .kicker {
  font-family: var(--kai); font-size: var(--t-base); color: var(--ink-soft);
  margin: var(--s3) 0 0;
}

/* 首章首字放大（仿古籍） */
.chapter--first .prose > p:first-of-type::first-letter {
  float: left; font-size: 3.4rem; line-height: 0.94;
  font-weight: 900; color: var(--cinnabar);
  margin: 6px var(--s3) 0 0;
  padding: var(--s2) var(--s3); border: 1px solid var(--accent-line);
  border-radius: var(--radius);
}

/* 小節 */
.beat { margin: var(--s7) 0; }
.beat > h3 {
  font-size: var(--t-md); letter-spacing: 0.06em; color: var(--accent-deep);
  margin-bottom: var(--s4);
  display: flex; align-items: baseline; gap: var(--s3);
}
.beat > h3::before {
  content: ""; flex: 0 0 14px; height: 1px; background: var(--accent);
}

/* 法器插圖（人物頁第陸章） */
.relic-plate {
  float: right; width: 210px; height: 210px;
  margin: 0 0 var(--s5) var(--s6);
  border: 1px solid var(--rule); border-radius: var(--radius);
  mix-blend-mode: multiply;
  shape-outside: inset(0 round 2px);
}

/* 引文卷軸 */
.verse {
  font-family: var(--kai); font-size: var(--t-md); line-height: 2.15;
  background: var(--paper-raised);
  border: 1px solid var(--rule); border-left: 3px solid var(--gold);
  padding: var(--s5) var(--s6);
  margin: var(--s6) 0; border-radius: var(--radius);
  color: var(--ink);
}
.verse p { margin: 0 0 var(--s2); }
.verse cite {
  display: block; font-family: var(--hei); font-style: normal;
  font-size: var(--t-xs); letter-spacing: 0.2em; color: var(--ink-faint); margin-top: var(--s3);
}

/* 旁註（考據 / 版本） */
.gloss {
  font-family: var(--hei); font-size: var(--t-sm); line-height: 1.85;
  color: var(--ink-soft);
  background: var(--paper-sunk);
  border: 1px dashed var(--rule-strong);
  padding: var(--s4) var(--s5); margin: var(--s6) 0; border-radius: var(--radius);
}
.gloss b {
  display: block; font-weight: 700; color: var(--ink);
  font-size: var(--t-xs); letter-spacing: 0.24em; margin-bottom: var(--s2);
}

/* 悟 — 人生課題 */
.insight {
  position: relative;
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  padding: var(--s7) var(--s6) var(--s6);
  margin: var(--s7) 0; border-radius: var(--radius);
}
.insight::before {
  content: "悟"; position: absolute; top: -18px; left: var(--s5);
  font-size: var(--t-md); font-weight: 900; color: #fff;
  background: var(--cinnabar);
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: var(--radius);
}
.insight h3 {
  font-size: var(--t-md); color: var(--accent-deep);
  letter-spacing: 0.08em; margin-bottom: var(--s4);
}
.insight p:last-child { margin-bottom: 0; }

/* 十試 / 編號列表 */
.trials { list-style: none; margin: var(--s6) 0; padding: 0; counter-reset: trial; }
.trials > li {
  counter-increment: trial;
  position: relative;
  padding: var(--s5) 0 var(--s5) var(--s8);
  border-top: 1px solid var(--rule);
}
.trials > li:last-child { border-bottom: 1px solid var(--rule); }
.trials > li::before {
  content: "其" counter(trial, cjk-ideographic);
  position: absolute; left: 0; top: var(--s5);
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: 0.1em; color: var(--paper); background: var(--accent-deep);
  padding: var(--s1) var(--s2); border-radius: var(--radius);
}
.trials h4 {
  font-size: var(--t-base); letter-spacing: 0.08em; color: var(--accent-deep);
  margin-bottom: var(--s2);
}
.trials p { margin: 0 0 var(--s3); }
.trials p:last-child { margin-bottom: 0; }
.trials .trials__take {
  font-family: var(--hei); font-size: var(--t-sm); color: var(--ink-soft);
  padding-left: var(--s4); border-left: 2px solid var(--accent-line);
}

/* 章回（過海本傳） */
.hui { margin-bottom: var(--s9); scroll-margin-top: 108px; }
.hui__label {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: 0.34em; color: var(--ink-faint); margin: 0 0 var(--s2);
}
.hui__title {
  font-size: var(--t-xl); letter-spacing: 0.1em;
  padding-bottom: var(--s4); margin-bottom: var(--s6);
  border-bottom: 3px double var(--gold);
}

/* 渡海表 */
.table-scroll { overflow-x: auto; margin: var(--s6) 0; }
table.ledger {
  width: 100%; border-collapse: collapse;
  font-size: var(--t-sm); font-family: var(--hei); line-height: 1.75;
  min-width: 520px;
}
table.ledger caption {
  font-family: var(--hei); font-size: var(--t-xs); font-weight: 700;
  letter-spacing: 0.26em; color: var(--ink-faint);
  text-align: left; padding-bottom: var(--s3);
}
table.ledger th, table.ledger td {
  text-align: left; padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule); vertical-align: top;
}
table.ledger thead th {
  font-weight: 700; color: var(--ink);
  border-bottom: 2px solid var(--rule-strong);
  white-space: nowrap;
}
table.ledger tbody th { font-weight: 700; color: var(--accent-deep); white-space: nowrap; }
table.ledger tbody tr:hover { background: var(--accent-wash); }

/* =========================================================
   八仙卡片（首頁）
   ========================================================= */
.figures {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: var(--s5);
}
.fcard {
  display: flex; text-decoration: none; color: inherit;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.fcard:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px oklch(0.285 0.014 60 / 0.14);
}
.fcard__spine {
  flex: 0 0 auto; background: var(--accent);
  display: flex; flex-direction: column; align-items: center; gap: var(--s4);
  padding: var(--s5) var(--s3);
}
.fcard__spine .zi {
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: var(--t-lg); font-weight: 900; letter-spacing: 0.16em; color: var(--paper);
}
.fcard__spine .seal { font-size: var(--t-xs); letter-spacing: 0.2em; padding: var(--s2) 3px; }
.fcard__body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.fcard__body h3 { font-size: var(--t-md); letter-spacing: 0.05em; color: var(--ink); }
.fcard__meta {
  font-family: var(--hei); font-size: var(--t-xs); letter-spacing: 0.16em;
  color: var(--ink-faint);
}
.fcard__body p { margin: 0; font-size: var(--t-sm); line-height: 1.8; color: var(--ink-soft); }
.fcard__more {
  margin-top: auto; font-family: var(--hei); font-size: var(--t-xs);
  font-weight: 700; letter-spacing: 0.2em; color: var(--accent-deep);
}
.fcard:hover .fcard__more { color: var(--cinnabar); }

/* 八境對照 */
.eight-states {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s4); margin: var(--s7) 0 0; padding: 0; list-style: none;
}
.eight-states li {
  background: var(--paper-raised);
  border: 1px solid var(--rule); border-bottom: 3px solid var(--accent);
  padding: var(--s4) var(--s5); border-radius: var(--radius);
}
.eight-states .glyph {
  display: block; font-size: var(--t-xl); font-weight: 900;
  color: var(--accent); line-height: 1.2;
}
.eight-states .who {
  display: block; font-family: var(--hei); font-size: var(--t-sm);
  letter-spacing: 0.14em; color: var(--ink); margin-top: var(--s2);
}
.eight-states .what {
  display: block; font-size: var(--t-sm); color: var(--ink-soft); margin-top: var(--s1);
}

/* 暗八仙法器 */
.relics { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s5); }
.relic {
  display: flex; flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  padding: var(--s5); border-radius: var(--radius);
}
.relic__plate {
  width: 100%; height: 148px; object-fit: contain;
  mix-blend-mode: multiply;
  margin-bottom: var(--s4); padding-bottom: var(--s4);
  border-bottom: 1px solid var(--rule);
}
.relic h4 { font-size: var(--t-md); color: var(--accent-deep); letter-spacing: 0.06em; }
.relic .owner {
  font-family: var(--hei); font-size: var(--t-xs); letter-spacing: 0.2em;
  color: var(--ink-faint); margin: var(--s2) 0 var(--s3);
}
.relic p { margin: 0; font-size: var(--t-sm); line-height: 1.85; color: var(--ink-soft); }

/* =========================================================
   翻頁 / 頁尾
   ========================================================= */
.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 0.2s;
}
.pager a:hover { border-color: var(--cinnabar); background: var(--paper-sunk); }
.pager .dir {
  display: block; font-family: var(--hei); font-size: var(--t-xs);
  letter-spacing: 0.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.949 0.020 82 / 0.72);
  border-top: 5px solid var(--cinnabar);
  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: 0.28em; color: var(--gold); 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.949 0.020 82 / 0.72); text-decoration: none; }
.site-foot a:hover { color: var(--gold); text-decoration: underline; }
.site-foot__coda {
  border-top: 1px solid oklch(0.949 0.020 82 / 0.18);
  padding-top: var(--s5); text-align: center;
  font-family: var(--kai); font-size: var(--t-base);
  color: oklch(0.949 0.020 82 / 0.6); letter-spacing: 0.1em;
}

/* =========================================================
   響應式
   ========================================================= */
@media (max-width: 1040px) {
  .reading { grid-template-columns: 1fr; gap: var(--s6); }
  .toc {
    position: static;
    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(--s1) var(--s3); }
  .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.55rem; }
  .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.949 0.020 82 / 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;
    border: none; border-left: 2px solid var(--gold);
    box-shadow: none; margin-left: var(--s3);
  }
  .scroll-head--figure .scroll-head__inner { grid-template-columns: 1fr; gap: var(--s6); }
  .figure-name { flex-direction: row; justify-content: center; padding: var(--s4); }
  .figure-name__zi { writing-mode: horizontal-tb; letter-spacing: 0.3em; margin-left: 0.3em; }
  .seal { writing-mode: horizontal-tb; letter-spacing: 0.24em; margin-left: 0.24em; padding: var(--s2) var(--s3); }
  .pager { grid-template-columns: 1fr; }
  .pager .pager__next { text-align: left; }
  .pager .pager__empty { display: none; }
  .wrap { padding: 0 var(--s4); }
  .scroll-head__inner { padding: var(--s8) var(--s4); }
  .relic__plate { height: 124px; }
  .relic-plate { float: none; width: 100%; height: auto; aspect-ratio: 1; margin: 0 0 var(--s5); }
  .chapter--first .prose > p:first-of-type::first-letter { font-size: 2.6rem; }
}

@media print {
  .topbar, .toc, .pager, .nav__toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .scroll-head { background: #fff; color: #000; border-bottom: 2px solid #000; }
  .reading { grid-template-columns: 1fr; }
  .chapter { break-inside: auto; }
  .chapter__head, .hui__title { break-after: avoid; }
}
