/* =========================================================
   AI版可汗学院 · 调研知识花园 · style.css
   主题：数字花园 / 学术阅读  气质：克制、温暖、清爽
   强调色：靛蓝  底色：暖白米白
   ========================================================= */

/* ---------------------------------------------------------
   1. 主题变量 — 浅色（默认）
   --------------------------------------------------------- */
:root {
  /* 背景层次 */
  --bg:        #fbfaf7;    /* 页面主背景：暖米白 */
  --bg-elev:   #f4f2ec;    /* 卡片/抬起元素：略深米色 */
  --bg-code:   #f0ede6;    /* 代码块背景 */

  /* 文字 */
  --fg:        #1c1a17;    /* 主文字：深暖棕黑 */
  --fg-muted:  #6b6558;    /* 次要文字：暖灰 */
  --fg-faint:  #a09a8f;    /* 最弱文字：用于占位、禁用 */

  /* 强调 — 靛蓝系 */
  --accent:      #2d5fa8;  /* 主强调色：可信靛蓝 */
  --accent-soft: #dce8fa;  /* 强调色柔和底色（标签、徽章背景） */
  --accent-hover:#1e4a8a;  /* 悬停加深 */

  /* 边框 */
  --border:      #ddd8ce;  /* 常规边框：暖灰 */
  --border-soft: #ede9e1;  /* 柔和边框：区块分隔 */

  /* 语义色 */
  --green:       #1e7a47;
  --green-bg:    #d6f0e2;
  --yellow:      #8a6200;
  --yellow-bg:   #fef3c7;
  --red:         #b91c1c;
  --red-bg:      #fee2e2;
  --mixed-bg:    #ede9e1;

  /* 链接 */
  --link:        #2d5fa8;
  --link-hover:  #1e4a8a;
  --link-visited:#5a3e8a;  /* 深紫，区分已访问 */

  /* 组件 */
  --badge-bg:    #ede9e1;
  --code-bg:     #f0ede6;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-hover:0 8px 24px rgba(0,0,0,.10), 0 3px 8px rgba(0,0,0,.05);

  /* 排版 */
  --font-sans:   -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono:   "SF Mono", "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  --text-base:   16.5px;
  --lh-base:     1.75;
  --max-prose:   760px;

  /* 圆角 */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;

  /* 过渡 */
  --tr:    .18s ease;

  /* 布局 */
  --header-h:    54px;
  --rail-left-w: 220px;
  --rail-right-w:260px;
  --gap:         24px;
}

/* ---------------------------------------------------------
   2. 深色主题覆盖
   --------------------------------------------------------- */
:root[data-theme="dark"] {
  --bg:        #1a1916;
  --bg-elev:   #232118;
  --bg-code:   #2a2720;

  --fg:        #e8e4da;
  --fg-muted:  #9c9486;
  --fg-faint:  #5a5448;

  --accent:      #6a9fd8;
  --accent-soft: #1e2e42;
  --accent-hover:#89b8e8;

  --border:      #35312a;
  --border-soft: #2c2923;

  --green:       #4ade80;
  --green-bg:    #14302a;
  --yellow:      #fbbf24;
  --yellow-bg:   #2e2400;
  --red:         #f87171;
  --red-bg:      #320e0e;
  --mixed-bg:    #2c2923;

  --link:        #6a9fd8;
  --link-hover:  #89b8e8;
  --link-visited:#b39ddb;

  --badge-bg:    #2c2923;
  --code-bg:     #2a2720;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4);
  --shadow-hover:0 8px 24px rgba(0,0,0,.5);
}

/* ---------------------------------------------------------
   3. 重置 & 基础
   --------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--text-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: var(--lh-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------------------------------------------------
   4. 顶部 Header
   --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand {
  font-size: .875rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.brand:hover { color: var(--accent); }

/* 搜索框 */
.search-box {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin: 0 auto;
}

#search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: .875rem;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

