/* =========================================================
 * ZSJ 的学习记录 · 全站样式
 * 设计语言参考 joshwcomeau.com：
 *   双主题（浅色/深色）、大圆角、柔和分层阴影、
 *   粉色/紫色/金色强调色、弹性微交互、深色代码面板
 * ========================================================= */

/*
 * 文件导航：按现有顺序查找以下分区编号；本目录不改变规则顺序。
 *
 * 基础层：1. 设计令牌 → 2. 基础 → 3. 顶栏 → 4. 按钮
 * 首页：5. Hero → 6. 文章列表区 → 7. 文章卡片
 * 阅读页：8. 文章详情页布局 → 9. 文章正文（prose）→ 10. 代码块
 * 页面补充：11. 上一篇 / 下一篇 → 11.5 分类页 → 12. 关于页
 * 公共反馈：13. 空状态 → 14. 页脚 → 15. 进度条 & 回到顶部
 * 适配层：16. 渐入动画 → 17. 响应式 → 18. 无障碍
 *
 * 级联定位：分类的 860px 查询保留在 11.5，页脚的 600px 查询保留在 14；
 * 文章的 1024px 与通用 720px 查询位于 17，减少动态效果位于 18。
 * 调整某个组件前同时检查它的后置规则；不要仅为分组搬动规则。
 * 当前令牌只覆盖颜色、字体、部分圆角与布局，字号和间距仍由组件声明。
 *
 * ---------- 1. 设计令牌 ----------
 * :root 为默认主题；紧随其后的 [data-theme="dark"] 只覆盖深色变量。
 */
:root {
  --canvas: #fbfbfe;
  --canvas-glow: #f3f0ff;
  --surface: #ffffff;
  --surface-2: #f6f6fa;
  --surface-3: #efeff5;
  --ink: #1c1c26;
  --ink-2: #46465a;
  --ink-muted: #7c7c8f;
  --border: #e7e6f0;
  --border-strong: #d6d5e3;

  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --blue: #3b82f6;
  --grad-accent: linear-gradient(135deg, var(--accent), var(--accent-2));
  --grad-hero: linear-gradient(135deg, var(--accent), var(--blue));

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --radius-xl: 32px;

  --shadow-s: 0 1px 2px rgba(28, 28, 38, .05), 0 2px 8px rgba(28, 28, 38, .05);
  --shadow-m: 0 4px 12px rgba(28, 28, 38, .08), 0 14px 36px rgba(28, 28, 38, .09);
  --shadow-l: 0 16px 48px rgba(28, 28, 38, .14);

  --code-bg: #12121a;
  --code-border: #26262f;

  --font-display: "Outfit", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-hand: "Sriracha", "Comic Sans MS", var(--font-body);

  --container: 1180px;
  --content-max: 720px;
  --header-h: 64px;
}

[data-theme="dark"] {
  --canvas: #0e0e12;
  --canvas-glow: #17171f;
  --surface: #16161c;
  --surface-2: #1d1d25;
  --surface-3: #24242e;
  --ink: #f2f2f6;
  --ink-2: #b9b9c8;
  --ink-muted: #8a8a9c;
  --border: #26262f;
  --border-strong: #35353f;

  --accent: #60a5fa;
  --accent-2: #3b82f6;
  --blue: #93c5fd;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-m: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-l: 0 16px 48px rgba(0, 0, 0, .55);

  --code-bg: #0d0d12;
  --code-border: #1f1f28;
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
  overflow-x: hidden;
}

