:root {
  color-scheme: light;
  --paper: #f2ecdf;
  --ink: #20241e;
  --muted: #5e594e;
  --red: #8e352b;
  --rule: #8b82745c;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --gutter: clamp(1.15rem, 5vw, 6rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5.25rem; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem/1.75 var(--sans); }
img { display: block; width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .24em; }
a:focus-visible, summary:focus-visible { outline: 3px solid #be5d46; outline-offset: 4px; }
figure, h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; }
.wrap { max-width: 100rem; padding-inline: var(--gutter); margin-inline: auto; }
.skip-link { position: fixed; inset: 0 auto auto 1rem; z-index: 10; padding: .5rem 1rem; background: var(--paper); translate: 0 -115%; }
.skip-link:focus { translate: 0 0; }

.site-header {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  min-height: 4rem; padding-inline: var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.wordmark { font: 700 1.4rem var(--serif); text-decoration: none; white-space: nowrap; }
.site-header ul { display: flex; list-style: none; padding: 0; margin: 0; }
.site-header nav a {
  display: grid; place-items: center; min-width: 2.75rem; min-height: 2.75rem;
  font: 700 1rem var(--serif); text-decoration: none; border-bottom: 2px solid transparent;
}
.site-header nav a:hover,
body:has(#xu:target) nav a[href="#xu"], body:has(#yuan:target) nav a[href="#yuan"],
body:has(#xing:target) nav a[href="#xing"], body:has(#li:target) nav a[href="#li"],
body:has(#wen:target) nav a[href="#wen"], body:has(#zheng:target) nav a[href="#zheng"] { border-color: var(--red); color: var(--red); }
.source-link { justify-self: end; font-size: .82rem; white-space: nowrap; }

.hero {
  min-height: clamp(39rem, calc(100svh - 4rem), 62rem); isolation: isolate;
  display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  color: #22231d; background: #d8ceba url("assets/seal.webp") center / cover;
  border-bottom: 1px solid var(--rule); overflow: hidden;
}
.hero-content {
  align-self: center; justify-self: end;
  width: min(100%, 46rem); padding: clamp(2.4rem, 6vw, 7rem) var(--gutter);
  animation: title-in .75s ease-out both;
}
.eyebrow {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: .78rem; letter-spacing: .17em; font-weight: 650;
  border-top: 1px solid currentColor; padding-top: .85rem;
}
.hero .eyebrow { width: fit-content; color: #692e27; border-top-width: 3px; }
.hero h1 { font: 800 clamp(5.8rem, 13vw, 12rem)/1 var(--serif); letter-spacing: -.095em; white-space: nowrap; margin: .75rem 0 1rem; }
.hero h1 span { color: var(--red); font-weight: 600; }
.hero-subtitle { font: 650 clamp(1.12rem, 2.25vw, 1.75rem)/1.5 var(--serif); letter-spacing: .09em; }
.hero-intro { margin-top: 1.1rem; max-width: 26em; color: #494235; }
.enter { display: inline-flex; align-items: center; gap: 2.4rem; padding: .7rem 1rem; margin-top: 1.65rem; background: var(--red); color: white; font-weight: 650; text-decoration: none; transition: background-color .18s ease; }
.enter:hover { background: #60241e; }
.hero-scene {
  position: relative; display: flex; align-items: end;
  background: #443f32 url("assets/street.webp") center / cover;
  padding: 2.5rem clamp(1rem, 5vw, 4rem); overflow: hidden;
}
.hero-scene::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, #1d1a17bd, transparent 50%); }
.hero-scene span { position: relative; font: 600 clamp(3.7rem, 9vw, 8.4rem)/1 Georgia, serif; color: #f8e9c9; letter-spacing: -.07em; }
@keyframes title-in { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: translateY(0); } }

.chapter { padding-block: clamp(3.4rem, 8vw, 8.6rem); border-bottom: 1px solid var(--rule); --detail-ink: #423c30; }
.chapter-xu, .chapter-li { background: #292921; color: #f6ebd7; --detail-ink: #ded1b7; }
.chapter-xing { background: #dce0d2; }
.chapter-zheng { background: #e5d9c7; }
.chapter .eyebrow { margin-bottom: 1.4rem; opacity: .82; }
.chapter-spread {
  display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1fr);
  align-items: center; gap: clamp(1.65rem, 5vw, 5rem);
}
.chapter-copy h2, .sources h2 { font-size: clamp(2.15rem, 6vw, 5.3rem); letter-spacing: -.045em; }
.chapter-copy .chapter-lead { margin-block: 1.1rem .55rem; font: 650 clamp(1.25rem, 2.7vw, 2rem)/1.45 var(--serif); }
.chapter-copy > p + p { max-width: 28em; color: var(--detail-ink); }
.chapter figure > img, .route { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.chapter-zheng figure > img { object-position: center 33%; }
.chapter figcaption { font-size: .78rem; color: var(--detail-ink); margin-top: .5rem; }
.chapter-xing .route-path { animation: route-dash 16s linear infinite; }
@keyframes route-dash { to { stroke-dashoffset: -78; } }

details summary { cursor: pointer; }
.timeline { margin-block: 2.6rem 2.5rem; border-block: 1px solid currentColor; }
.timeline summary { padding: 1rem 0; font-weight: 650; }
.timeline summary h3 { display: inline; font: inherit; }
.timeline summary span { margin-left: .75rem; font-weight: 400; font-size: .82rem; opacity: .78; }
.timeline-list { display: grid; grid-template-columns: repeat(2,minmax(0, 1fr)); gap: 1.6rem 2rem; margin: .55rem 0 2rem; padding: 0; list-style: none; }
.timeline-list li { border-inline-start: 2px solid currentColor; padding-left: 1rem; }
.timeline-list time { font: 600 .86rem var(--sans); color: var(--detail-ink); }
.timeline-list h4 { font-size: 1.3rem; margin: .35rem 0; }
.timeline-list p { font-size: .9rem; color: var(--detail-ink); }

.records-heading { margin-bottom: 1rem; font-size: 1.6rem; }
.records { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: clamp(.9rem, 2.2vw, 2rem); align-items: start; }
.record {
  min-width: 0; color: var(--ink); background: #f7f0e2; border: 1px solid #b9a991;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.record:hover, .record[open] { border-color: #8e352b; box-shadow: 0 7px 16px #18181018; }
.record summary { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: start; list-style: none; }
.record summary::-webkit-details-marker { display: none; }
.record summary img { grid-column: 1 / -1; aspect-ratio: 5 / 3; object-fit: contain; background: #e4dac7; }
.record-title { font: 650 clamp(.92rem, 1.44vw, 1.12rem)/1.5 var(--serif); margin: .35rem 0 .85rem .8rem; overflow-wrap: anywhere; }
.record-more { color: #7b2f25; font-size: .7rem; margin: .52rem .75rem .65rem 0; white-space: nowrap; }
.record-more::after { content: ' +'; }
.record[open] .record-more::after { content: ' −'; }
.record-detail { display: grid; gap: .6rem; border-top: 1px solid var(--rule); padding: .85rem; font-size: .82rem; overflow-wrap: anywhere; }
.record-detail .meta { font-size: .75rem; color: #585143; }
.record-detail a { color: #7b2f25; }

.sources { padding-block: clamp(3.4rem, 8vw, 7rem); }
.sources h2 { font-size: clamp(1.8rem,4.8vw,3.5rem); margin-bottom: .9rem; }
.sources p { color: var(--muted); }
.source-list { margin-top: 2rem; border-top: 1px solid var(--rule); }
.source-list details { border-bottom: 1px solid var(--rule); }
.source-list summary { padding: .9rem 0; font-weight: 650; }
.source-list ul { padding: 0 0 .7rem 1.2rem; margin: 0; }
.source-list li { margin-bottom: .5rem; overflow-wrap: anywhere; }
.source-list li span { display: inline-block; margin-inline-start: .4rem; font-size: .78rem; color: var(--muted); }
footer { padding: 1.35rem var(--gutter); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; background: #24251e; color: #f4ead6; font-size: .82rem; }

@media (max-width: 980px) {
  .hero { min-height: 33rem; }
  .hero-content { padding-inline: var(--gutter) 1.4rem; }
  .hero h1 { font-size: clamp(5rem, 13vw, 8rem); }
  .chapter-spread { grid-template-columns: minmax(0, .86fr) minmax(0, 1fr); }
  .records { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 650px) {
  html { scroll-padding-top: 4.5rem; }
  .site-header { gap: .2rem; padding-inline: .65rem; min-height: 3.5rem; }
  .wordmark { font-size: 1.04rem; }
  .source-link { font-size: .72rem; }
  .source-link span { display: none; }
  .site-header nav a { min-width: clamp(1.55rem, 6.6vw, 2.5rem); font-size: .9rem; }
  .hero, .chapter-spread, .records, .timeline-list { grid-template-columns: minmax(0,1fr); }
  .hero-content { justify-self: stretch; padding: 2.35rem var(--gutter) 2.55rem; }
  .hero-scene { min-height: 14.5rem; padding: 1.15rem var(--gutter); }
  .hero h1 { font-size: clamp(4.8rem, 18vw, 7.5rem); }
  .records { gap: .9rem; }
  .timeline { margin-block: 1.65rem 1.9rem; }
}

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