/* 全站外壳 · 书房（2026-11-01，替换参考 Apple 的方案 A）：
   安静、留白、衬线正文、宣纸底、墨色字，只用一个朱砂色做极少量点缀；长文读着不累。
   保留手机底部标签栏与子页面切换（交互不变，只换外观）。各页面样式表之后加载，结构见 scripts/apply-nav.py */

/* ── 1. 设计变量：三套页面主题共用 ── */
:root {
  --shu-paper: #f6f2ea;          /* 宣纸 */
  --shu-paper-2: #efe9dd;        /* 纸的阴面，用于区块底 */
  --shu-ink: #2a2622;            /* 墨 */
  --shu-ink-2: #6d655b;          /* 淡墨：说明文字 */
  --shu-ink-3: #a1988c;          /* 枯墨：日期、序号 */
  --shu-hair: rgba(42, 38, 34, 0.12);
  --shu-seal: #9c3a2b;           /* 朱砂：只用于当前位置、链接、印章 */
  --shu-seal-soft: rgba(156, 58, 43, 0.08);
  --shu-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --shu-sans: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;

  /* 纸墨主题（design-system.css） */
  --paper: var(--shu-paper);
  --paper-deep: var(--shu-paper-2);
  --ink: var(--shu-ink);
  --ink-quiet: var(--shu-ink-2);
  --ink-faint: var(--shu-ink-3);
  --ink-ghost: rgba(42, 38, 34, 0.18);
  --vermilion: var(--shu-seal);
  --vermilion-q: rgba(156, 58, 43, 0.8);
  --hair: var(--shu-hair);
  --hair-strong: rgba(42, 38, 34, 0.22);
  --serif: var(--shu-serif);

  /* 知识地图页（library.html） */
  --pine: var(--shu-ink);
  --clay: var(--shu-seal);
}
/* 文档主题（docs-theme.css）：浅色时换成宣纸墨色；深色模式保留原样 */
:root:not([data-theme="dark"]) {
  --canvas: var(--shu-paper); --surface: var(--shu-paper-2); --surface-soft: var(--shu-paper);
  --hairline: var(--shu-hair); --hairline-soft: var(--shu-hair);
  --ink: var(--shu-ink); --charcoal: var(--shu-ink); --slate: #4a443d; --steel: var(--shu-ink-2); --stone: var(--shu-ink-3);
  --accent: var(--shu-seal); --accent-soft: var(--shu-seal-soft);
}

body { background: var(--shu-paper); color: var(--shu-ink); font-family: var(--shu-serif); -webkit-font-smoothing: antialiased; }
em, i { font-style: normal; }

/* ── 2. 顶栏：纸色、细线，不抢眼 ── */
.masthead, :root:not([data-theme="dark"]) .topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  background: rgba(246, 242, 234, 0.92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--shu-hair);
}
.masthead-brand, .topbar-brand { font-family: var(--shu-serif); font-weight: 600; letter-spacing: 0.12em; color: var(--shu-ink); }
.masthead-brand em { color: var(--shu-seal); }
.primary-nav a, .topbar-nav a { font-family: var(--shu-serif); letter-spacing: 0.1em; color: var(--shu-ink-2); }
.primary-nav a.current, .topbar-nav a.is-active { color: var(--shu-ink); }
.primary-nav a.current::after { background: var(--shu-seal); height: 1px; }

/* ── 3. 子页面：书签式文字切换，不用按钮块 ── */
.site-subnav {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
  margin: 0; padding: 12px var(--pad-page, clamp(16px, 5vw, 80px)) 0;
  font: 400 0.9rem/1 var(--shu-serif); letter-spacing: 0.08em;
}
.site-subnav::-webkit-scrollbar { display: none; }
.site-subnav a { flex: none; padding: 6px 0 8px; color: var(--shu-ink-3); text-decoration: none; background: none; border-bottom: 1px solid transparent; }
.site-subnav a:hover { color: var(--shu-ink); }
.site-subnav a[aria-current="page"] { color: var(--shu-ink); border-bottom-color: var(--shu-seal); }
.site-subnav a:focus-visible, .site-tabbar a:focus-visible { outline: 1px solid var(--shu-seal); outline-offset: 3px; }