/* 细腻噪点纹理（joshwcomeau 风格） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4000;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.6'/></svg>");
}

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

img { max-width: 100%; height: auto; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ---------- 3. 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: transparent;
  transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 5000;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--canvas);
  font-size: 14px;
  transform: translateY(-180%);
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); color: var(--canvas); }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.02em;
  color: var(--ink);
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.logo:hover { transform: scale(1.04); color: var(--ink); }

.logo-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--grad-accent);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent);
}

.main-nav { display: flex; gap: 6px; margin-left: auto; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--ink); transition: transform .2s ease, opacity .2s ease; }

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  transition: color .2s ease, background-color .2s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.nav-link:active { transform: scale(.95); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease, background-color .2s ease;
}
.theme-toggle:hover { transform: rotate(12deg) scale(1.06); box-shadow: var(--shadow-s); }
.theme-toggle:active { transform: scale(.92); }

.icon { width: 19px; height: 19px; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ---------- 4. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  border: none;
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s ease, background-color .22s ease;
}
.btn:hover { transform: translateY(-2px) scale(1.02); }
.btn:active { transform: translateY(0) scale(.97); }

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:hover { box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn-arrow { transition: transform .22s ease; display: inline-block; }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-s);
}
.btn-ghost:hover { border-color: var(--border-strong); box-shadow: var(--shadow-m); }

/* ---------- 5. Hero ---------- */
.hero { position: relative; padding: 88px 0 72px; overflow: hidden; }

.hero-inner { position: relative; z-index: 2; max-width: 800px; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.025em;
}

.grad-text {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 22px 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: var(--ink-2);
  max-width: 560px;
}

.hero-actions { display: flex; gap: 14px; margin-top: 36px; flex-wrap: wrap; align-items: center; }

/* Hero 文字分类导航（点击跳到独立分类页） */
.hero-cats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-right: 6px;
  padding-right: 6px;
  border-right: 1px solid var(--border);
}
.hero-cat-link {
  padding: 6px 4px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-body);
  position: relative;
  transition: color .2s ease;
}
.hero-cat-link::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.hero-cat-link:hover { color: var(--accent); }
.hero-cat-link:hover::after { transform: scaleX(1); }

/* 漂浮光斑 */
.hero-blobs { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
}
.blob-1 { width: 420px; height: 420px; top: -140px; right: -80px; background: color-mix(in srgb, var(--accent) 26%, transparent); animation: drift 16s ease-in-out infinite; }
.blob-2 { width: 360px; height: 360px; top: 40px; left: -140px; background: color-mix(in srgb, var(--accent-2) 22%, transparent); animation: drift 20s ease-in-out infinite reverse; }
.blob-3 { width: 260px; height: 260px; bottom: -120px; right: 30%; background: color-mix(in srgb, var(--blue) 18%, transparent); animation: drift 18s ease-in-out infinite 2s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -24px) scale(1.08); }
}

/* ---------- 6. 文章列表区 ----------
 * 首页标题、搜索、筛选与网格；.posts-section 的 padding 会覆盖同元素
 * .container 的桌面左右内边距，手机端还需查看分区 17 的后置覆盖。
 */
.posts-section { padding: 24px 0 96px; }

.posts-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.posts-title { display: flex; align-items: baseline; gap: 14px; }
.posts-title h2 { margin: 0; font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; }
.post-count { color: var(--ink-muted); font-size: 14px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon { position: absolute; left: 14px; width: 17px; height: 17px; color: var(--ink-muted); pointer-events: none; }
.search-box input {
  width: min(340px, 60vw);
  padding: 11px 16px 11px 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search-box input::placeholder { color: var(--ink-muted); }
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }

.filter-chip {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all .2s cubic-bezier(.34, 1.56, .64, 1);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.filter-chip.active {
  background: var(--grad-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 38%, transparent);
}
.filter-chip:active { transform: scale(.95); }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
}

/* ---------- 7. 文章卡片 ---------- */
.post-card {
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-s);
  transition: transform .28s cubic-bezier(.34, 1.56, .64, 1), box-shadow .28s ease, border-color .28s ease;
}
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-m);
  border-color: var(--border-strong);
}

.card-link { display: block; color: inherit; height: 100%; }
.card-link:hover { color: inherit; }

