/* ====================================================================
   Curtis Yarvin 思想导读 — Stylesheet
   Three themes: cathedral (default), patchwork, ink
   Three reading modes: annotated, immersive, compact
   ==================================================================== */

/* --- 主题变量 --- */
:root {
  --bg: #0a0e1a;
  --bg-2: #111726;
  --bg-3: #1a2238;
  --fg: #e6ebf5;
  --fg-2: #a4adc2;
  --fg-3: #6b7388;
  --accent: #d4a017;
  --accent-2: #f5c842;
  --link: #6da8ff;
  --link-hover: #a3c4ff;
  --quote-bg: rgba(212, 160, 23, 0.06);
  --quote-border: #d4a017;
  --meta-bg: rgba(255, 255, 255, 0.04);
  --hr: rgba(255, 255, 255, 0.08);
  --shadow: 0 6px 28px rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --line-height: 1.85;
  --font-size: 18px;
  --max-content-width: 720px;
}

/* Patchwork 主题 — 更暖色调 */
[data-theme="patchwork"] {
  --bg: #1a1410;
  --bg-2: #251c14;
  --bg-3: #2f231a;
  --fg: #f0e3d0;
  --fg-2: #c4b59e;
  --fg-3: #8a7a64;
  --accent: #c97c3b;
  --accent-2: #e89856;
  --link: #d68a4a;
  --link-hover: #f3a665;
  --quote-bg: rgba(201, 124, 59, 0.08);
  --quote-border: #c97c3b;
  --meta-bg: rgba(201, 124, 59, 0.05);
  --hr: rgba(201, 124, 59, 0.15);
}

/* Ink 主题 — 极简黑白 */
[data-theme="ink"] {
  --bg: #fafaf7;
  --bg-2: #f0f0eb;
  --bg-3: #e5e5e0;
  --fg: #1a1a1a;
  --fg-2: #4a4a4a;
  --fg-3: #8a8a8a;
  --accent: #b8341c;
  --accent-2: #d63a1f;
  --link: #1a5fb4;
  --link-hover: #2566c4;
  --quote-bg: #f0f0eb;
  --quote-border: #b8341c;
  --meta-bg: #f0f0eb;
  --hr: rgba(0, 0, 0, 0.1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* 阅读模式 */
[data-reading-mode="immersive"] {
  --line-height: 2.05;
  --font-size: 19px;
  --max-content-width: 640px;
}
[data-reading-mode="compact"] {
  --line-height: 1.65;
  --font-size: 16px;
  --max-content-width: 800px;
}

/* --- Reset & base --- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans CN", "Noto Sans CJK SC",
    sans-serif;
  font-size: var(--font-size);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
a { color: var(--link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--link-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--hr); margin: 2em 0; }

/* --- 进度条 --- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  z-index: 1000;
  transition: width 0.05s linear;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.hero__stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, var(--bg) 75%);
  z-index: 2;
}
.hero__content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 900px;
}
.hero__eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 1.5rem;
  font-weight: 600;
}
.hero__title {
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 800;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.hero__subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  color: var(--fg-2);
  margin: 0 0 1.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
}
.hero__byline {
  font-size: 0.9rem;
  color: var(--fg-3);
  margin: 0 0 2.5rem;
}
.hero__byline a { color: var(--fg-2); border-bottom: 1px dotted var(--fg-3); }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto 2.5rem;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
  padding: 1.2rem 0.8rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card__value {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.stat-card__label {
  font-size: 0.75rem;
  color: var(--fg-3);
  letter-spacing: 0.15em;
  margin-top: 0.25rem;
}

.hero__cta {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}
.btn--primary {
  background: var(--accent);
  color: var(--bg);
}
.btn--primary:hover {
  background: var(--accent-2);
  color: var(--bg);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--hr);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* --- 工具栏 --- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--hr);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  flex-wrap: wrap;
  backdrop-filter: blur(8px);
}
.toolbar__group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.toolbar__group--right { margin-left: auto; }
.toolbar__label {
  font-size: 0.75rem;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-right: 0.25rem;
}
.toolbar__btn {
  background: transparent;
  border: 1px solid var(--hr);
  color: var(--fg-2);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.toolbar__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.toolbar__btn.is-active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* --- 搜索浮层 --- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  backdrop-filter: blur(4px);
}
.search-overlay__panel {
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: 12px;
  width: 90%;
  max-width: 640px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.search-overlay__input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--hr);
  color: var(--fg);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  font-family: inherit;
}
.search-overlay__input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-overlay__results {
  max-height: 50vh;
  overflow-y: auto;
  margin-top: 1rem;
}
.search-result {
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 0.5rem;
  background: var(--bg-3);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.search-result:hover, .search-result.is-focused {
  border-color: var(--accent);
}
.search-result__title {
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.25rem;
}
.search-result__snippet {
  font-size: 0.85rem;
  color: var(--fg-2);
  line-height: 1.5;
}
.search-result__snippet mark {
  background: var(--accent);
  color: var(--bg);
  padding: 0 2px;
  border-radius: 2px;
}
.search-overlay__hint {
  font-size: 0.75rem;
  color: var(--fg-3);
  text-align: right;
  margin: 0.75rem 0 0;
}
.search-overlay__hint kbd {
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: monospace;
  border: 1px solid var(--hr);
}

/* --- TOC 抽屉 (移动端) --- */
.toc-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  backdrop-filter: blur(4px);
}
.toc-drawer__panel {
  background: var(--bg-2);
  width: 280px;
  max-width: 80vw;
  height: 100%;
  padding: 1.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--hr);
}
.toc-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 700;
}
.toc-drawer__close {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* --- 主布局 --- */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  max-width: 1200px;
  margin: 0 auto;
  gap: 3rem;
  padding: 3rem 1.5rem 6rem;
}

