:root {
  --paper: #f4f5f2;
  --surface: #ffffff;
  --ink: #18201c;
  --muted: #68716b;
  --line: #d7dcd7;
  --forest: #235045;
  --cinnabar: #a63d32;
  --hero-ink: #fffdf7;
  --max: 1180px;
  --reader: 720px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 8px 12px;
  background: white;
  color: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100% - var(--max)) / 2));
  color: var(--hero-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}
.site-header.scrolled,
.site-header.inner-header {
  background: rgba(244, 245, 242, 0.96);
  color: var(--ink);
  border-color: var(--line);
  backdrop-filter: blur(12px);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-weight: 750; text-decoration: none; }
.wordmark-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--cinnabar);
  color: white;
  font-family: "Songti SC", "STSong", serif;
  font-size: 17px;
}
.site-nav { display: flex; gap: 30px; align-items: center; }
.site-nav a, .header-back { color: inherit; font-size: 14px; text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible, .header-back:hover, .header-back:focus-visible { text-decoration: underline; text-underline-offset: 5px; }

.hero {
  position: relative;
  min-height: min(760px, 86svh);
  display: flex;
  align-items: flex-end;
  background: url("assets/writing-desk.jpg") center center / cover no-repeat;
  color: var(--hero-ink);
  isolation: isolate;
}
.hero::before { content: ""; position: absolute; z-index: -1; inset: 0; background: rgba(11, 17, 14, 0.52); }
.hero-content { width: min(var(--max), calc(100% - 56px)); margin: 0 auto; padding: 150px 0 108px; }
.kicker, .section-index { margin: 0; color: var(--cinnabar); font-size: 12px; font-weight: 750; line-height: 1.4; text-transform: uppercase; }
.hero .kicker { color: rgba(255, 255, 255, 0.72); }
.hero h1 {
  margin: 20px 0 22px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 76px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0;
}
.hero-copy { max-width: 610px; margin: 0 0 34px; color: rgba(255,255,255,0.84); font-size: 18px; }
.primary-link { display: inline-flex; align-items: center; gap: 18px; padding: 9px 0 6px; border-bottom: 1px solid rgba(255,255,255,0.7); color: white; font-weight: 650; text-decoration: none; }
.hero-ledger {
  position: absolute;
  right: max(28px, calc((100% - var(--max)) / 2));
  bottom: 108px;
  display: flex;
  gap: 36px;
  margin: 0;
}
.hero-ledger div { min-width: 94px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,0.38); }
.hero-ledger dt { color: rgba(255,255,255,0.62); font-size: 11px; }
.hero-ledger dd { margin: 3px 0 0; font-family: "Songti SC", "STSong", serif; font-size: 30px; line-height: 1.1; }

.section { width: min(var(--max), calc(100% - 56px)); margin: 0 auto; padding: 106px 0 116px; }
.section-heading { display: grid; grid-template-columns: minmax(130px, 0.65fr) minmax(0, 2fr); gap: 40px; margin-bottom: 58px; }
.section-heading h2, .ledger-section h2, .about-section h2, .directory-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 42px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}
.section-heading p:not(.section-index) { max-width: 640px; margin: 13px 0 0; color: var(--muted); }