#search-input::placeholder { color: var(--fg-faint); }

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 搜索结果下拉 */
#search-results,
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}

.search-result {
  display: block;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--tr);
  text-decoration: none;
  color: var(--fg);
}

.search-result:last-child { border-bottom: none; }

.search-result:hover,
.search-result.active {
  background: var(--accent-soft);
}

.sr-title {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.sr-cat {
  display: inline-block;
  font-size: .75rem;
  color: var(--fg-muted);
  background: var(--badge-bg);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}

.search-result mark,
mark {
  background: #fef08a;
  color: #422006;
  border-radius: 2px;
  padding: 0 1px;
}

:root[data-theme="dark"] mark {
  background: #854d0e;
  color: #fef9c3;
}

/* Header 按钮 */
#nav-toggle,
#theme-toggle,
.nav-toggle,
.theme-toggle {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--tr), border-color var(--tr), background var(--tr);
}

.nav-toggle:hover,
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* 默认隐藏 nav-toggle（桌面） */
.nav-toggle { display: none; }

/* ---------------------------------------------------------
   5. 三栏布局（文档页）
   --------------------------------------------------------- */
.layout-doc .page-grid {
  display: grid;
  grid-template-columns:
    var(--rail-left-w)
    minmax(0, var(--max-prose))
    var(--rail-right-w);
  grid-template-rows: 1fr;
  min-height: calc(100vh - var(--header-h) - 48px);
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 0;
  align-items: start;
}

/* Rail 公用 */
.rail {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  padding: 20px 12px 20px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.rail::-webkit-scrollbar { width: 4px; }
.rail::-webkit-scrollbar-track { background: transparent; }
.rail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.rail-left  { padding-right: 16px; }
.rail-right { padding-left: 16px; padding-right: 4px; }

/* 正文区 */
.doc {
  padding: 28px 28px 60px;
  min-width: 0;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
}

/* ---------------------------------------------------------
   6. TOC（左栏目录）
   --------------------------------------------------------- */
.toc {
  font-size: .825rem;
  line-height: 1.55;
}

.toc a {
  display: block;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  text-decoration: none;
  transition: color var(--tr), background var(--tr);
  border-left: 2px solid transparent;
  margin-bottom: 1px;
}

.toc a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.toc a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* 三级标题缩进 */
.toc a[data-depth="3"] {
  padding-left: 20px;
  font-size: .8rem;
}

/* ---------------------------------------------------------
   7. 面包屑
   --------------------------------------------------------- */
.breadcrumb {
  font-size: .8rem;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--fg-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

/* ---------------------------------------------------------
   8. 文档头部元信息
   --------------------------------------------------------- */
.doc-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.025em;
  color: var(--fg);
  margin-bottom: 12px;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

/* ---------------------------------------------------------
   9. 徽章（Badge）
   --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--badge-bg);
  color: var(--fg-muted);
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border-soft);
}

.badge-date {}
.badge-type { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.badge-shelf { background: var(--badge-bg); }

/* 验证徽章 */
.badge-verify {
  font-weight: 600;
}

.badge-verify[data-level="green"] {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-bg);
}

.badge-verify[data-level="yellow"] {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: var(--yellow-bg);
}

.badge-verify[data-level="red"] {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-bg);
}

.badge-verify[data-level="mixed"] {
  background: var(--mixed-bg);
  color: var(--fg-muted);
  border-color: var(--border);
}

/* ---------------------------------------------------------
   10. 标签 Pill
   --------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .775rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
  font-family: var(--font-sans);
  line-height: 1.6;
}

.tag:hover {
  background: var(--accent);
  color: #fff;
}

/* 过滤区按钮 tag */
button.tag {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg-muted);
}

button.tag:hover,
button.tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.tag.active {
  font-weight: 600;
}

/* ---------------------------------------------------------
   11. 正文排版（.doc-body）
   --------------------------------------------------------- */
