:root {
  --bg: #e5e1d8;
  --surface: #dad5ca;
  --ink: #2a1d17;
  --muted: #6b5b51;
  --accent: #456f3a;
  --accent-ink: #f4f1ea;
  --cinnabar: #9c2f1a;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Iowan Old Style", Palatino, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --edge: clamp(48px, 7vw, 112px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-reveal: 800ms;
  --t-hover: 180ms;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 18px/1.65 var(--sans);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.masthead {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--edge);
  background: var(--bg);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 18px;
}
.mark { flex: none; width: 46px; height: 28px; color: var(--ink); }
nav { display: flex; gap: 22px; font-size: 16px; }
nav a { color: var(--muted); }
nav a.active, nav a:hover { color: var(--ink); }

main { width: min(920px, calc(100% - 56px)); margin: 0 auto; padding: 48px 0 96px; }
.page-home main, .page-issue main { position: relative; z-index: 1; width: auto; max-width: none; margin: 0; padding: 0; }

.hero {
  position: relative;
  min-height: calc(100svh - 72px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 56px var(--edge) 0;
  overflow: hidden;
}
.hero-copy { position: relative; z-index: 1; }
.hero-ding {
  position: absolute;
  z-index: 0;
  right: clamp(120px, 16vw, 320px);
  bottom: 72px;
  width: min(420px, 30vw);
  height: auto;
  max-height: calc(100svh - 520px);
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  user-select: none;
}
.lines { margin: 0; }
.lines .line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.lines [data-line] {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.9;
}
.lines .line:first-child [data-line] {
  color: #8a7b70;
  font-size: clamp(64px, 8.2vw, 128px);
}
.lines .line:last-child { margin-top: clamp(20px, 2.4vw, 40px); }
.lines .line:last-child [data-line] {
  color: var(--ink);
  font-size: clamp(32px, 4vw, 64px);
  white-space: nowrap;
}
.facts {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 64px var(--edge);
  background: var(--accent);
  color: var(--accent-ink);
}
.facts p { margin: 0; }
.facts strong {
  display: block;
  font-family: var(--serif);
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 600;
  line-height: 1;
}
.facts span { display: block; margin-top: 8px; font-size: 16px; }

.tools {
  width: min(1100px, calc(100% - 2 * var(--edge)));
  margin: 48px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.filters { display: flex; flex-wrap: wrap; gap: 18px; }
.filter { border: 0; background: transparent; color: var(--muted); padding: 8px 0; }
.filter.active, .filter:hover { color: var(--accent); }
.search {
  width: min(280px, 100%);
  padding: 12px 14px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
}
.empty { display: none; width: min(1100px, calc(100% - 2 * var(--edge))); margin: 24px auto; }
.empty.shown, .empty[style*="block"] { display: block; }

.issue-layout {
  width: min(1180px, calc(100% - 2 * var(--edge)));
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 48px;
  align-items: start;
}
.genre { padding: 28px 0 12px; }
.genre + .genre { margin-top: 48px; }
.genre.hidden { display: none; }
.genre-title {
  margin: 8px 0 0;
  font: 600 clamp(32px, 4vw, 48px)/1.05 var(--serif);
}
.toc-label { margin: 22px 0 0; font-size: 16px; color: var(--accent); }
.record { padding: 36px 0 28px; }
.record.hidden { display: none; }
.record-header { display: flex; justify-content: space-between; gap: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 12px; }
.tag { font-size: 16px; color: var(--accent); }
.record h2 { margin: 8px 0 0; font: 600 32px/1.35 var(--serif); }
.record p { margin: 12px 0 0; }
.citation { color: var(--muted); font-size: 16px; }
.record strong { font-weight: 650; }
.point {
  color: var(--cinnabar);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}
.plates .plate:first-child { grid-column: 1 / -1; }
.plate { margin: 0; background: var(--bg); }
.plate img { display: block; width: 100%; height: auto; }
.plate figcaption { margin: 8px 0 0; font-size: 16px; line-height: 1.5; }
.out-link {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 0;
  color: var(--accent);
  font-size: 16px;
}
.out-link:hover { color: var(--ink); }
.toc {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100svh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.toc a { display: block; padding: 8px 0; font-size: 15px; color: var(--muted); }
.toc a:hover { color: var(--ink); }

.close {
  position: relative;
  z-index: 1;
  margin-top: 96px;
  padding: 72px var(--edge) 56px;
  background: var(--ink);
  color: var(--bg);
}
.close-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
}
.close-kicker { margin: 0; font-size: 16px; }
.close-issue {
  margin: 10px 0 0;
  font: 600 clamp(36px, 4vw, 64px)/1.05 var(--serif);
}
.close-nav { display: flex; gap: 28px; }
.close a { font-size: 16px; color: var(--bg); }
.close a:hover { color: #c4b8ae; }

.page-head { margin-bottom: 36px; }
.page-archive h1, .page-head h1 {
  margin: 0;
  font: 600 clamp(40px, 6vw, 72px)/1.05 var(--serif);
}
.meta { margin: 8px 0 0; color: var(--muted); }

.issue-list { margin-top: 28px; }
.archive-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
}
.archive-row time { font-family: var(--serif); font-size: 18px; color: var(--accent); }
.archive-row span { font-family: var(--serif); font-size: 22px; }
.count { font-size: 16px; color: var(--muted); }
.archive-row:hover span { color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .js .lines [data-line] {
    transform: translateY(105%);
    animation: line-up 900ms var(--ease-out) forwards;
    animation-delay: calc(var(--i) * 110ms + 80ms);
  }
  .js [data-rise] {
    opacity: 0;
    transform: translateY(16px);
    animation: rise var(--t-reveal) var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 90ms + 280ms);
  }
  .plate img { transition: transform 600ms var(--ease-out); }
  .plate:hover img { transform: scale(1.015); }
}
@keyframes line-up { to { transform: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .masthead { align-items: flex-start; flex-direction: column; gap: 8px; padding: 16px 20px; }
  .hero { padding: 28px 20px 0; min-height: calc(100svh - 88px); }
  .hero-ding { right: 20px; bottom: 28px; width: min(200px, 52vw); max-height: 36vh; }
  .lines .line:first-child [data-line] { font-size: clamp(48px, 16vw, 72px); }
  .lines .line:last-child [data-line] { white-space: normal; font-size: clamp(28px, 8vw, 40px); }
  .facts { flex-wrap: wrap; padding: 36px 20px; }
  .tools, .issue-layout, .empty { width: min(100% - 40px, 1100px); }
  .close { padding: 48px 20px 36px; }
  .close-inner { flex-direction: column; align-items: flex-start; gap: 28px; }
  .issue-layout { grid-template-columns: 1fr; }
  .genre + .genre { padding: 28px 16px; }
  .plates { grid-template-columns: 1fr; }
  .toc { display: none; }
  .archive-row { grid-template-columns: 1fr auto; }
  .archive-row time { grid-column: 1 / -1; }
  .record h2 { font-size: 26px; }
  main { width: min(100% - 32px, 920px); }
}

/* Keep the cover compact and preserve the reading hierarchy. */
[hidden] { display: none !important; }
.hero { min-height: 330px; padding-bottom: 32px; }
.hero-ding { bottom: 24px; right: var(--edge); width: min(200px, 21vw); max-height: 200px; }
.facts { flex-wrap: wrap; justify-content: flex-start; gap: 32px 48px; padding-top: 36px; padding-bottom: 36px; }
.record h3 { margin: 8px 0 0; font: 600 32px/1.35 var(--serif); }
.record, .citation, .source-note { overflow-wrap: anywhere; }
.record { scroll-margin-top: 88px; }
.significance { margin-top: 24px; }
.significance .significance-label { margin: 0 0 6px; color: var(--accent); font-size: 15px; font-weight: 600; }
.significance p { margin-top: 0; }
.match-count { flex-basis: 100%; margin: 0; font-size: 15px; color: var(--muted); }
.source-note { font-size: 15px; color: var(--muted); margin-top: 18px; }
.source-note summary { cursor: pointer; color: var(--accent); }
.source-note ul { padding-left: 1.3em; }
.source-note p, .source-note li { margin-top: 8px; }
.search-result { display: block; padding: 16px 0; border-bottom: 1px solid var(--surface); }
.search-result strong { display: block; font-family: var(--serif); font-size: 22px; }
.search-result span { display: block; font-size: 15px; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .hero { min-height: 270px; }
  .hero-ding { width: 100px; max-height: 115px; right: 20px; bottom: 16px; }
  .record h3 { font-size: 26px; }
  .genre + .genre { padding-left: 0; padding-right: 0; }
}