.card-banner {
  position: relative;
  height: 170px;
  overflow: hidden;
  background:
    radial-gradient(130% 170% at 18% -12%, color-mix(in srgb, var(--card-accent, var(--accent)) 50%, transparent), transparent 58%),
    linear-gradient(135deg, #1e293b, #0f172a);
}
.card-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: linear-gradient(180deg, transparent 12%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 12%, #000 100%);
}
.card-cover {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .82;
  transform: scale(1.01);
  transition: transform .45s ease, opacity .3s ease;
}
.post-card:hover .card-cover { transform: scale(1.06); opacity: .94; }

.card-cat {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .03em;
}

.card-body { padding: 22px 22px 20px; }

.card-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-link:hover .card-title { color: var(--accent); }

.card-excerpt {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-muted);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.card-tags { margin-left: auto; display: flex; gap: 8px; }
.tag { color: var(--accent); font-size: 13px; }

/* ---------- 8. 文章详情页布局 ---------- */
.post-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  padding-top: 48px;
  padding-bottom: 96px;
  align-items: start;
}

.toc-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  padding-right: 8px;
}
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-muted);
  margin-bottom: 10px;
  padding-left: 12px;
}
.toc-link {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: all .18s ease;
}
.toc-link:hover { color: var(--accent); background: var(--surface-2); }
.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.toc-h3 { padding-left: 26px; font-size: 13.5px; }

.mobile-toc {
  display: none;
  margin: 0 0 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
}
.mobile-toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 16px;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.mobile-toc summary::-webkit-details-marker { display: none; }
.mobile-toc summary span { transition: transform .2s ease; }
.mobile-toc[open] summary { border-bottom: 1px solid var(--border); }
.mobile-toc[open] summary span { transform: rotate(180deg); }
.mobile-toc .toc {
  max-height: min(48vh, 360px);
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
}

.post { min-width: 0; max-width: var(--content-max); width: 100%; margin: 0 auto; }

.post-cover {
  margin: 0 0 36px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface-2);
  box-shadow: var(--shadow-s);
}
.post-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
}

.post-header { margin-bottom: 40px; }
.post-header h1 {
  margin: 14px 0 16px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -.02em;
}

.chip {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  --chip-color: var(--accent);
  background: color-mix(in srgb, var(--chip-color) 13%, transparent);
  color: var(--chip-color);
  font-size: 13px;
  font-weight: 600;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--ink-muted);
  font-size: 14px;
}
.meta-dot { opacity: .6; }
.post-tags { display: inline-flex; gap: 9px; margin-left: 4px; }

/* ---------- 9. 文章正文（prose） ---------- */
.prose { font-size: 17px; line-height: 1.8; color: var(--ink); }

.prose > *:first-child { margin-top: 0; }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -.015em;
  scroll-margin-top: calc(var(--header-h) + 20px);
  margin: 2.2em 0 .7em;
}
.prose h2 { font-size: 1.6rem; font-weight: 800; }
.prose h3 { font-size: 1.28rem; font-weight: 700; }
.prose h4 { font-size: 1.1rem; font-weight: 700; }

.prose h2 { position: relative; }
.prose h2::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1.15em;
  border-radius: 4px;
  background: var(--grad-accent);
  margin-right: 12px;
  vertical-align: -2px;
}

.prose p { margin: 0 0 1.15em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color .2s ease;
}
.prose a:hover { text-decoration-color: var(--accent); }

.prose strong { color: var(--ink); font-weight: 700; }
.prose em { color: var(--ink); }

.prose code:not(pre code) {
  font-family: var(--font-mono);
  font-size: .86em;
  padding: .18em .45em;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--accent);
  border: 1px solid var(--border);
  word-break: break-all;
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 14px 22px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--ink-2);
}
.prose blockquote p { margin: .4em 0; }
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.prose li { margin: .35em 0; padding-left: .2em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose li > ul, .prose li > ol { margin: .4em 0; }

.prose .task {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.prose .task input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: default;
}

.prose hr {
  border: none;
  height: 2px;
  margin: 2.4em 0;
  background: linear-gradient(90deg, transparent, var(--border-strong) 20%, var(--border-strong) 80%, transparent);
  border-radius: 2px;
}

.prose img {
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-m);
  display: block;
  margin: 1.6em auto;
}