/* ── 4. 底部标签栏：只在手机宽度出现，纸色细线 ── */
.site-tabbar { display: none; }
@media (max-width: 760px) {
  .primary-nav, .topbar-nav { display: none !important; }
  .masthead { flex-direction: row !important; align-items: center !important; padding-block: 12px !important; }
  .site-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(246, 242, 234, 0.95);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--shu-hair);
  }
  .site-tabbar a {
    display: grid; justify-items: center; gap: 3px; padding: 4px 0;
    font: 400 0.7rem/1.2 var(--shu-serif); letter-spacing: 0.1em; color: var(--shu-ink-3); text-decoration: none; background: none;
  }
  .site-tabbar a[aria-current="page"] { color: var(--shu-seal); }
  .site-tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .page { padding-top: 24px !important; }
}

/* ── 5. 收掉花哨：标题墨色、序号淡化、去掉竖排水印和大色块 ── */
h1, h2, h3, .hero-display, .section-head h2, .entry-title, .world-title, .section-title, .domain-name, .route-note strong {
  font-family: var(--shu-serif) !important; font-weight: 600; letter-spacing: 0.02em; color: var(--shu-ink);
}
.hero-display em, .section-head h2 em, .hero-lede em, .move-text em, .prose h2 em { color: inherit; }
.entry-num { color: var(--shu-ink-3) !important; font-weight: 400; font-size: 1.1rem !important; font-style: normal; letter-spacing: 0.05em; }
.move-time, .margin-date .d { color: var(--shu-ink) !important; font-weight: 400; font-style: normal; }
.issue-stamp { display: none !important; }
.entry-kicker, .section-head .label, .margin-meta, .outline-heading, .lbl { font-family: var(--shu-sans); letter-spacing: 0.06em; color: var(--shu-ink-3); }
.entry-verdict, .hero-lede, .margin-italic { font-style: normal; }
.entry-verdict { color: var(--shu-ink-2) !important; }
.entry-title, .entry-summary, .entry-kicker { overflow-wrap: anywhere; }  /* 长英文名不撑宽手机页面 */

/* 首页「今天学什么」：书签式，不用深色大卡片 */
.today-card { background: transparent !important; color: var(--shu-ink) !important; box-shadow: none !important; border-radius: 0 !important;
  border-top: 0; border-bottom: 1px solid var(--shu-hair); padding: 8px 0 22px !important; }
.today-k { color: var(--shu-seal) !important; font-family: var(--shu-sans); letter-spacing: 0.14em; font-weight: 400 !important; }
.today-t { font-family: var(--shu-serif); font-weight: 600 !important; }
.today-m { color: var(--shu-ink-2) !important; }
.today-btn { background: transparent !important; color: var(--shu-seal) !important; border: 1px solid var(--shu-seal); border-radius: 2px !important; letter-spacing: 0.12em; }
.health { background: var(--shu-paper-2) !important; border-left: 2px solid #a8823e; border-radius: 0 !important; font-family: var(--shu-sans); font-size: .86rem !important; }

/* ── 6. 长文阅读：舒展的行距、适中的行长、纸上排版 ── */
.prose { font-family: var(--shu-serif); font-size: 17.5px; line-height: 1.95; color: var(--shu-ink); max-width: 36em; }
.prose p, .prose li { letter-spacing: 0.02em; }
.prose > * { margin-bottom: 1.3em; }
.prose h1 { border-top-color: var(--shu-hair); }
.prose h2 { font-size: 21px; margin-top: 2.4em; }
.prose blockquote { border-left: 2px solid var(--shu-seal); background: transparent; color: var(--shu-ink-2); padding: 0.2em 0 0.2em 1.1em; }
.prose table { font-family: var(--shu-sans); font-size: 14px; }
.prose code { font-size: 0.86em; background: var(--shu-paper-2); }
.prose a, .prose code { overflow-wrap: anywhere; }  /* 长网址窄屏自动断行 */
@media (max-width: 760px) { .prose { font-size: 17px; line-height: 1.9; } }