/* TOC 侧栏 */
.toc-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: 0.88rem;
  padding-right: 0.5rem;
}
.toc-sidebar__title {
  font-size: 0.75rem;
  color: var(--fg-3);
  letter-spacing: 0.2em;
  margin: 0 0 1rem;
  font-weight: 600;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-list li {
  margin: 0;
  padding: 0;
}
.toc-list a {
  display: block;
  padding: 0.4rem 0.6rem;
  color: var(--fg-2);
  border-left: 2px solid transparent;
  margin-left: -2px;
  border-radius: 0 4px 4px 0;
  font-size: 0.88rem;
  line-height: 1.4;
  transition: all 0.15s;
}
.toc-list a:hover {
  color: var(--accent);
  background: var(--meta-bg);
  text-decoration: none;
}
.toc-list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--meta-bg);
  font-weight: 600;
}
.toc-list__sep {
  height: 1px;
  background: var(--hr);
  margin: 0.75rem 0;
}

/* --- Main content --- */
.main {
  max-width: var(--max-content-width);
  min-width: 0;
  margin: 0 auto;
  width: 100%;
}

/* --- 文章主体 --- */
.article {
  font-size: var(--font-size);
  line-height: var(--line-height);
}
.article-meta {
  background: var(--meta-bg);
  border: 1px solid var(--hr);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 0 0 2rem;
  font-size: 0.92rem;
  color: var(--fg-2);
  line-height: 1.7;
}
.article-meta strong {
  color: var(--fg);
  font-weight: 600;
}
.article-h2 {
  font-size: 1.7em;
  font-weight: 700;
  margin: 2.8em 0 0.8em;
  padding-top: 1.2em;
  border-top: 1px solid var(--hr);
  color: var(--fg);
  letter-spacing: -0.01em;
  scroll-margin-top: 80px;
}
.article-h2:first-of-type {
  border-top: none;
  padding-top: 0;
}
.article h3 {
  font-size: 1.25em;
  margin: 2em 0 0.6em;
  color: var(--fg);
  font-weight: 700;
  scroll-margin-top: 80px;
}
.article p {
  margin: 0 0 1.1em;
  text-align: justify;
  hyphens: auto;
  color: var(--fg);
}
.article em { color: var(--fg-2); font-style: italic; }
.article strong { color: var(--fg); font-weight: 700; }
.article a {
  border-bottom: 1px solid var(--hr);
  transition: border-color 0.2s, color 0.2s;
}
.article a:hover {
  border-bottom-color: var(--accent);
  text-decoration: none;
}
.article-hr {
  margin: 2.5em 0;
  border: none;
  border-top: 1px dashed var(--hr);
}
.article-quote {
  background: var(--quote-bg);
  border-left: 3px solid var(--quote-border);
  margin: 1.5em 0;
  padding: 1em 1.2em;
  border-radius: 0 6px 6px 0;
  font-size: 0.96em;
  line-height: 1.7;
  color: var(--fg);
  font-style: italic;
}
.article-quote p { margin: 0; }
.article-list {
  margin: 0 0 1.2em;
  padding-left: 1.5em;
}
.article-list li {
  margin-bottom: 0.4em;
}
.article-figure {
  margin: 1.5em 0;
  text-align: center;
}
.article-figure img {
  border-radius: 6px;
  box-shadow: var(--shadow);
}