/* 9.1 正文表格：.table-wrap 负责局部横向滚动，表格保留最小宽度。 */
.table-wrap {
  overflow-x: auto;
  margin: 1.6em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 480px;
}
.prose thead th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  padding: 11px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.prose tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
}
.prose tbody tr:last-child td { border-bottom: none; }
.prose tbody tr:hover td { background: var(--surface-2); }

/* ---------- 10. 代码块 ---------- */
.code-block {
  margin: 1.6em 0;
  border-radius: var(--radius-m);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  overflow: hidden;
  box-shadow: var(--shadow-s);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  background: color-mix(in srgb, var(--code-bg) 82%, #fff 2%);
  border-bottom: 1px solid var(--code-border);
}
.code-lang {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #8a8aa0;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.copy-btn {
  border: none;
  background: transparent;
  color: #8a8aa0;
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 7px;
  transition: all .18s ease;
}
.copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
}
.code-block code {
  font-family: var(--font-mono);
  font-size: 13.8px;
  line-height: 1.65;
  color: #d8d8e4;
  tab-size: 2;
}

/* 10.1 语法高亮：与 Markdown 渲染器输出的 .tok-* 类对应。 */
.tok-comment { color: #6b7080; font-style: italic; }
.tok-string { color: #9ece6a; }
.tok-number { color: #ff9e64; }
.tok-keyword { color: #82aaff; }

.code-block::-webkit-scrollbar { height: 8px; }
.code-block pre::-webkit-scrollbar { height: 8px; }
.code-block pre::-webkit-scrollbar-thumb { background: #3a3a46; border: none; }

/* ---------- 11. 上一篇 / 下一篇 ---------- */
.post-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.pager-card {
  padding: 18px 20px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all .22s cubic-bezier(.34, 1.56, .64, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pager-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-m);
  color: inherit;
}
.pager-next { text-align: right; }
.pager-label { font-size: 13px; color: var(--ink-muted); font-weight: 600; }
.pager-title { font-weight: 600; color: var(--ink); }
.pager-card:hover .pager-title { color: var(--accent); }
.pager-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-muted); }

/* ---------- 11.5 分类页（飞书 wiki 风格：左目录树 + 右内容） ---------- */
.cat-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 40px;
  max-width: 100%;
  margin: 0;
  padding: 56px 24px 80px;
  align-items: start;
}

/* 11.5.1 左侧目录树：侧栏定位、标题、一级节点与计数。 */
.cat-tree {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 72px);
  overflow-y: auto;
  padding: 8px 14px 24px 0;
  border-right: 1px solid var(--border);
}
.cat-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 10px;
}
.cat-tree-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
}
.cat-tree-icon { color: var(--ink-muted); display: inline-flex; }

.cat-tree-nav { display: flex; flex-direction: column; gap: 2px; }

.cat-tree-item { border-radius: 8px; }
.cat-tree-item.active { background: transparent; }

.cat-tree-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 14.5px;
  transition: color .15s ease, background-color .15s ease;
}
.cat-tree-row { position: relative; }
.cat-tree-row:hover { color: var(--accent); }
.cat-tree-doc { color: var(--ink-muted); flex-shrink: 0; }
.cat-tree-item.active .cat-tree-doc { color: var(--accent); }
.cat-tree-item.active > .cat-tree-row {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 4px;
}
.cat-tree-item.active > .cat-tree-row::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.cat-tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-tree-count {
  font-size: 12.5px;
  color: var(--ink-muted);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 0 8px;
  line-height: 1.7;
}
.cat-tree-item.active .cat-tree-count {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* 11.5.2 子条目：当前分类下的直属文章。 */
.cat-tree-children {
  display: flex;
  flex-direction: column;
  padding: 4px 0 8px 28px;
  border-left: 1px solid var(--border);
  margin: 0 0 6px 18px;
}
.cat-tree-child {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border-radius: 6px;
  color: var(--ink-muted);
  font-size: 13.5px;
  line-height: 1.4;
  transition: color .15s ease, background-color .15s ease;
}
.cat-tree-child:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cat-tree-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.cat-tree-child:hover .cat-tree-dot { background: var(--accent); }
.cat-tree-child-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-tree-empty {
  padding: 4px 0 8px 28px;
  color: var(--ink-muted);
  font-size: 13px;
  font-style: italic;
}

/* 11.5.3 主内容区：面包屑、分类标题、说明与统计。 */
.cat-main { min-width: 0; }

.cat-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--ink-muted);
  font-size: 13.5px;
}
.cat-breadcrumb a { color: var(--ink-muted); }
.cat-breadcrumb a:hover { color: var(--accent); }
.bc-sep { opacity: .55; }
#bc-current { color: var(--ink); }