.doc-body {
  max-width: var(--max-prose);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  color: var(--fg);
}

.doc-body > * + * { margin-top: 1em; }

/* 标题 */
.doc-body h2,
.doc-body h3,
.doc-body h4 {
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.02em;
  color: var(--fg);
  margin-top: 2em;
  margin-bottom: .5em;
  position: relative;
}

.doc-body h2 {
  font-size: 1.3rem;
  padding-bottom: .35em;
  border-bottom: 1px solid var(--border-soft);
}

.doc-body h3 { font-size: 1.1rem; }
.doc-body h4 { font-size: 1rem; }

/* 锚点 ¶ 悬停显示 */
.doc-body h2:hover::after,
.doc-body h3:hover::after {
  content: " ¶";
  color: var(--fg-faint);
  font-size: .8em;
  font-weight: 400;
}

/* 段落 */
.doc-body p { margin-bottom: .75em; }

/* 链接 */
.doc-body a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  transition: color var(--tr), text-decoration-color var(--tr);
}

.doc-body a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

.doc-body a:visited { color: var(--link-visited); }

/* 外链小图标 */
.doc-body a[href^="http"]::after,
.doc-body a[href^="https"]::after {
  content: " ↗";
  font-size: .75em;
  opacity: .65;
}

/* 失效链接 */
.doc-body a.broken,
a.broken {
  color: var(--fg-faint);
  text-decoration: line-through;
  cursor: not-allowed;
  pointer-events: none;
}

/* 列表 */
.doc-body ul,
.doc-body ol {
  padding-left: 1.6em;
  margin-bottom: .75em;
}

.doc-body li { margin-bottom: .3em; }

.doc-body ul li { list-style-type: disc; }
.doc-body ol li { list-style-type: decimal; }

.doc-body li > ul,
.doc-body li > ol {
  margin-top: .25em;
  margin-bottom: .25em;
}

/* 引用块 */
.doc-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  margin: 1.2em 0;
  background: var(--accent-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--fg-muted);
  font-style: italic;
}

.doc-body blockquote > p:last-child { margin-bottom: 0; }

/* 行内代码 */
.doc-body code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--code-bg);
  color: var(--fg);
  padding: .1em .35em;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
}

/* 代码块 */
.doc-body pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.25em 0;
  line-height: 1.6;
}

.doc-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .85rem;
  color: var(--fg);
}

/* 表格 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.25em 0;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  line-height: 1.55;
}

.doc-body table th {
  background: var(--bg-elev);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--fg);
  white-space: nowrap;
}

.doc-body table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

/* 斑马纹 */
.doc-body table tbody tr:nth-child(even) td {
  background: var(--bg-elev);
}

.doc-body table tbody tr:hover td {
  background: var(--accent-soft);
}

/* 分割线 */
.doc-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* 图片 */
.doc-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  display: block;
  margin: 1em 0;
}

/* ---------------------------------------------------------
   12. 右侧关联栏（Panel）
   --------------------------------------------------------- */
.panel {
  margin-bottom: 24px;
}

.panel-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li { margin-bottom: 4px; }

.link-list a {
  display: flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  transition: background var(--tr);
}

.link-list a:hover { background: var(--accent-soft); }

