:root {
  --paper: #f2eadb;
  --paper-deep: #e7dbc7;
  --ink: #24231f;
  --muted: #716c62;
  --line: #c9bda9;
  --red: #9d3028;
  --blue: #244c5a;
  --sidebar: 292px;
  color-scheme: light;
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22; z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}
a { color: inherit; }
.reading-progress { position: fixed; top: 0; left: var(--sidebar); right: 0; height: 3px; z-index: 50; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--red); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 34px 28px 24px;
  background: #e8ddca; border-right: 1px solid var(--line); z-index: 30; overflow-y: auto;
}
.brand { display: flex; gap: 13px; align-items: center; text-decoration: none; font-weight: 700; letter-spacing: .06em; }
.brand-mark { display: grid; place-items: center; width: 42px; aspect-ratio: 1; color: var(--paper); background: var(--red); border-radius: 50% 48% 52% 45%; font-size: 20px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10px; font-weight: 500; letter-spacing: .12em; }
.search { display: block; margin: 34px 0 22px; font-family: ui-sans-serif, system-ui, sans-serif; }
.search span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.search input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 2px; outline: none; color: var(--ink); background: rgba(255,255,255,.28); font-size: 13px; }
.search input:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(157,48,40,.08); }
.sidebar nav { display: grid; }
.sidebar nav a { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 9px 4px; border-bottom: 1px solid rgba(113,108,98,.18); text-decoration: none; font-size: 12px; line-height: 1.45; }
.sidebar nav a span { color: var(--red); font-family: ui-monospace, monospace; font-size: 10px; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--red); transform: translateX(3px); }
.sidebar-foot { display: flex; justify-content: space-between; margin-top: 24px; color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10px; letter-spacing: .08em; }
main { margin-left: var(--sidebar); }
.cover { min-height: 100vh; padding: 12vh clamp(32px, 8vw, 128px) 9vh; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.cover::after { content: ""; position: absolute; right: 7vw; top: 8vh; width: 1px; height: 70vh; background: var(--line); transform: rotate(13deg); transform-origin: top; }
.cover-orbit { position: absolute; right: 8vw; top: 16vh; width: min(32vw, 420px); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; }
.cover-orbit::before, .cover-orbit::after { content: ""; position: absolute; border: 1px solid var(--line); border-radius: 50%; }
.cover-orbit::before { inset: 15%; } .cover-orbit::after { inset: 35%; background: var(--red); border: 0; }
.cover-orbit i { position: absolute; width: 9px; aspect-ratio: 1; border-radius: 50%; background: var(--blue); }
.cover-orbit i:nth-child(1) { top: 3%; left: 48%; }.cover-orbit i:nth-child(2) { top: 55%; left: 14%; }.cover-orbit i:nth-child(3) { bottom: 10%; right: 15%; }
.eyebrow { position: relative; z-index: 2; margin: 0 0 42px; color: var(--red); font: 600 11px/1.4 ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase; }
.intro { position: relative; z-index: 2; max-width: 760px; }
.intro > h1 { max-width: 8em; margin: 0 0 28px; font-size: clamp(48px, 7.2vw, 108px); font-weight: 600; line-height: .98; letter-spacing: -.055em; }
.intro > blockquote { max-width: 520px; margin: 0 0 72px; padding-left: 18px; border-left: 3px solid var(--red); color: var(--muted); font-size: clamp(17px, 2vw, 23px); line-height: 1.75; }
.intro > h2, .intro > h2 ~ * { display: none; }
.begin { position: absolute; z-index: 3; bottom: 8vh; left: clamp(32px, 8vw, 128px); display: inline-flex; gap: 24px; align-items: center; color: var(--red); font: 600 12px ui-sans-serif, system-ui, sans-serif; letter-spacing: .1em; text-decoration: none; }
.begin span { font-size: 20px; }
.chapter { max-width: 900px; margin: 0 auto; padding: 110px clamp(28px, 7vw, 92px); border-bottom: 1px solid var(--line); }
.chapter-heading { margin-bottom: 78px; }
.chapter-kicker { color: var(--red); font: 700 11px ui-monospace, monospace; letter-spacing: .2em; }
.chapter-heading h1 { max-width: 15em; margin: 14px 0 0; font-size: clamp(36px, 5vw, 64px); font-weight: 600; line-height: 1.12; letter-spacing: -.035em; }
.fable { position: relative; margin: 0 0 104px; scroll-margin-top: 40px; }
.fable::before { content: ""; position: absolute; top: 17px; left: -45px; width: 25px; height: 1px; background: var(--red); }
.fable h2, .chapter-note h2 { margin: 0 0 30px; font-size: clamp(25px, 3vw, 34px); font-weight: 600; line-height: 1.35; }
.fable p, .chapter-note p, .chapter-note li { font-size: 17px; line-height: 1.95; text-align: justify; }
.fable p { margin: 0 0 1.1em; }
.fable p strong:first-child { color: var(--red); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; letter-spacing: .06em; }
.fable ul, .chapter-note ul { padding-left: 1.4em; }
.fable li { margin: .45em 0; line-height: 1.75; }
.fable code { padding: .12em .35em; background: var(--paper-deep); font-size: .88em; }
.chapter-note { margin-bottom: 72px; }
.chapter-note blockquote { margin: 0 0 36px; padding: 10px 22px; border-left: 3px solid var(--blue); color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--red); font-size: 11px; letter-spacing: .06em; }
hr { margin: 70px 0; border: 0; border-top: 1px solid var(--line); }
#no-results { margin: 18vh auto; padding: 0 30px; max-width: 680px; color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; gap: 28px; padding: 48px clamp(28px, 7vw, 92px); color: var(--muted); font-size: 13px; }
footer a { color: var(--red); text-decoration: none; }
.nav-toggle { display: none; }

@media (max-width: 820px) {
  :root { --sidebar: 0px; }
  .sidebar { width: min(84vw, 330px); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 12px 0 32px rgba(36,35,31,.16); }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-toggle { display: block; position: fixed; right: 16px; top: 15px; z-index: 40; padding: 9px 12px; border: 1px solid var(--line); color: var(--ink); background: var(--paper); font: 12px ui-sans-serif, system-ui, sans-serif; }
  main { margin-left: 0; }
  .reading-progress { left: 0; }
  .cover { padding-top: 15vh; }
  .cover-orbit { right: -20vw; top: 12vh; width: 70vw; opacity: .62; }
  .cover::after { display: none; }
  .intro > h1 { font-size: clamp(48px, 14vw, 76px); }
  .chapter { padding-top: 82px; }
  .fable::before { display: none; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