.cat-head { padding-bottom: 22px; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.cat-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.cat-desc { margin: 0 0 10px; color: var(--ink-2); font-size: 16px; line-height: 1.6; }
.cat-stat { margin: 0; color: var(--ink-muted); font-size: 13.5px; }

/* 11.5.4 兼容卡片列表：.post-list；当前分类索引使用下方 .doc-list。 */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

/* 11.5.5 树节点按钮：共享重置按原顺序覆盖前面的节点规则。 */
.cat-tree-row,
.cat-tree-sub {
  font-family: var(--font-body);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  color: inherit;
}
.cat-tree-row { font-size: 14.5px; }

/* 11.5.6 展开箭头：.open 对应树节点展开状态。 */
.cat-tree-arrow {
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: transform .2s ease;
}
.cat-tree-arrow.open { transform: rotate(90deg); }
.cat-tree-item.active > .cat-tree-row .cat-tree-arrow { color: var(--accent); }

/* 11.5.7 二级子分类节点：按钮及选中状态。 */
.cat-tree-sub {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 14px;
  transition: color .15s ease, background-color .15s ease;
}
.cat-tree-sub:hover { color: var(--accent); }
.cat-tree-sub.active {
  color: var(--accent);
  background: transparent;
  font-weight: 600;
}
.cat-tree-sub.active .cat-tree-count {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* 11.5.8 当前分类文档索引：.doc-list / .doc-row，保持紧凑行布局。 */
.doc-list { display: flex; flex-direction: column; gap: 4px; }
.doc-row {
  display: flex;
  gap: 14px;
  padding: 14px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity .5s ease,
    transform .5s cubic-bezier(.22, 1, .36, 1),
    background-color .15s ease,
    border-color .15s ease;
}
.doc-row.in-view { opacity: 1; transform: translateY(0); }
.doc-row:hover {
  background: var(--surface-2);
  border-color: var(--border);
  transform: translateX(4px);
}
.doc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 9px;
  opacity: .55;
}
.doc-row:hover .doc-dot { opacity: 1; }
.doc-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.doc-title { font-weight: 600; color: var(--ink); font-size: 16px; line-height: 1.45; }
.doc-row:hover .doc-title { color: var(--accent); }
.doc-excerpt {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-meta { color: var(--ink-muted); font-size: 12.5px; }

/* 11.5.9 面包屑：父级可返回但不抢占当前位置的视觉焦点。 */
#bc-cat.bc-link { color: var(--ink-muted); cursor: pointer; }
#bc-cat.bc-link:hover,
#bc-cat.bc-link:focus-visible { color: var(--accent); text-decoration: underline; }
#bc-sub { color: var(--ink); font-weight: 600; }

@media (max-width: 860px) {
  /* 11.5.10 分类的 860px 适配：目录改为顶部普通区块，树节点仍按原交互展开。 */
  .cat-layout { grid-template-columns: 1fr; gap: 18px; padding: 36px 18px 64px; }
  .cat-tree {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 16px;
  }
  .post-list { grid-template-columns: 1fr; }
}

/* ---------- 12. 关于页 ---------- */
.page-hero { position: relative; padding: 84px 0 48px; overflow: hidden; }
.page-hero .hero-inner { max-width: 720px; }
.page-hero .hero-blobs .blob-2 { left: auto; right: -120px; }

.about-layout { padding-bottom: 96px; }
.about-prose {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ---------- 13. 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  grid-column: 1 / -1;
  color: var(--ink-muted);
}
.empty-mark {
  display: block;
  font-size: 40px;
  margin-bottom: 14px;
  color: var(--accent);
  opacity: .7;
}
.empty-state h3 { color: var(--ink); font-family: var(--font-display); margin: 0 0 8px; }
.empty-state p { margin: 0; }
.empty-state code { font-family: var(--font-mono); font-size: .9em; color: var(--accent); }

.loading { text-align: center; color: var(--ink-muted); padding: 48px 0; grid-column: 1 / -1; }

/* ---------- 14. 页脚 ----------
 * 品牌、备案及链接；600px 查询留在本分区，只调整备案信息排列。
 * .site-footer 是类选择器，是否生效取决于页面是否实际挂载该类。
 */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px 0 48px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-brand .logo-text { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.footer-copy { margin: 6px 0 0; color: var(--ink-muted); font-size: 14px; }
.footer-records { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 14px; }
.footer-records:empty { display: none; }
.footer-icp, .footer-police { display: inline-flex; align-items: center; min-height: 24px; color: var(--ink-muted); font-size: 13px; line-height: 24px; white-space: nowrap; transition: color .2s ease; }
.footer-icp:hover { color: var(--accent); }
.footer-police { gap: 6px; }
.footer-police img { display: block; flex-shrink: 0; width: 16px; height: 18px; object-fit: contain; }
.footer-police:hover { color: var(--accent); }
@media (max-width: 600px) {
  .footer-records { flex-direction: column; align-items: flex-start; gap: 6px; }
}
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--ink-2); font-size: 14.5px; transition: color .2s ease; }
.footer-links a:hover { color: var(--accent); }

/* ---------- 15. 进度条 & 回到顶部 ---------- */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3000;
  background: transparent;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--grad-hero);
  border-radius: 0 3px 3px 0;
  transition: width .1s linear;
}