.ll-title {
  font-size: .825rem;
  color: var(--link);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ll-cat {
  font-size: .7rem;
  color: var(--fg-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   13. 图谱 Canvas
   --------------------------------------------------------- */
#graph-canvas {
  display: block;
  width: 100%;
  height: 520px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

#minigraph {
  display: block;
  width: 100%;
  height: 220px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

/* ---------------------------------------------------------
   14. Footer
   --------------------------------------------------------- */
.site-footer {
  text-align: center;
  font-size: .8rem;
  color: var(--fg-faint);
  padding: 20px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
}

/* ---------------------------------------------------------
   15. 首页（layout-home）
   --------------------------------------------------------- */
.layout-home .home {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.035em;
  color: var(--fg);
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--fg-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.hero-search {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.hero-search #search-input {
  height: 44px;
  font-size: 1rem;
  padding: 0 16px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* 图谱区 */
.graph-section {
  margin-bottom: 40px;
}

.graph-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  letter-spacing: -.01em;
}

.graph-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* 标签过滤区 */
.tag-section {
  margin-bottom: 32px;
}

#tag-filter,
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
}

/* 卡片区 */
.cards-section {}

.group-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--fg-muted);
  text-transform: uppercase;
  font-size: .8rem;
  letter-spacing: .06em;
  margin: 32px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* 单张卡片 */
.doc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow var(--tr), transform var(--tr), border-color var(--tr);
}

.doc-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card-link {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.4;
  margin-bottom: 8px;
  letter-spacing: -.01em;
}

.card-excerpt {
  font-size: .85rem;
  color: var(--fg-muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}

/* 卡片内标签比正文里更小 */
.doc-card .tag {
  font-size: .7rem;
  padding: 1px 7px;
}

/* ---------------------------------------------------------
   16. 响应式断点
   --------------------------------------------------------- */

/* 隐藏右栏 < 1100px */
@media (max-width: 1099px) {
  .layout-doc .page-grid {
    grid-template-columns: var(--rail-left-w) minmax(0, 1fr);
  }

  .rail-right { display: none; }

  .doc {
    border-right: none;
  }
}

/* 隐藏左栏，移动端抽屉 < 820px */
@media (max-width: 819px) {
  .layout-doc .page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav-toggle { display: flex; }

  .rail-left {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--rail-left-w);
    max-height: none;
    background: var(--bg);
    border-right: 1px solid var(--border);
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
    padding: 16px 12px;
    box-shadow: var(--shadow-md);
  }

  /* C 通过 body.nav-open 控制开关 */
  body.nav-open .rail-left {
    transform: translateX(0);
  }

  /* 遮罩层（C 可选添加，B 出样式） */
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 140;
  }

  .doc {
    border-left: none;
    padding: 20px 16px 48px;
  }

  .doc-header h1 { font-size: 1.35rem; }

  .layout-home .home { padding: 0 16px 60px; }

  .hero { padding: 36px 0 32px; }
  .hero h1 { font-size: 1.5rem; }
}

/* 手机小屏 < 520px */
@media (max-width: 519px) {
  .site-header { padding: 0 12px; gap: 8px; }
  .brand { font-size: .8rem; }

  .card-grid {
    grid-template-columns: 1fr;
  }

  #graph-canvas { height: 300px; }

  .doc { padding: 16px 12px 40px; }
}

/* ---------------------------------------------------------
   17. 辅助工具类
   --------------------------------------------------------- */

/* 跳过导航（无障碍） */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: .875rem;
  z-index: 999;
  transition: top var(--tr);
}

.skip-link:focus { top: 8px; }

/* 滚动条全局美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); }

/* Focus 样式（键盘可访问性） */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* 过渡动画（避免加载闪烁） */
*,
*::before,
*::after {
  transition-property: background-color, border-color, color, box-shadow, opacity;
  transition-duration: .15s;
  transition-timing-function: ease;
}

/* 但不让布局属性产生动画 */
.rail-left,
.rail-left * {
  /* rail 的 transform 动画由上面 .rail-left 单独控制 */
}

/* ── 图谱图例（集成期补充） ───────────────────────── */
.graph-toolbar{display:flex;align-items:center;gap:18px;flex-wrap:wrap;margin:0 0 10px;font-size:13px;color:var(--fg-muted)}
.glegend{display:inline-flex;align-items:center;gap:6px}
.gdot{display:inline-block;width:11px;height:11px;border-radius:50%}
.ghint{margin-left:auto;font-size:12px;opacity:.8}
@media (max-width:640px){.ghint{display:none}}