/* --- 模块 (background/glossary/timeline/sources) --- */
.module {
  margin-top: 5rem;
  padding-top: 3rem;
  border-top: 1px solid var(--hr);
  scroll-margin-top: 80px;
}
.module__head {
  margin-bottom: 2rem;
}
.module__head h2 {
  font-size: 2em;
  margin: 0 0 0.4em;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.module__head p {
  margin: 0;
  color: var(--fg-2);
  font-size: 0.95em;
}
.module__note {
  font-size: 0.88em;
  color: var(--fg-3);
  font-style: italic;
  margin-top: 1rem;
  padding: 0.8em 1em;
  background: var(--meta-bg);
  border-radius: 6px;
  border-left: 2px solid var(--hr);
}

/* --- 上下文区 (context-grid) --- */
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.context-card {
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  transition: border-color 0.2s, transform 0.2s;
}
.context-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.context-card__title {
  font-size: 1.05em;
  font-weight: 700;
  margin: 0 0 0.5em;
  color: var(--fg);
}
.context-card__body {
  font-size: 0.9em;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0;
}

/* --- 大教堂三角图 --- */
.cathedral-diagram {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  margin-bottom: 1rem;
}
.cathedral-diagram__node {
  background: var(--bg-3);
  border: 1px solid var(--hr);
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
}
.cathedral-diagram__node--top { grid-column: 2; grid-row: 1; }
.cathedral-diagram__node--left { grid-column: 1; grid-row: 2; }
.cathedral-diagram__node--right { grid-column: 3; grid-row: 2; }
.cathedral-diagram__arrows {
  grid-column: 1 / -1;
  grid-row: 1;
  color: var(--accent);
  height: 0;
  pointer-events: none;
  z-index: 0;
}
.cathedral-diagram__core {
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.cathedral-diagram__core span {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.7;
  letter-spacing: 0.05em;
}
.node__label {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--fg);
}
.node__role {
  font-size: 0.7em;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin: 0.25em 0 0.5em;
}
.cathedral-diagram__node p {
  margin: 0;
  font-size: 0.82em;
  color: var(--fg-2);
  line-height: 1.5;
}

/* --- 对比表 --- */
.compare-table {
  overflow-x: auto;
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
}
.compare-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}
.compare-table th,
.compare-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--hr);
  vertical-align: top;
}
.compare-table th {
  background: var(--bg-3);
  font-weight: 700;
  color: var(--fg);
  position: sticky;
  top: 0;
}
.compare-table th:nth-child(1) { width: 15%; }
.compare-table th:nth-child(2) { color: var(--fg-2); }
.compare-table th:nth-child(3) { color: var(--accent-2); }
.compare-table td:first-child {
  font-weight: 600;
  color: var(--fg);
  background: var(--bg-3);
}

/* --- Patchwork 网格 --- */
.patchwork-viz {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 36px;
  gap: 3px;
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 280px;
}
.patch-cell {
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--fg);
  cursor: default;
  transition: transform 0.15s;
  position: relative;
  background: var(--accent);
}
.patch-cell:hover { transform: scale(1.1); z-index: 5; }
.patch-cell--big {
  background: var(--accent-2);
  color: var(--bg);
  font-weight: 700;
}

/* --- 术语表 --- */
.glossary-controls {
  margin-bottom: 1.5rem;
}
.glossary-controls input {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--hr);
  color: var(--fg);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}