.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 64px 38px; }
.work-card { min-width: 0; }
.work-cover {
  --cover: var(--forest);
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px;
  border-radius: 3px;
  background: var(--cover);
  box-shadow: 0 18px 34px rgba(20, 29, 24, 0.14);
  color: #fffdf7;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.work-cover::before { content: ""; position: absolute; top: 0; bottom: 0; left: 18px; width: 1px; background: currentColor; opacity: 0.22; }
.work-cover:hover, .work-cover:focus-visible { transform: translateY(-5px); box-shadow: 0 24px 42px rgba(20, 29, 24, 0.2); }
.cover-order { font-size: 10px; font-weight: 750; }
.work-cover strong { max-width: 9em; font-family: "Songti SC", "STSong", serif; font-size: 34px; font-weight: 600; line-height: 1.3; }
.cover-type { align-self: flex-end; max-width: 75%; font-size: 11px; line-height: 1.5; text-align: right; }
.work-card-copy { padding-top: 22px; }
.work-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 12px; }
.status-badge { display: inline-block; padding: 2px 7px; border: 1px solid var(--line); border-radius: 3px; font-size: 11px; font-weight: 750; }
.status-badge.complete { border-color: #87a89a; color: var(--forest); }
.status-badge.creating { border-color: #d5a29a; color: var(--cinnabar); }
.work-card h3 { margin: 10px 0 8px; font-family: "Songti SC", "STSong", serif; font-size: 23px; line-height: 1.35; }
.work-card h3 a { text-decoration: none; }
.work-card-copy > p { min-height: 5.1em; margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.text-link { display: inline-flex; gap: 9px; padding-bottom: 3px; border-bottom: 1px solid currentColor; color: var(--ink); font-size: 13px; font-weight: 650; text-decoration: none; }
.text-link:hover, .text-link:focus-visible { color: var(--cinnabar); }

.ledger-section { background: #18201c; color: #f5f4ee; }
.ledger-inner { width: min(var(--max), calc(100% - 56px)); margin: 0 auto; padding: 88px 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr); gap: 90px; align-items: end; }
.ledger-section .section-index { color: #d87566; }
.ledger-section h2 { max-width: 660px; margin-top: 35px; font-size: 46px; }
.series-ledger { margin: 0; }
.series-ledger div { display: flex; align-items: baseline; justify-content: space-between; gap: 30px; padding: 13px 0; border-bottom: 1px solid #3c4741; }
.series-ledger dt { color: #9ba79f; }
.series-ledger dd { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 32px; }

.reading-list { border-top: 1px solid var(--ink); }
.reading-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 42px; gap: 24px; align-items: center; padding: 25px 0; border-bottom: 1px solid var(--line); }
.reading-number { align-self: start; margin-top: 3px; color: var(--cinnabar); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.reading-row p { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.reading-row h3 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 22px; line-height: 1.45; }
.reading-row h3 a { text-decoration: none; }
.reading-row h3 a:hover, .reading-row h3 a:focus-visible { color: var(--cinnabar); }
.row-arrow { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; text-decoration: none; }
.row-arrow:hover, .row-arrow:focus-visible { border-color: var(--ink); background: var(--ink); color: white; }

.about-section { background: #e7ebe7; }
.about-inner { width: min(var(--max), calc(100% - 56px)); margin: 0 auto; padding: 92px 0 100px; display: grid; grid-template-columns: minmax(120px, 0.5fr) minmax(0, 1.15fr) minmax(320px, 0.85fr); gap: 50px; }
.about-section h2 { font-size: 36px; }
.about-copy { columns: 1; }
.about-copy p { margin: 0 0 17px; color: #4f5b54; font-size: 14px; }
.about-copy strong { display: block; margin-bottom: 2px; color: var(--ink); }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 28px max(28px, calc((100% - var(--max)) / 2)); background: #101612; color: #cbd2cd; font-size: 12px; }
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }
.noscript, .fatal-error { position: fixed; z-index: 50; right: 12px; bottom: 12px; margin: 0; padding: 8px 12px; background: var(--cinnabar); color: white; }

/* Work directory */
.inner-page { padding-top: 76px; }
.work-hero { background: #e9ece8; border-bottom: 1px solid var(--line); }
.work-hero-inner { width: min(var(--max), calc(100% - 56px)); min-height: 590px; margin: 0 auto; padding: 82px 0; display: grid; grid-template-columns: minmax(0, 1.25fr) 300px; gap: 110px; align-items: center; }
.work-title-copy .work-status-line { margin: 30px 0 13px; }
.work-title-copy h1 { max-width: 760px; margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 58px; font-weight: 600; line-height: 1.15; letter-spacing: 0; }
.work-type { margin: 13px 0 0; color: var(--cinnabar); font-size: 14px; font-weight: 650; }
.work-summary { max-width: 700px; margin: 24px 0 30px; color: #4e5952; font-size: 17px; }
.work-counts { display: flex; gap: 48px; margin: 0; }
.work-counts div { padding-left: 13px; border-left: 2px solid #c8ceca; }
.work-counts dt { color: var(--muted); font-size: 11px; }
.work-counts dd { margin: 2px 0 0; font-family: "Songti SC", "STSong", serif; font-size: 26px; }
.single-cover {
  --cover: var(--forest);
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 25px;
  border-radius: 3px;
  background: var(--cover);
  box-shadow: 0 22px 44px rgba(20, 29, 24, 0.18);
  color: white;
}
.single-cover span, .single-cover small { font-size: 10px; font-weight: 700; }
.single-cover strong { font-family: "Songti SC", "STSong", serif; font-size: 31px; line-height: 1.3; }
.single-cover small { align-self: flex-end; max-width: 80%; text-align: right; }
.work-directory { width: min(var(--max), calc(100% - 56px)); margin: 0 auto; padding: 92px 0 112px; }
.directory-heading { display: grid; grid-template-columns: minmax(130px, 0.65fr) minmax(0, 2fr); gap: 40px; margin-bottom: 48px; }
.volume-section { scroll-margin-top: 92px; padding: 0; border-top: 1px solid var(--ink); }
.volume-header { display: flex; justify-content: space-between; gap: 30px; padding: 30px 0 25px; }
.volume-header p { margin: 0 0 5px; color: var(--cinnabar); font-size: 11px; }
.volume-header h3 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 27px; font-weight: 600; }
.volume-state { display: flex; align-items: flex-end; flex-direction: column; gap: 5px; }
.volume-state small { color: var(--muted); }
.chapter-list { padding-bottom: 48px; }
.chapter-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 78px; gap: 20px; align-items: center; min-height: 62px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.chapter-row.published:hover, .chapter-row.published:focus-visible { background: #ecefeb; }
.chapter-order { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.chapter-title { line-height: 1.45; }
.chapter-action { color: var(--muted); font-size: 12px; text-align: right; }
.chapter-row.published .chapter-action { color: var(--cinnabar); }
.chapter-row.creating { color: #7a817d; }
.empty-volume { margin: 0 0 45px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); }
.inner-footer { align-items: center; }

/* Reader */
.reader-page { background: #f8f8f5; padding-top: 76px; }
.reading-progress { position: fixed; z-index: 50; top: 0; left: 0; width: 100%; height: 3px; background: transparent; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--cinnabar); }
.reader-shell { width: min(1120px, calc(100% - 56px)); margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, var(--reader)); gap: 80px; align-items: start; padding: 74px 0 100px; }
.reader-aside { position: sticky; top: 112px; max-height: calc(100svh - 140px); overflow: auto; padding-right: 24px; border-right: 1px solid var(--line); }
.aside-work { margin: 0 0 5px; color: var(--cinnabar); font-size: 11px; font-weight: 750; }
.reader-aside h2 { margin: 0 0 18px; font-family: "Songti SC", "STSong", serif; font-size: 20px; line-height: 1.35; }
.reader-aside ol { margin: 0; padding: 0; list-style: none; counter-reset: aside; }
.reader-aside li { position: relative; padding: 8px 0 8px 20px; color: var(--muted); font-size: 12px; line-height: 1.45; counter-increment: aside; }
.reader-aside li::before { content: counter(aside, decimal-leading-zero); position: absolute; left: 0; color: #a2aaa5; font-family: ui-monospace, monospace; font-size: 9px; }
.reader-aside li.current { color: var(--ink); font-weight: 700; }
.reader-aside a { text-decoration: none; }
.aside-creating { display: flex; flex-direction: column; }
.aside-creating small { color: var(--cinnabar); }
.reader-article { min-width: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--cinnabar); }
.reader-title { padding: 27px 0 32px; border-bottom: 1px solid var(--line); }
.reader-title h1 { margin: 14px 0 0; font-family: "Songti SC", "STSong", serif; font-size: 44px; font-weight: 600; line-height: 1.3; letter-spacing: 0; }
.reader-body { padding: 35px 0 45px; }
.loading-copy, .reader-error { color: var(--muted); }
.chapter-source { color: #242b27; font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif; overflow-wrap: anywhere; }
.chapter-source p { margin: 0 0 1.45em; font-size: 18px; line-height: 2; }
.chapter-source h2, .chapter-source h3, .chapter-source h4 { margin: 2em 0 0.8em; color: var(--ink); font-weight: 650; line-height: 1.4; letter-spacing: 0; }
.chapter-source h2 { font-size: 29px; }
.chapter-source h3 { font-size: 24px; }
.chapter-source h4 { font-size: 20px; }
.chapter-source ul, .chapter-source ol { margin: 0 0 1.5em; padding-left: 1.5em; }
.chapter-source li { margin-bottom: 0.45em; font-size: 17px; line-height: 1.85; }
.chapter-source blockquote { margin: 1.8em 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--cinnabar); color: #4f5a54; }
.chapter-source blockquote p { margin-bottom: 0.8em; }
.chapter-source hr { margin: 36px 0; border: 0; border-top: 1px solid var(--line); }
.chapter-source a { color: var(--forest); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.chapter-source strong { color: #101512; }
.chapter-source img { display: block; max-width: 100%; height: auto; margin: 32px auto; border-radius: 4px; }
.chapter-source table { width: 100%; margin: 28px 0; border-collapse: collapse; font-family: "SF Pro Text", "PingFang SC", sans-serif; font-size: 13px; }
.chapter-source th, .chapter-source td { padding: 10px 9px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.chapter-source th { background: #ecefeb; }
.chapter-source pre { overflow: auto; margin: 28px 0; padding: 18px; border-radius: 6px; background: #18201c; color: #f3f5f1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.7; }
.chapter-source code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.chapter-source > ul:first-child { padding: 18px 20px 18px 38px; border: 1px solid var(--line); border-radius: 6px; background: #f0f2ef; font-family: "SF Pro Text", "PingFang SC", sans-serif; }
.chapter-source > ul:first-child li { margin: 0; color: var(--muted); font-size: 12px; }
.chapter-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-top: 28px; border-top: 1px solid var(--line); }
.chapter-navigation a { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.chapter-navigation .next { text-align: right; }
.chapter-navigation span { color: var(--cinnabar); font-size: 11px; }
.chapter-navigation strong { font-family: "Songti SC", "STSong", serif; font-size: 16px; line-height: 1.45; }
.reader-footer { padding: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.reader-footer p { margin: 0; }

.empty-state { width: min(720px, calc(100% - 40px)); margin: 0 auto; padding: 150px 0; }
.empty-state h1 { margin: 15px 0; font-family: "Songti SC", "STSong", serif; font-size: 44px; }
.empty-state > p:not(.section-index) { margin-bottom: 25px; color: var(--muted); }

@media (max-width: 900px) {
  .site-header { height: 68px; padding: 0 20px; }
  .hero { min-height: min(720px, 88svh); background-position: 58% center; }
  .hero-content { width: calc(100% - 40px); padding: 130px 0 120px; }
  .hero h1 { font-size: 58px; }
  .hero-ledger { right: 20px; bottom: 70px; }
  .section { width: calc(100% - 40px); padding: 78px 0 88px; }
  .section-heading { grid-template-columns: 1fr; gap: 18px; margin-bottom: 42px; }
  .section-heading h2, .ledger-section h2 { font-size: 36px; }
  .work-grid { gap: 48px 25px; }
  .work-cover { padding: 21px; }
  .work-cover strong { font-size: 28px; }
  .ledger-inner { width: calc(100% - 40px); grid-template-columns: 1fr; gap: 50px; padding: 72px 0; }
  .about-inner { width: calc(100% - 40px); grid-template-columns: 1fr 1.7fr; gap: 28px; padding: 72px 0 80px; }
  .about-copy { grid-column: 2; }
  .inner-page, .reader-page { padding-top: 68px; }
  .work-hero-inner { width: calc(100% - 40px); min-height: 520px; grid-template-columns: minmax(0, 1fr) 230px; gap: 55px; }
  .work-title-copy h1 { font-size: 46px; }
  .work-directory { width: calc(100% - 40px); }
  .reader-shell { width: min(var(--reader), calc(100% - 40px)); display: block; padding-top: 55px; }
  .reader-aside { position: static; max-height: none; margin-bottom: 45px; padding: 0 0 25px; border-right: 0; border-bottom: 1px solid var(--line); }
  .reader-aside ol { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
}

@media (max-width: 620px) {
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 12px; }
  .site-nav a:nth-child(2) { display: none; }
  .wordmark > span:last-child { display: none; }
  .hero { min-height: min(700px, 86svh); background-position: 66% center; }
  .hero-content { width: calc(100% - 32px); padding-bottom: 150px; }
  .hero h1 { font-size: 48px; }
  .hero-copy { max-width: 340px; font-size: 16px; }
  .hero-ledger { left: 16px; right: auto; bottom: 48px; }
  .hero-ledger div { min-width: 82px; }
  .section { width: calc(100% - 32px); padding: 64px 0 74px; }
  .section-heading h2, .ledger-section h2, .about-section h2 { font-size: 31px; }
  .work-grid { grid-template-columns: 1fr; gap: 54px; }
  .work-cover { width: min(100%, 360px); }
  .work-card-copy { width: min(100%, 360px); }
  .work-card-copy > p { min-height: 0; }
  .ledger-inner { width: calc(100% - 32px); }
  .reading-row { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .row-arrow { display: none; }
  .reading-row h3 { font-size: 20px; }
  .about-inner { width: calc(100% - 32px); grid-template-columns: 1fr; }
  .about-copy { grid-column: auto; }
  .site-footer { flex-direction: column; padding: 24px 16px; }
  .work-hero-inner { width: calc(100% - 32px); min-height: 0; grid-template-columns: 1fr; gap: 50px; padding: 64px 0; }
  .work-title-copy h1 { font-size: 40px; }
  .single-cover { width: min(260px, 76vw); order: -1; }
  .work-directory { width: calc(100% - 32px); padding: 68px 0 82px; }
  .directory-heading { grid-template-columns: 1fr; gap: 14px; }
  .volume-header { align-items: flex-start; }
  .volume-state { max-width: 130px; text-align: right; }
  .chapter-row { grid-template-columns: 25px minmax(0, 1fr); gap: 10px; padding: 13px 0; }
  .chapter-action { grid-column: 2; text-align: left; }
  .reader-shell { width: calc(100% - 32px); padding: 42px 0 72px; }
  .reader-aside ol { grid-template-columns: 1fr; }
  .reader-title h1 { font-size: 34px; }
  .chapter-source p { font-size: 17px; line-height: 1.95; }
  .chapter-source li { font-size: 16px; }
  .chapter-source table { display: block; overflow-x: auto; }
  .chapter-navigation { grid-template-columns: 1fr; }
  .chapter-navigation .next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
