:root {
  color-scheme: dark;
  --page: #0d111b;
  --panel: #171d2b;
  --panel-2: #20283a;
  --text: #f5f7fb;
  --body-text: #dce3ed;
  --muted: #aeb9ca;
  --soft: #8491a5;
  --line: rgba(255,255,255,.13);
  --accent: #4c9ccc;
  --gold: #d4a669;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --page: #fff;
  --panel: #fff;
  --panel-2: #edf5f8;
  --text: #17212b;
  --body-text: #26343f;
  --muted: #53616f;
  --soft: #6f7d89;
  --line: #dfe9ef;
  --accent: #236b9c;
  --gold: #9b6d24;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
}
a { color: inherit; }
img { max-width: 100%; }

.reading-progress {
  position: fixed;
  inset: 0 auto auto 0;
  width: 0;
  height: 3px;
  z-index: 50;
  background: var(--accent);
}

.topbar {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 30;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.brand,
.top-actions > a { display: none; }
.top-actions { display: block; }
.theme-toggle {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--muted);
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
  backdrop-filter: blur(12px);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.page-shell {
  width: 100%;
  max-width: 677px;
  margin: 0 auto;
  padding: 28px 18px 58px;
  background: var(--page);
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.hero-copy,
.hero-photo {
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.hero-copy {
  display: block;
  margin: 0 0 22px;
  padding: 16px 0 18px;
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--line);
}
.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.hero h1 {
  max-width: none;
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4.2vw, 38px);
  line-height: 1.3;
  font-weight: 900;
  letter-spacing: -.4px;
}
.hero h1 br { display: none; }
.dek {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 10px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.7;
}
.hero-meta span {
  padding: 0;
  border: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
}
.hero-meta span:not(:last-child)::after {
  content: " · ";
  margin: 0 5px;
  color: var(--gold);
}
.hero-photo { margin: 2px 0 30px; }
.hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  border: 0;
  border-radius: 7px;
}
.hero-photo::after { display: none; }
.photo-label {
  position: static;
  margin: 9px 0 0;
  padding-left: 10px;
  border-left: 3px solid var(--gold);
  color: var(--soft);
  font-family: Optima-Regular, "PingFang SC", serif;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: .4px;
}
.photo-label b,
.photo-label span {
  display: inline;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
}
.photo-label b::after { content: "｜"; }

.story-layout {
  position: relative;
  display: block;
  margin-top: 0;
}
.chapter-rail { display: none; }
.chapter-rail p {
  margin: 0 0 11px;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.chapter-rail a {
  display: block;
  margin: 3px 0;
  padding: 9px 10px;
  border-left: 2px solid var(--line);
  border-radius: 0 5px 5px 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 700;
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.chapter-rail a:hover {
  border-left-color: var(--gold);
  color: var(--text);
}
.chapter-rail a.is-active,
.chapter-rail a[aria-current="location"] {
  border-left-color: var(--accent);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 850;
}
.article { min-width: 0; }
.opening {
  margin: 0 0 28px;
  padding: 16px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--body-text);
  font-size: 15px;
  line-height: 1.9;
  text-align: justify;
}
.opening strong { color: var(--gold); font-weight: 800; }
.article > p {
  margin: 0 0 18px;
  color: var(--body-text);
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: .2px;
  text-align: justify;
}
.chapter {
  scroll-margin-top: 24px;
  margin: 44px 0 18px;
  padding: 0 0 0 14px;
  border: 0;
  border-left: 5px solid var(--accent);
}
.chapter:first-of-type { margin-top: 0; }
.chapter-index {
  display: block;
  margin: 0 0 5px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.chapter-index::before { display: none; }
.chapter h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.45;
  font-weight: 900;
  letter-spacing: 0;
}

figure,
.diptych figure {
  margin: 28px 0 30px;
}
figure img,
.diptych img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  border: 0;
  border-radius: 6px;
  background: var(--panel-2);
  box-shadow: none;
}
figcaption {
  margin: 9px 0 0;
  padding-left: 10px;
  border-left: 3px solid var(--gold);
  color: var(--soft);
  font-family: Optima-Regular, "PingFang SC", serif;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: .4px;
}
.diptych {
  display: block;
  margin: 0;
}

.route-card {
  display: block;
  margin: 28px 0 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}
.route-leg {
  padding: 18px;
  background: transparent;
}
.route-leg + .route-leg { border-top: 1px solid var(--line); }
.route-leg span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.2px;
}
.route-leg h3 {
  margin: 6px 0 7px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
}
.route-leg p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
  text-align: justify;
}
.pullquote {
  margin: 32px 0;
  padding: 4px 0 4px 14px;
  border-left: 5px solid var(--accent);
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.6;
  letter-spacing: 0;
  text-align: left;
}

.finish-card {
  margin-top: 44px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  box-shadow: none;
}
.finish-card .kicker { margin-bottom: 7px; }
.finish-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.45;
}
.finish-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
}
.next-link {
  display: inline-block;
  margin-top: 16px;
  padding: 0 0 3px;
  border-bottom: 2px solid var(--gold);
  border-radius: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}
.credits {
  margin: 36px 0 0;
  color: var(--soft);
  text-align: center;
  font-size: 12px;
  line-height: 1.8;
}

@media (min-width: 1060px) {
  .story-layout {
    display: grid;
    grid-template-columns: 170px minmax(0, 641px);
    gap: 28px;
    width: 839px;
    margin-left: -198px;
    align-items: start;
  }
  .chapter-rail {
    position: sticky;
    top: 24px;
    display: block;
    max-height: calc(100vh - 48px);
    padding: 4px 0 12px;
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

@media (max-width: 620px) {
  .topbar { top: 10px; right: 10px; }
  .page-shell { padding: 22px 16px 48px; }
  .hero-copy { padding-top: 14px; }
  .article > p { font-size: 16px; line-height: 1.95; }
  figure,
  .diptych figure { margin: 24px 0 27px; }
}
