:root {
  --paper: #f6f2ea;
  --paper-soft: #fbf9f4;
  --card: #ffffff;
  --ink: #17191c;
  --ink-soft: #434952;
  --muted: #6f757e;
  --line: rgba(23, 25, 28, .13);
  --line-strong: rgba(23, 25, 28, .28);
  --accent: #c95f40;
  --accent-bg: #17191c;
  --radius: 10px;
  --max-w: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.is-hidden { display: none !important; }

/* 顶部导航栏 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 242, 234, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--ink); color: var(--paper);
  font-family: Didot, Georgia, serif; font-size: 13px; letter-spacing: .04em;
}
.brand-text { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.brand-text small { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 12px; }

.nav-pills {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  padding: 2px 0;
}
.nav-pills::-webkit-scrollbar { display: none; }
.nav-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--ink-soft);
  border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.nav-pill .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--p-color, var(--ink)); }
.nav-pill:hover { background: rgba(23, 25, 28, .05); color: var(--ink); }
.nav-pill.is-active {
  background: var(--card); color: var(--ink); font-weight: 600;
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-ghost {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: #fff; border-color: var(--ink); }

.shell { max-width: var(--max-w); margin: 0 auto; padding: 34px 24px 36px; }

/* 首屏总览 + 目录 */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.38fr);
  gap: 44px; align-items: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.hero-kicker { font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.hero h1 {
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: clamp(42px, 5vw, 62px);
  font-weight: 900; line-height: 1.12; margin-top: 14px;
}
.hero h1 .latin { font-family: Didot, Georgia, serif; font-weight: 400; }
.hero-rule { width: 44px; height: 3px; background: var(--ink); margin: 22px 0 18px; }
.hero-lead { font-size: 16px; font-weight: 600; line-height: 1.65; }
.hero-sub { font-size: 13.5px; color: var(--ink-soft); line-height: 1.75; margin-top: 10px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-badges span {
  font-size: 12px; color: var(--ink-soft);
  background: var(--paper-soft); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px;
}

.toc-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; letter-spacing: .18em; color: var(--muted);
  padding-bottom: 10px; border-bottom: 1.5px solid var(--ink);
}
.toc-list { display: flex; flex-direction: column; }
.toc-row {
  display: grid; grid-template-columns: 8px 40px minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 13px 10px 13px 0;
  border-bottom: 1px solid var(--line);
  transition: background .15s ease;
}
.toc-row:hover { background: rgba(255, 255, 255, .55); }
.toc-row.is-active { background: rgba(255, 255, 255, .85); }
.toc-swatch {
  width: 8px; height: 38px; border-radius: 2px;
  background: linear-gradient(var(--c-base) 0 70%, var(--c-accent) 70% 100%);
}
.toc-no {
  font-family: Didot, Georgia, serif; font-size: 24px; line-height: 1;
  text-align: center; color: var(--ink);
}
.toc-info { min-width: 0; text-align: left; }
.toc-info b { display: block; font-size: 15px; font-weight: 600; }
.toc-info span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.toc-actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.toc-pages { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.toc-dl {
  font-size: 12px; padding: 5px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper-soft); color: var(--ink-soft);
}
.toc-dl:hover { border-color: var(--ink); color: var(--ink); background: #fff; }

/* 阅读器抬头 */
.reader { padding-top: 24px; }
.project-banner {
  margin-top: 24px;
  background: var(--b-base, #1d302a);
  color: #f8f6f2;
  border-radius: 14px;
  padding: 26px 30px;
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px;
  align-items: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.project-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .14);
}
.project-banner:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.banner-eyebrow {
  font-size: 11px; letter-spacing: .2em; color: var(--b-accent, #e3c099); font-weight: 600;
}
.banner-title {
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(26px, 3vw, 34px); font-weight: 700; margin-top: 8px; line-height: 1.2;
}
.banner-desc { font-size: 13.5px; line-height: 1.75; color: rgba(248, 246, 242, .88); margin-top: 10px; }
.banner-note { font-size: 12px; color: rgba(248, 246, 242, .58); margin-top: 10px; }

.banner-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.stat-box {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px; padding: 12px 14px;
}
.stat-box b { display: block; font-size: 19px; font-weight: 600; color: var(--b-accent, #e3c099); }
.stat-box span { display: block; font-size: 12px; color: rgba(248, 246, 242, .75); margin-top: 3px; }

/* 工具栏 */
.reader-toolbar {
  margin-top: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.reader-tabs { font-size: 14px; font-weight: 600; color: var(--ink); }
.reader-tabs span { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 13px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.mode-switch {
  display: inline-flex; background: rgba(23, 25, 28, .06);
  padding: 3px; border-radius: 9px;
}
.mode-btn {
  padding: 6px 12px; border-radius: 7px; font-size: 12.5px; color: var(--ink-soft);
}
.mode-btn.is-active {
  background: var(--card); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

/* 单页翻页舞台 */
.flip-stage { position: relative; margin-top: 14px; }
.stage-viewport {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: var(--paper-soft);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 56px;
}
.slide-card {
  position: relative;
  height: min(692px, calc(100vh - 175px));
  max-width: 100%;
  aspect-ratio: 841.92 / 594.96;
  background: #fff; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .10);
}
.slide-card img {
  width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in;
}

.stage-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line-strong);
  font-size: 22px; line-height: 1; display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .10);
  transition: transform .15s ease, background .15s ease;
}
.stage-arrow:hover:not(:disabled) { background: #fff; border-color: var(--ink); }
.stage-arrow:disabled { opacity: .32; cursor: default; }
.stage-arrow.prev { left: 10px; }
.stage-arrow.next { right: 10px; }

.proj-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 72px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--muted);
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.proj-arrow svg {
  width: 30px; height: 30px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.proj-arrow.prev { left: -60px; }
.proj-arrow.next { right: -60px; }
.proj-arrow:hover {
  color: var(--ink);
  background: rgba(23, 25, 28, .05);
}
.proj-arrow.prev:hover { transform: translate(-2px, -50%); }
.proj-arrow.next:hover { transform: translate(2px, -50%); }
.proj-arrow:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 18, 22, .92);
  display: flex; align-items: center; justify-content: center; padding: 28px 64px;
}
.lb-body { max-width: 1200px; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb-body img { max-width: 100%; max-height: calc(100vh - 96px); border-radius: 6px; object-fit: contain; }
.lb-caption { color: rgba(255, 255, 255, .8); font-size: 13px; }
.lb-close, .lb-nav {
  position: fixed; color: #fff; background: rgba(255, 255, 255, .12);
  border-radius: 999px; display: grid; place-items: center;
  transition: background .15s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-close { top: 18px; right: 20px; width: 40px; height: 40px; font-size: 18px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 26px; }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }

@media (min-width: 901px) {
  .shell { padding-top: 0; padding-bottom: 0; }
  .first-screen {
    min-height: calc(100vh - 61px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(18px, 2.8vh, 32px);
    padding: clamp(14px, 2.2vh, 28px) 0 clamp(18px, 2.8vh, 32px);
  }
  .hero {
    padding-bottom: clamp(18px, 2.8vh, 32px);
  }
  .project-banner {
    margin-top: 0;
  }
  .reader {
    min-height: calc(100vh - 61px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px 0 24px;
  }
}

@media (max-width: 1259px) {
  .flip-stage { display: flex; align-items: center; gap: 6px; }
  .stage-viewport { flex: 1; min-width: 0; }
  .proj-arrow {
    position: static; transform: none; flex-shrink: 0;
    width: 34px; height: 56px;
  }
  .proj-arrow svg { width: 24px; height: 24px; }
  .proj-arrow.prev:hover { transform: translateX(-2px); }
  .proj-arrow.next:hover { transform: translateX(2px); }
}

/* 移动端适配 */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 26px; padding-bottom: 30px; }
  .project-banner { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .topbar-inner { flex-wrap: wrap; padding: 10px 16px; }
  .nav-pills { order: 3; width: 100%; padding-top: 6px; border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .shell { padding: 20px 14px 28px; }
  .stage-viewport { padding: 10px; }
  .slide-card { width: 100%; height: auto; }
  .stage-arrow { width: 32px; height: 32px; font-size: 18px; }
  .stage-arrow.prev { left: 6px; }
  .stage-arrow.next { right: 6px; }
  .proj-arrow { width: 26px; height: 48px; }
  .proj-arrow svg { width: 20px; height: 20px; }
  .lightbox { padding: 14px; }
  .lb-nav { width: 36px; height: 36px; font-size: 20px; }
}