.back-to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 1500;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 19px;
  cursor: pointer;
  box-shadow: var(--shadow-m);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: all .28s cubic-bezier(.34, 1.56, .64, 1);
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--grad-accent); color: #fff; transform: translateY(-3px); }

/* ---------- 16. 渐入动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.22, 1, .36, 1);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- 17. 响应式 ----------
 * 1024px：文章单双栏与两种目录切换。
 * 720px：公共容器、顶栏、Hero、列表及导航适配；.prose 仍保持其显式字号。
 * 分类 860px / 页脚 600px 查询分别见 11.5 / 14，避免重复定义或改变级联。
 */
@media (max-width: 1024px) {
  .post-layout { grid-template-columns: 1fr; }
  .toc-sidebar { display: none; }
  .mobile-toc { display: block; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .container { padding-right: max(18px, env(safe-area-inset-right)); padding-left: max(18px, env(safe-area-inset-left)); }
  .hero { padding: 64px 0 48px; }
  .header-inner { position: relative; gap: 10px; }
  .logo { font-size: 16px; min-width: 0; }
  .logo-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logo-mark { width: 28px; height: 28px; flex: 0 0 auto; }
  .nav-toggle { display: block; margin-left: auto; }
  .main-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: max(18px, env(safe-area-inset-right));
    display: none;
    width: min(220px, calc(100vw - 36px));
    margin: 0;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow-m);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .main-nav.is-open { display: flex; flex-direction: column; }
  .nav-link { padding: 9px 12px; font-size: 15px; }
  .theme-toggle { width: 38px; height: 38px; }
  .search-box input { font-size: 16px; }
  .toc-link { min-height: 40px; display: flex; align-items: center; }
  .post-grid { grid-template-columns: 1fr; }
  .post-pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
  .blob-1 { width: 300px; height: 300px; }
  .blob-2 { width: 260px; height: 260px; }
  .hero-actions { align-items: flex-start; }
  .hero-cats { width: 100%; margin-right: 0; padding-right: 0; border-right: none; }
  .search-box, .search-box input { width: 100%; }
  .back-to-top { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* ---------- 18. 无障碍 ----------
 * 减少动态效果与键盘焦点；这些规则保留原实现边界，不代表全站验收结论。
 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}
