@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Noto+Serif+SC:wght@500;600;700;900&display=swap");

:root {
  --paper: #f6f2e9;
  --ink: #171714;
  --muted: #716d64;
  --line: rgba(23, 23, 20, 0.16);
  --red: #d9472d;
  --reading-size: 18px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "DM Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.reading-progress { position: fixed; z-index: 100; top: 0; left: 0; width: 100%; height: 3px; }
.reading-progress span { display: block; width: 100%; height: 100%; background: var(--red); transform: scaleX(0); transform-origin: left; }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1.8rem;
  align-items: center;
  min-height: 66px;
  padding: 0 3.2vw;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(14px);
}
.wordmark { justify-self: start; font-family: Georgia, var(--serif); font-size: 1rem; letter-spacing: 0.1em; }
.header-meta { display: flex; gap: 1.4rem; align-items: center; font-size: 0.68rem; letter-spacing: 0.07em; }
.header-meta a:hover { color: var(--red); }
.header-meta span { color: var(--muted); }
.toc-button {
  display: flex;
  min-width: 54px;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.65rem 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.toc-button span { margin-right: 0.2rem; font-size: 0.68rem; letter-spacing: 0.08em; }
.toc-button i { display: block; width: 14px; height: 1px; background: currentColor; transition: width 180ms ease; }
.toc-button i:last-child { width: 7px; }
.toc-button:hover i:last-child { width: 14px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.65fr);
  gap: clamp(2.5rem, 8vw, 8rem);
  align-items: end;
  padding: clamp(4.5rem, 9vw, 8.7rem) max(3.2vw, calc((100vw - 1240px) / 2)) clamp(4rem, 7vw, 6rem);
  border-bottom: 1px solid var(--ink);
}
.hero-content { min-width: 0; animation: rise-in 780ms both; }
.hero-kicker { display: flex; flex-wrap: wrap; gap: 0.65rem; color: var(--red); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.hero-kicker span + span::before { margin-right: 0.65rem; content: "·"; }
.hero h1 {
  max-width: 960px;
  margin: 1.4rem 0 1.8rem;
  font-family: var(--serif);
  font-size: clamp(3rem, 6.2vw, 6rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.055em;
  text-wrap: balance;
}
.hero h1 small { display: block; margin-top: 0.7rem; color: var(--muted); font-family: var(--sans); font-size: 0.7rem; font-weight: 500; line-height: 1.5; letter-spacing: 0.09em; }
.hero-deck { max-width: 830px; margin: 0; color: #4f4c45; font-family: var(--serif); font-size: clamp(1.05rem, 1.45vw, 1.25rem); line-height: 1.9; }
.hero-taxonomy { display: flex; flex-wrap: wrap; gap: 0.65rem 1.2rem; margin-top: 1.5rem; }
.hero-taxonomy a { display: inline-flex; gap: 0.45rem; color: var(--muted); font-size: 0.7rem; }
.hero-taxonomy a span { color: var(--red); font-size: 0.61rem; letter-spacing: 0.08em; }
.hero-taxonomy a:hover { color: var(--red); }

.hero-facts { align-self: end; border-top: 1px solid var(--ink); animation: rise-in 780ms 140ms both; }
.hero-facts > div, .hero-facts > a { display: grid; grid-template-columns: 80px 1fr; gap: 0.5rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); font-size: 0.74rem; line-height: 1.5; }
.hero-facts span { color: var(--muted); font-size: 0.63rem; letter-spacing: 0.08em; }
.hero-facts strong { font-weight: 600; }
.hero-facts a:hover strong { color: var(--red); }

.reader-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 820px);
  gap: clamp(3rem, 8vw, 7.5rem);
  max-width: 1280px;
  margin: auto;
  padding: 0 3.2vw clamp(7rem, 10vw, 9rem);
}
.reader-toc { position: relative; border-right: 1px solid var(--line); }
.reader-toc-inner { position: sticky; top: 66px; max-height: calc(100vh - 76px); overflow: auto; padding: 4.4rem 2.2rem 4rem 0; scrollbar-width: thin; }
.reader-toc-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; color: var(--red); font-size: 0.62rem; letter-spacing: 0.14em; }
.reader-toc-heading small { color: var(--muted); font-size: 0.6rem; font-weight: 400; }
.reader-toc-heading b { color: var(--red); font-weight: 500; }
.toc-link { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 0.6rem; padding: 0.65rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.67rem; line-height: 1.45; transition: color 150ms ease, padding 150ms ease; }
.toc-link span { color: var(--red); font-size: 0.61rem; }
.toc-link strong { font-weight: 400; }
.toc-link time { display: none; }
.toc-link:hover, .toc-link.is-active { padding-left: 0.35rem; color: var(--ink); }

