@font-face {
  font-family: "Tsanger";
  src: url("./assets/TsangerJinKai02-W04.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("./assets/Inter.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("./assets/Inter-600.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

:root {
  --paper: #f4efe4;
  --paper-deep: #eae2d3;
  --ink: #17243b;
  --muted: #66707f;
  --rule: rgba(23, 36, 59, 0.16);
  --accent: #b4563f;
  --accent-soft: #ead0c5;
  --blue-soft: #dce4eb;
  --white: #fffdf8;
  --serif: "Tsanger", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", serif;
  --sans: "Inter", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(180, 86, 63, 0.12), transparent 29rem),
    radial-gradient(circle at 95% 15%, rgba(80, 105, 130, 0.10), transparent 28rem),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.75;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 0 5vw;
  color: var(--white);
  background: rgba(23, 36, 59, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.topbar nav {
  display: flex;
  gap: 1.4rem;
}

.topbar nav a {
  color: rgba(255, 253, 248, 0.78);
  font-size: 0.82rem;
  text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a:focus-visible { color: #fff; }

main { overflow: hidden; }

.hero {
  width: min(1080px, 90vw);
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 8rem) 0 clamp(3.5rem, 7vw, 6rem);
}

.eyebrow,
.section-head p,
.toc-wrap > p {
  margin: 0 0 0.85rem;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 920px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 6.3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.dek {
  max-width: 750px;
  margin: 2rem 0 0;
  color: #465166;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.1vw, 1.55rem);
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

.hero-meta span {
  padding: 0.38rem 0.72rem;
  border: 1px solid var(--rule);
  border-radius: 99px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.52);
  font-size: 0.78rem;
}

.hero blockquote {
  max-width: 880px;
  margin: 3.2rem 0 0;
  padding: 1.55rem 1.8rem;
  border: 0;
  border-left: 5px solid var(--accent);
  color: var(--ink);
  background: rgba(255, 253, 248, 0.68);
  box-shadow: 0 20px 50px rgba(23, 36, 59, 0.07);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.hero blockquote b {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.73rem;
  letter-spacing: 0.14em;
}

.boundary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(1180px, 94vw);
  margin: 0 auto;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.boundary div {
  min-height: 190px;
  padding: 2rem;
  border-right: 1px solid var(--rule);
}

.boundary div:last-child { border-right: 0; }

.boundary b {
  display: block;
  margin-bottom: 0.8rem;
  font-family: var(--serif);
  font-size: 1.45rem;
}

.boundary span {
  color: var(--muted);
  font-size: 0.92rem;
}

.chain,
.sources {
  width: min(1080px, 90vw);
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.section-head h2,
.downloads h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.18;
}

.chain ol {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 3rem 0 0;
  padding: 0;
  border-top: 2px solid var(--ink);
  list-style: none;
}

.chain li {
  position: relative;
  padding: 1.5rem 1.15rem 0 0;
}

.chain li::before {
  position: absolute;
  top: -7px;
  left: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.chain time,
.chain b,
.chain span { display: block; }
.chain time { color: var(--accent); font-size: 0.78rem; font-weight: 800; }
.chain b { margin: 0.5rem 0; font-family: var(--serif); font-size: 1.2rem; }
.chain span { color: var(--muted); font-size: 0.82rem; line-height: 1.55; }

.downloads {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2rem, 7vw, 6rem);
  width: min(1180px, 94vw);
  margin: 0 auto 6rem;
  padding: clamp(2.5rem, 5vw, 4rem);
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 32px 80px rgba(23, 36, 59, 0.15);
}

.downloads p:not(.eyebrow) {
  max-width: 520px;
  color: rgba(255, 253, 248, 0.68);
}

.download-links {
  display: grid;
  gap: 0.7rem;
}

.download-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 253, 248, 0.22);
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.download-links a:hover,
.download-links a:focus-visible {
  border-color: var(--accent-soft);
  background: rgba(255, 253, 248, 0.08);
}

.download-links b { letter-spacing: 0.08em; }
.download-links span { color: rgba(255, 253, 248, 0.58); font-size: 0.78rem; }

.reading-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 780px);
  gap: clamp(2.5rem, 6vw, 6rem);
  justify-content: center;
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding-bottom: 7rem;
}

.toc-wrap {
  align-self: start;
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

#toc {
  display: grid;
  gap: 0.2rem;
}

#toc a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
  text-decoration: none;
}

#toc a.sub { padding-left: 1.25rem; font-size: 0.72rem; }
#toc a:hover,
#toc a.active { border-left-color: var(--accent); color: var(--ink); }

.legal-copy {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.9;
}

.legal-copy .notice {
  margin-bottom: 3rem;
  padding: 1.2rem 1.4rem;
  border: 1px solid rgba(180, 86, 63, 0.32);
  background: rgba(234, 208, 197, 0.34);
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1.7;
}

.notice b { display: block; color: var(--accent); }

.legal-copy h1 {
  margin: 5rem 0 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.3;
}

.legal-copy h2 {
  margin: 3.6rem 0 1.3rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.45;
}

.legal-copy p { margin: 0 0 1.25rem; }
.legal-copy > p { text-indent: 2em; }
.legal-copy h1 + p,
.legal-copy h2 + p,
.legal-copy p:first-of-type { text-indent: 0; }

.legal-copy strong {
  color: var(--accent);
  font-weight: 700;
}

.legal-copy ol,
.legal-copy ul {
  margin: 1.3rem 0 1.8rem;
  padding-left: 1.4rem;
}

.legal-copy li { margin-bottom: 0.65rem; padding-left: 0.35rem; }

.sources { border-top: 1px solid var(--rule); }

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}

.source-grid a {
  min-height: 120px;
  padding: 1.3rem 1.5rem;
  border: 1px solid var(--rule);
  background: rgba(255, 253, 248, 0.48);
  text-decoration: none;
}

.source-grid a:hover,
.source-grid a:focus-visible { border-color: var(--accent); }
.source-grid b,
.source-grid span { display: block; }
.source-grid b { font-family: var(--serif); font-size: 1.25rem; }
.source-grid span { margin-top: 0.45rem; color: var(--muted); font-size: 0.82rem; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  padding: 2.5rem 5vw;
  color: rgba(255, 253, 248, 0.64);
  background: var(--ink);
  font-size: 0.78rem;
}

footer p { max-width: 760px; margin: 0; }
footer a { color: #fff; white-space: nowrap; }

@media (max-width: 900px) {
  .boundary { grid-template-columns: 1fr; }
  .boundary div { min-height: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .boundary div:last-child { border-bottom: 0; }
  .chain ol { grid-template-columns: 1fr; border-top: 0; border-left: 2px solid var(--ink); }
  .chain li { padding: 0 0 1.8rem 1.5rem; }
  .chain li::before { top: 0.45rem; left: -7px; }
  .downloads { grid-template-columns: 1fr; }
  .reading-layout { grid-template-columns: 1fr; width: min(760px, 89vw); }
  .toc-wrap { display: none; }
}

@media (max-width: 620px) {
  .topbar { min-height: 58px; padding: 0 5vw; }
  .topbar nav { gap: 0.8rem; }
  .topbar nav a { font-size: 0.72rem; }
  .hero { width: 89vw; padding-top: 3.2rem; }
  .hero h1 { font-size: clamp(2.65rem, 13vw, 4.1rem); }
  .hero blockquote { padding: 1.25rem; }
  .downloads { width: 100%; margin-bottom: 4rem; padding: 2.2rem 5.5vw; }
  .download-links a { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
  .legal-copy { font-size: 22px; line-height: 1.9; }
  .legal-copy h1 { margin-top: 4rem; }
  .source-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media print {
  .topbar, .toc-wrap, .downloads, footer { display: none; }
  body { background: #fff; }
  .hero, .boundary, .chain, .sources { display: none; }
  .reading-layout { display: block; width: auto; padding: 0; }
  .legal-copy { font-size: 12pt; }
  .legal-copy h1, .legal-copy h2 { break-after: avoid; }
}