.glossary-controls input:focus {
  outline: none;
  border-color: var(--accent);
}
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.glossary-card {
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  transition: border-color 0.2s;
}
.glossary-card:hover {
  border-left-color: var(--accent-2);
  background: var(--bg-3);
}
.glossary-card__term {
  font-weight: 700;
  font-size: 1em;
  color: var(--fg);
  margin: 0 0 0.4em;
}
.glossary-card__def {
  font-size: 0.88em;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0;
}
.glossary-card.is-hidden { display: none; }

/* --- 时间线 --- */
.timeline-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.timeline-filter button {
  background: transparent;
  border: 1px solid var(--hr);
  color: var(--fg-2);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.timeline-filter button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.timeline-filter button.is-active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  padding-left: 1.5rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.4rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--hr);
}
.timeline li {
  position: relative;
  padding: 0 0 1.2rem 1.2rem;
  font-size: 0.92em;
  line-height: 1.5;
}
.timeline li::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.4em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  z-index: 1;
}
.timeline li.is-hidden { display: none; }
.timeline__date {
  font-weight: 700;
  color: var(--accent-2);
  font-feature-settings: "tnum";
  margin-right: 0.5em;
}
.timeline__cat {
  display: inline-block;
  font-size: 0.7em;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-left: 0.5em;
}

/* --- 来源 --- */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.source-block {
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}
.source-block__title {
  font-size: 0.95em;
  font-weight: 700;
  color: var(--accent-2);
  margin: 0 0 0.8em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.source-block ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.source-block li {
  margin-bottom: 0.6em;
  font-size: 0.88em;
  line-height: 1.5;
  color: var(--fg-2);
  padding-left: 1em;
  position: relative;
}
.source-block li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}
.source-block li a { color: var(--fg); border-bottom: 1px dotted var(--hr); }
.source-block li a:hover { color: var(--accent); }

/* --- 阅读路径 --- */
.reading-paths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.reading-path {
  background: var(--bg-2);
  border: 1px solid var(--hr);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  position: relative;
}
.reading-path__title {
  font-weight: 700;
  font-size: 1em;
  margin: 0 0 0.6em;
  color: var(--accent-2);
}
.reading-path ol {
  margin: 0;
  padding-left: 1.2em;
  font-size: 0.88em;
  color: var(--fg-2);
  line-height: 1.6;
}
.reading-path li { margin-bottom: 0.4em; }
.reading-path li::marker { color: var(--accent); }

/* --- Footer --- */
.page-footer {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hr);
  text-align: center;
  font-size: 0.85em;
  color: var(--fg-3);
}
.page-footer p { margin: 0.5em 0; }

/* --- 回到顶部 --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  box-shadow: var(--shadow);
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover { transform: translateY(-2px); }

/* --- 移动端 --- */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 4rem;
    gap: 1.5rem;
  }
  .toc-sidebar { display: none; }
  .hero { min-height: 70vh; }
  .hero__stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .toolbar {
    padding: 0.5rem 0.75rem;
    gap: 0.75rem;
  }
  .toolbar__group--right { margin-left: 0; }
  .article-h2 { font-size: 1.4em; }
  .cathedral-diagram {
    grid-template-columns: 1fr;
  }
  .cathedral-diagram__node--top,
  .cathedral-diagram__node--left,
  .cathedral-diagram__node--right {
    grid-column: 1;
  }
  .cathedral-diagram__node--top { grid-row: 1; }
  .cathedral-diagram__node--left { grid-row: 2; }
  .cathedral-diagram__node--right { grid-row: 3; }
  .cathedral-diagram__arrows { display: none; }
  .patchwork-viz {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (max-width: 600px) {
  .hero__title { font-size: 2.5rem; }
  .hero__subtitle { font-size: 1rem; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .stat-card { padding: 0.8rem 0.4rem; }
  .stat-card__value { font-size: 1.3rem; }
  .module__head h2 { font-size: 1.5em; }
}

/* 紧凑阅读模式 */
[data-reading-mode="compact"] .article p { margin-bottom: 0.7em; }
[data-reading-mode="compact"] .article-quote { padding: 0.7em 1em; }
[data-reading-mode="compact"] .article-h2 { margin-top: 2em; padding-top: 0.8em; }

/* 沉浸模式 (去掉侧边距装饰) */
[data-reading-mode="immersive"] .article p {
  text-align: left;
}
[data-reading-mode="immersive"] .article-quote {
  font-size: 1.05em;
  padding: 1.3em 1.5em;
}