
:root {
  --bg: #f4f1ec;
  --bg-soft: #ede9e1;
  --bg-warm: #e8e0d2;
  --paper-grain: rgba(120, 95, 60, 0.04);
  --ink: #2b2826;
  --ink-soft: #5b5249;
  --ink-mute: #8a8076;
  --rule: rgba(60, 40, 20, 0.12);
  --rule-strong: rgba(60, 40, 20, 0.28);
  --terracotta: #a04d3a;
  --terracotta-soft: rgba(160, 77, 58, 0.12);
  --bronze: #7a5230;
  --bronze-soft: rgba(122, 82, 48, 0.10);
  --gold: #b89b6a;
  --pivot: #8a3829;
  --echo: #6c5a8c;

  --ltts-bg: #ede9e1;
  --ltts-fg: #2b2826;
  --ltts-rule: rgba(60, 40, 20, 0.28);
  --ltts-accent: #a04d3a;
  --ltts-accent-hover: #c1604a;
  --ltts-shadow: 0 2px 14px rgba(122, 82, 48, 0.18);
  --ltts-mute: #8a8076;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(184, 155, 106, 0.08), transparent 60%),
    radial-gradient(ellipse at 85% 70%, rgba(160, 77, 58, 0.05), transparent 60%);
  color: var(--ink);
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  line-height: 1.78;
  min-height: 100vh;
  position: relative;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(15deg, var(--paper-grain) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(75deg, var(--paper-grain) 0 1px, transparent 1px 5px);
  opacity: 0.4;
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(244, 241, 236, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.topbar a { color: var(--ink); text-decoration: none; }
.topbar .brand {
  font-family: 'Cormorant Garamond', 'Newsreader', serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--bronze);
  text-transform: uppercase;
}
.topbar-tools { display: flex; align-items: center; gap: 14px; }
.topbar-tools .ltts-mount-slot { display: inline-flex; align-items: center; }
.topbar .home {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: all .25s;
}
.topbar .home:hover {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
}

.progress {
  position: fixed;
  top: 56px; left: 0; right: 0;
  height: 1px;
  background: var(--rule);
  z-index: 99;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--terracotta);
  transition: width .12s ease-out;
}

.hero {
  max-width: 760px;
  margin: 132px auto 56px;
  padding: 0 28px;
  text-align: center;
}
.hero h1 {
  font-family: 'Cormorant Garamond', 'Playfair Display', 'Newsreader', serif;
  font-weight: 500;
  font-size: 64px;
  line-height: 1.1;
  letter-spacing: 0.01em;
  margin-bottom: 18px;
  color: var(--ink);
}
.hero .tagline {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 21px;
  line-height: 1.55;
  max-width: 620px;
  margin: 0 auto 18px;
}
.hero .meta {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.hero::after {
  content: "";
  display: block;
  width: 96px;
  height: 1px;
  background: var(--rule-strong);
  margin: 38px auto 0;
}

.intro-block {
  max-width: 700px;
  margin: 0 auto 64px;
  padding: 0 28px;
  font-size: 19px;
  color: var(--ink-soft);
}
.intro-block p { margin-bottom: 18px; }
.intro-block em {
  font-style: italic;
  color: var(--terracotta);
  font-weight: 500;
}

.chapter-graph { max-width: 1080px; margin: 0 auto 88px; padding: 0 28px; }

.part-divider {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin: 56px 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-strong);
}
.part-divider .part-num {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--bronze);
  letter-spacing: 0.1em;
}
.part-divider span:last-child {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  color: var(--ink);
  font-weight: 500;
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.chapter-node {
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  transition: all .35s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.chapter-node:hover {
  border-color: var(--terracotta);
  box-shadow: 0 10px 30px rgba(160, 77, 58, 0.15);
  transform: translateY(-2px);
}
.chapter-node .cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-warm);
  overflow: hidden;
  position: relative;
}
.chapter-node .cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(.2,.8,.2,1);
}
.chapter-node:hover .cover img { transform: scale(1.04); }
.chapter-node .body { padding: 14px 16px 18px; }
.chapter-node .num {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--bronze);
  letter-spacing: 0.16em;
  margin-bottom: 4px;
}
.chapter-node .title {
  font-family: 'Cormorant Garamond', 'Newsreader', serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 6px;
  color: var(--ink);
}
.chapter-node .subtitle {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.45;
  margin-bottom: 8px;
  min-height: 38px;
}
.chapter-node .kind-label {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}
.chapter-node[data-kind="pivot"] .kind-label { color: var(--pivot); }
.chapter-node[data-kind="echo"] .kind-label { color: var(--echo); }
.chapter-node[data-kind="pivot"] .num { color: var(--pivot); }
.chapter-node[data-kind="echo"] .num { color: var(--echo); }

/* ----- Chapter page ----- */

.chapter-page {
  max-width: 720px;
  margin: 96px auto 80px;
  padding: 0 28px;
}
.chapter-meta {
  text-align: center;
  margin-bottom: 24px;
}
.chapter-meta .num {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--bronze);
  letter-spacing: 0.18em;
}
.chapter-page h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 42px;
  line-height: 1.18;
  text-align: center;
  margin: 0 auto 36px;
  max-width: 560px;
  color: var(--ink);
}
.chapter-page h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 1px;
  background: var(--rule-strong);
  margin: 24px auto 0;
}
.chapter-cover-block {
  margin: 0 auto 40px;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
}
.chapter-cover-block img { width: 100%; height: 100%; object-fit: cover; }

.chapter-audio {
  max-width: 520px;
  margin: 0 auto 56px;
  padding: 18px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  text-align: center;
}
.chapter-audio .label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.chapter-audio audio {
  width: 100%;
  height: 36px;
}

.chapter-body p {
  margin-bottom: 22px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}
.chapter-body p.visible {
  opacity: 1;
  transform: translateY(0);
}
.chapter-body em {
  font-style: italic;
  color: var(--terracotta);
}

.chapter-nav {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 16px;
}
.chapter-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .25s;
  max-width: 45%;
  line-height: 1.4;
}
.chapter-nav a:hover { color: var(--terracotta); }
.chapter-nav .prev::before { content: "← "; }
.chapter-nav .next::after { content: " →"; }
.chapter-nav .next { text-align: right; }

@media (max-width: 720px) {
  .hero h1 { font-size: 44px; }
  .hero .tagline { font-size: 18px; }
  .chapter-page h1 { font-size: 30px; }
  .chapter-list { grid-template-columns: 1fr 1fr; gap: 14px; }
  .chapter-node .title { font-size: 16px; }
  .chapter-node .subtitle { font-size: 12px; min-height: auto; }
}
