/* ============================================================
   ANLAN AI · 澜读 — 文章页共享样式 (reading.css)
   ------------------------------------------------------------
   Stage C。所有 /reading/*.html 文章页 <link> 这一份 +
   /assets/anlan-tokens.css(站点 chrome：nav/footer/breadcrumb)。

   设计取舍（写进 build_stageC 报告）：
   - 三篇源文是「米白纸面」杂志式排版，色值是精心调过的编辑设计（红线：不改设计）。
     因此文章正文 .article-paper 永远走纸面浅色（与站点 Light/Dark 解耦）。
   - 站点统一 nav / footer / breadcrumb 由 anlan-tokens.css 驱动，跟随全局 data-theme
     做 Light/Dark 切换。深色模式下 = 深色 nav + 纸面正文（编辑式刻意效果）。
   - 这份只抽「跨三篇一致」的共享件：阅读进度条 / TOC 容器 / 作者卡 / 上下篇导航 /
     文章页脚 / 基础排版原语(.wrap/.eyebrow/grain)。各篇独有组件(thesis-grid/matrix/
     domain-chart/stage-bar…)留在各页内联，不进这里。
   字体由各页自己的 Google Fonts <link> 引入（Noto Serif SC / Newsreader / Fraunces /
   JetBrains Mono），这里只引用变量名。
   ============================================================ */

/* ------------------------------------------------------------
   [A] 纸面调色板 — 文章正文专用，永远浅色（与站点主题解耦）
   取自 founders-playbook / personal-guidance 的那套（主导版本）。
   作用域在 .article-paper，避免污染站点 chrome 的 token。
   ------------------------------------------------------------ */
.article-paper {
  --bg: #F8F5EE;
  --bg-card: #FCFAF4;
  --bg-tint: #F1ECDF;
  --ink: #1A1816;
  --ink-2: #3D3934;
  --muted: #807666;
  --muted-2: #A89D8A;
  --line: #DDD5C2;
  --line-soft: #E8E1CF;
  --accent: #8B3A1F;

  --serif-cn: 'Noto Serif SC', 'Newsreader', Georgia, serif;
  --serif-display: 'Newsreader', 'Noto Serif SC', Georgia, serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Serif SC', 'Newsreader', system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 细腻纸面颗粒 overlay（沿用源文 founders 的点阵纹理） */
.article-paper .paper-grain {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(26, 24, 22, 0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 0;
}

/* ------------------------------------------------------------
   [B] 阅读进度条 — 固定在视口顶部，随滚动填充
   走站点金色 token（与 nav 一致），由各页 inline JS 更新 width。
   ------------------------------------------------------------ */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 200; /* 高于 nav(100) */
  background: var(--color-gold, #D4A574);
  transition: width 80ms linear;
  pointer-events: none;
}

/* ------------------------------------------------------------
   [C] 文章容器 — 在站点 nav 之下留白，纸面铺底
   ------------------------------------------------------------ */
.article-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* 文章 hero 头部公共骨架（各页可叠加自己的色彩/排版） */
.article-paper .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.article-paper .eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--ink);
}
.article-paper .eyebrow span {
  font-family: var(--serif-cn);
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------
   [D] TOC 目录 — 跨三篇一致的「顶部网格目录」样式
   各页只需填 <a><span class="num">/<span>标题</a>。
   ------------------------------------------------------------ */
.article-paper .toc {
  margin: 56px 0 0;
  padding: 28px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px 32px;
  list-style: none;
}
.article-paper .toc a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  transition: color 0.2s;
}
.article-paper .toc a:hover { color: var(--accent); }
.article-paper .toc a .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}

/* ------------------------------------------------------------
   [E] 作者卡 — 文章末尾署名块（跨页一致，新增的阅读增强）
   ------------------------------------------------------------ */
.author-card {
  margin: 64px 0 0;
  padding: 32px 36px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  display: flex;
  gap: 24px;
  align-items: center;
}
.author-card .author-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.author-card .author-avatar svg { width: 28px; height: 28px; }
.author-card .author-body { flex: 1; min-width: 0; }
.author-card .author-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.author-card .author-name {
  font-family: var(--serif-cn);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.author-card .author-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}
.author-card .author-src {
  margin-top: 10px;
  font-size: 13px;
}
.author-card .author-src a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  word-break: break-all;
}
.author-card .author-src a:hover { border-color: var(--accent); }

/* ------------------------------------------------------------
   [F] 上下篇 / 相关导航 — 文章末尾的 prev / next（绝对路径 /reading/*）
   ------------------------------------------------------------ */
.article-nav {
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.article-nav a {
  display: block;
  padding: 26px 28px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.article-nav a:hover {
  border-color: var(--accent);
  background: var(--bg-tint);
}
.article-nav a.next { text-align: right; }
.article-nav .an-dir {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.article-nav .an-title {
  font-family: var(--serif-cn);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.article-nav .an-en {
  display: block;
  margin-top: 6px;
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
.article-nav a.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ------------------------------------------------------------
   [G] 文章页脚 — 原文出处（沿用源文 footer 气质），与站点 footer 分开
   各页保留原 <footer class="article-foot"> 内容。
   ------------------------------------------------------------ */
.article-foot {
  padding: 60px 0 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.article-foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
.article-foot p { margin-bottom: 8px; }
.article-foot p.dim { color: var(--muted-2); }

/* ------------------------------------------------------------
   [H] 回到顶部按钮 — 滚动到一定距离后出现（阅读增强）
   走站点 token 以便与 chrome 协调。
   ------------------------------------------------------------ */
.to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 90;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-card, #FCFAF4);
  border: 1px solid var(--line, #DDD5C2);
  color: var(--accent, #8B3A1F);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s, border-color 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.to-top:hover { border-color: var(--accent, #8B3A1F); }
.to-top svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------
   [I] 响应式 — 文章增强件在窄屏的折叠
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .article-wrap { padding: 0 20px; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav a.next { text-align: left; }
  .author-card { flex-direction: column; align-items: flex-start; gap: 16px; }
  .to-top { right: 16px; bottom: 16px; }
}