.transcript { min-width: 0; }
.chapter {
  padding: clamp(5rem, 8vw, 6.6rem) 0;
  border-bottom: 1px solid var(--line);
  opacity: 0.15;
  transform: translateY(22px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(.2,.75,.25,1);
  scroll-margin-top: 66px;
}
.chapter.is-visible { opacity: 1; transform: none; }
.chapter-header { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 1.25rem; margin-bottom: 3.4rem; }
.chapter-index { color: var(--red); font-size: 0.7rem; letter-spacing: 0.1em; }
.chapter-header time { color: var(--muted); font-size: 0.62rem; letter-spacing: 0.11em; }
.chapter-header h2 { margin: 0.65rem 0 0; font-family: var(--serif); font-size: clamp(2.15rem, 4vw, 3.55rem); font-weight: 600; line-height: 1.34; letter-spacing: -0.036em; text-wrap: balance; }
.chapter-copy { margin-left: 68px; }
.chapter-copy > p { margin: 0 0 1.4rem; font-family: var(--serif); font-size: var(--reading-size); line-height: 2.05; }
.dialogue { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1.6rem; margin-bottom: 1.8rem; }
.speaker { padding-top: 0.6em; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.dialogue-guest .speaker { color: var(--red); }
.utterance { min-width: 0; font-family: var(--serif); font-size: var(--reading-size); line-height: 2.05; letter-spacing: 0.005em; }
.utterance > p { margin: 0; }
.utterance > p + p { margin-top: 0.9em; }
.utterance a { color: var(--red); border-bottom: 1px solid currentColor; }

.page-footer { display: flex; min-height: 300px; align-items: flex-end; justify-content: space-between; gap: 2rem; padding: 4.5rem 7vw; color: white; background: var(--ink); }
.page-footer > div:first-child { display: grid; gap: 1.4rem; }
.page-footer span { color: var(--red); font-size: 0.65rem; letter-spacing: 0.16em; }
.page-footer strong { max-width: 640px; font-family: var(--serif); font-size: clamp(1.8rem, 3vw, 2.7rem); font-weight: 600; line-height: 1.4; }
.footer-actions { display: flex; gap: 1.2rem; align-items: center; }
.footer-actions a, .back-to-top { padding: 0.75rem 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.42); color: white; background: none; font-size: 0.72rem; cursor: pointer; }

.reader-tools { position: fixed; z-index: 45; right: 1.3rem; bottom: 1.3rem; display: flex; border: 1px solid rgba(255,255,255,.2); color: white; background: var(--ink); }
.reader-tools button { min-width: 44px; height: 42px; padding: 0; border: 0; border-right: 1px solid rgba(255,255,255,.2); color: inherit; background: none; font-size: 0.72rem; cursor: pointer; }
.reader-tools button:last-child { border-right: 0; }

.toc-panel { position: fixed; z-index: 80; top: 0; right: 0; width: min(460px, 92vw); height: 100%; overflow: auto; padding: 2rem; color: white; background: var(--ink); transform: translateX(102%); transition: transform 300ms cubic-bezier(.2,.75,.25,1); }
.toc-scrim { position: fixed; z-index: 70; inset: 0; visibility: hidden; background: rgba(0,0,0,.36); opacity: 0; transition: opacity 250ms ease, visibility 250ms; }
.menu-open { overflow: hidden; }
.menu-open .toc-panel { transform: none; }
.menu-open .toc-scrim { visibility: visible; opacity: 1; }
.toc-close { display: block; margin-left: auto; padding: 0.5rem 0; border: 0; color: rgba(255,255,255,.7); background: none; cursor: pointer; }
.toc-heading { display: flex; justify-content: space-between; margin: 3rem 0 1.5rem; color: var(--red); font-size: 0.65rem; letter-spacing: 0.13em; }
.toc-heading strong { color: white; font-weight: 500; }
.toc-panel .toc-link { color: rgba(255,255,255,.62); border-color: rgba(255,255,255,.15); }
.toc-panel .toc-link:hover, .toc-panel .toc-link.is-active { color: white; }
.toc-panel .toc-link time { display: block; grid-column: 2; color: rgba(255,255,255,.35); }

@keyframes rise-in { from { opacity: 0; transform: translateY(20px); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-facts { width: min(100%, 520px); }
  .reader-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 2.8rem; }
  .reader-toc-inner { padding-right: 1.2rem; }
  .chapter-copy { margin-left: 0; }
  .dialogue { grid-template-columns: 94px minmax(0, 1fr); }
}

@media (max-width: 680px) {
  .site-header { grid-template-columns: 1fr auto; min-height: 66px; padding: 0 1.1rem; }
  .header-meta { display: none; }
  .hero { display: block; padding: 3.5rem 1.1rem 4rem; }
  .hero h1 { font-size: clamp(2.8rem, 13vw, 4.2rem); }
  .hero-deck { font-size: 1.02rem; }
  .hero-facts { margin-top: 3.5rem; }
  .reader-layout { display: block; padding: 0 1.1rem 6rem; }
  .reader-toc { display: none; }
  .chapter { padding: 4.5rem 0; }
  .chapter-header { display: block; margin-bottom: 2.7rem; }
  .chapter-index { display: block; margin-bottom: 1.2rem; }
  .chapter-header h2 { font-size: clamp(2rem, 10vw, 2.8rem); }
  .dialogue { display: block; margin-bottom: 2rem; }
  .speaker { margin-bottom: 0.45rem; padding-top: 0; }
  .utterance, .chapter-copy > p { font-size: max(17px, var(--reading-size)); line-height: 2; }
  .page-footer { display: grid; min-height: 340px; padding: 4rem 1.1rem; }
  .footer-actions { align-self: end; }
  .reader-tools { right: 0.7rem; bottom: 0.7rem; }
}

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