:root {
  --paper: #f3ead6;
  --paper-2: #ebe1c8;
  --ink: #1c1712;
  --ink-soft: #3a3229;
  --muted: #6b5e4e;
  --cinnabar: #9e1c14;
  --cinnabar-deep: #6e120d;
  --gold: #8a6a32;
  --rule: #d7c7a8;
  --card: #fff8ea;
  --shadow: rgba(40, 24, 8, .12);
  --max: 42rem;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(158,28,20,.06), transparent 55%),
    radial-gradient(900px 500px at 110% 8%, rgba(138,106,50,.08), transparent 50%),
    var(--paper);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: 18px;
  line-height: 1.9;
  letter-spacing: .02em;
}
body.book { font-size: 17px; }
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 8; opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
a { color: var(--cinnabar); text-underline-offset: .18em; }
a:hover { color: var(--cinnabar-deep); }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 12px; background: var(--card); padding: 8px 12px; z-index: 20; }
.topbar {
  position: sticky; top: 0; z-index: 12;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 28px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: baseline; gap: 12px;
  text-decoration: none; color: inherit;
}
.brand b {
  font-family: Syne, sans-serif;
  letter-spacing: .18em;
  font-size: 13px;
  color: var(--cinnabar);
}
.brand span { color: var(--muted); font-size: 13px; }
.topbar nav {
  display: flex; gap: 14px; font-size: 13px; align-items: center; flex-wrap: wrap;
}
.topbar nav a { color: var(--ink-soft); text-decoration: none; }
.topbar nav a[aria-current="page"] { color: var(--cinnabar); }
.toc-btn {
  display: none;
  background: transparent; border: 1px solid var(--rule);
  color: var(--ink); padding: 4px 10px; font: inherit; cursor: pointer;
}
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, var(--max)) 1fr;
  gap: 0 40px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px 80px;
}
body.book .layout { --max: 46rem; }
html[lang="en"] body {
  font-family: Fraunces, "Noto Serif SC", Georgia, serif;
  letter-spacing: .004em;
  line-height: 1.78;
}
html[lang="en"] .hero h1 {
  letter-spacing: -.02em;
  font-size: clamp(1.85rem, 4.8vw, 3.05rem);
  padding-right: 92px;
}
html[lang="en"] .byline .who { letter-spacing: .06em; }
.lang { display: flex; border: 1px solid var(--rule); }
.lang button {
  background: transparent; border: 0; color: var(--muted);
  font-family: Syne, sans-serif; font-size: 11px; letter-spacing: .16em;
  padding: 5px 11px; cursor: pointer;
}
.lang button[aria-pressed="true"] {
  background: var(--cinnabar); color: var(--paper);
}
.layout > .toc { grid-column: 1; grid-row: 1; }
.layout > article { grid-column: 2; grid-row: 1; }
.pane-off { display: none !important; }
.toc {
  position: sticky; top: 64px;
  align-self: start;
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 36px 0 24px;
  font-size: 12.5px;
  line-height: 1.45;
}
.toc h2 {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--gold);
  font-weight: 700;
}
.toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
}
.toc a.h2 { padding-left: 22px; font-size: 12px; }
.toc a:hover, .toc a.active {
  color: var(--cinnabar);
  border-left-color: var(--cinnabar);
}
article { padding: 12px 0 40px; min-width: 0; }
.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.kicker {
  font-family: Syne, sans-serif;
  font-size: 11px;
  letter-spacing: .34em;
  color: var(--cinnabar);
  margin: 0 0 18px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: .04em;
  padding-right: 96px;
}
.hero .sub {
  margin: 18px 0 0;
  font-size: 1.25rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.hero .kicker2 {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
}
.byline {
  margin: 22px 0 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 18px;
  font-size: 15px; color: var(--ink-soft);
}
.byline .who { font-weight: 700; letter-spacing: .18em; }
.byline a {
  color: var(--muted); text-decoration: none;
  font-family: Fraunces, "Noto Serif SC", serif;
}
.byline a:hover { color: var(--cinnabar); }
.note {
  margin: 22px 0 0;
  padding: 10px 0 10px 16px;
  border-left: 3px solid var(--gold);
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}
.seal {
  position: absolute; right: 0; top: 72px;
  width: 84px; height: 84px;
  border: 3px solid var(--cinnabar);
  color: var(--cinnabar);
  display: grid; place-items: center;
  font-weight: 900; font-size: 28px;
  transform: rotate(-12deg);
  opacity: .88;
  box-shadow: inset 0 0 0 2px var(--cinnabar);
}
.lede { margin: 28px 0 0; font-size: 1.12rem; color: var(--ink-soft); }
.lede::first-letter {
  float: left; font-size: 3.4rem; line-height: .85;
  padding: 8px 10px 0 0; color: var(--cinnabar); font-weight: 900;
}
h1.ch, h2.sec, article h1, article h2 {
  scroll-margin-top: 76px;
}
h2.sec, article h2 {
  margin: 3.2rem 0 1rem;
  font-size: 1.45rem;
  line-height: 1.35;
  font-weight: 800;
}
h2.sec small, article h2 small {
  display: block;
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--cinnabar);
  font-weight: 700;
  margin-bottom: 6px;
}
article h1 {
  margin: 3.6rem 0 1rem;
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.3;
}
article h3 {
  margin: 2rem 0 .7rem;
  font-size: 1.12rem;
  font-weight: 800;
  scroll-margin-top: 76px;
}
p { margin: 0 0 1.05em; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 1.4em 0 1.6em;
}
.stat {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 14px 14px 12px;
  box-shadow: 0 8px 24px var(--shadow);
}
.stat b {
  display: block;
  font-family: Fraunces, "Noto Serif SC", serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--cinnabar-deep);
  letter-spacing: 0;
  line-height: 1.2;
}
.stat span { font-size: 12px; color: var(--muted); }
.formula {
  margin: 1.2em 0 1.4em;
  padding: 16px 18px;
  background: #1c1712;
  color: #f3ead6;
  font-family: Fraunces, "Noto Serif SC", serif;
  letter-spacing: .03em;
  box-shadow: 0 12px 30px var(--shadow);
}
.formula .lbl {
  font-family: Syne, sans-serif;
  font-size: 10px;
  letter-spacing: .22em;
  color: #d9a39a;
  margin-bottom: 8px;
}
.formula p { margin: 0; color: #f3ead6; font-size: 1.05rem; }
blockquote, blockquote.pull {
  margin: 1.6em 0;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--cinnabar);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.7;
  color: var(--cinnabar-deep);
}
.close {
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}
.close .final {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.7;
}
footer.site {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule);
  padding: 28px 0 12px;
  color: var(--muted);
  font-size: 13px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.mask {
  display: none;
  position: fixed; inset: 0; background: rgba(28,23,18,.35); z-index: 14;
}
figure.fig {
  margin: 1.6em 0 1.8em;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 12px 12px 10px;
  box-shadow: 0 8px 24px var(--shadow);
}
figure.fig img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
figure.fig figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.45;
  margin: 1em 0 1.5em;
}
article th, article td {
  border: 1px solid var(--rule);
  padding: 7px 8px;
  vertical-align: top;
}
article th { background: var(--paper-2); font-weight: 700; }
article hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.2em 0;
}
article ul, article ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.footnote { font-size: 14px; color: var(--ink-soft); }
.footnote ol { padding-left: 1.3em; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 0 18px 64px; }
  .toc {
    display: none; position: fixed; top: 48px; left: 0; bottom: 0;
    width: min(82vw, 320px); background: var(--paper);
    padding: 20px; z-index: 15; box-shadow: 8px 0 30px var(--shadow);
    max-height: none;
  }
  body.toc-open .toc, body.toc-open .mask { display: block; }
  .toc-btn { display: inline-block; }
  .seal { display: none; }
  .stats { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; }
  .hero h1 { padding-right: 0; }
}
@media print {
  .topbar, .toc, .toc-btn, .lang, body::before, .mask { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .layout { display: block; max-width: none; }
  a { color: inherit; text-decoration: none; }
  .formula { background: #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
