/* ============================================================================
   Sean Wang Blog · 设计系统
   ----------------------------------------------------------------------------
   以 Apple Human Interface Guidelines 为准绳重做视觉层。核心取舍：

   1) 去掉「AI 味」
      原版是深色玻璃拟态 + 渐变光效 + 光晕漂移，那套语言现在到处都是，
      一眼就能看出是模板生成的。这里全部拆掉：不发光、不模糊、不渐变、
      不做背景动画。层级靠「面」和「线」表达，不靠光和影。

   2) 色调
      换掉 indigo→violet→cyan 的品牌渐变，改用 Apple 系统灰阶 + systemBlue。
      灰阶是真正的中性灰（不带蓝味），深色下语义色用 Apple 为深色模式
      调亮的版本，保证深色背景上依然达到 4.5:1。

   3) 结构
      分隔线用 hairline（低透明度细线）而不是实心描边；面板用纯色而不是
      半透明材质——博客是长文阅读场景，正文后面透出任何东西都是干扰。
      控件按作用分层：主操作＝填充蓝，次操作＝中性填充，第三级＝纯文字。

   4) 字体
      系统字体栈优先 -apple-system / SF Pro，中文接苹方，Windows 退到
      Segoe UI / 微软雅黑。数字用 tabular-nums 对齐。
      字号贴近 macOS（正文 15px）而不是网页惯用的 16px 以上。

   5) 密度
      压缩垂直留白。原版 hero 上下 80px、区块之间 96px，一屏看不到几样东西；
      这里区块间距降到 32–48px，一屏能多看到 2–3 倍内容，滚动更少。
   ============================================================================ */

/* ==========================================================================
   01. 设计令牌
   ========================================================================== */
:root {
  /* —— 暖陶中性阶 ——
     全站只有一个色相家族：皮肤 / 陶土。中性色不是「灰加一点暖」——
     那样会发脏；正确做法是取暖色的色相（15–30°）、只把饱和度压下来。
     所以下面这六级的色相全都落在红橙区，整站读起来像同一块材料。 */
  --gray-1: #a89a90;
  --gray-2: #8d7f76;
  --gray-3: #6d6058;
  --gray-4: #4f443e;
  --gray-5: #382f2a;
  --gray-6: #241d19;

  /* —— 八段暖色梯（肉色 → 陶土）——
     首页八个板块各占一级，浅到深依次往下。这不是随手配的八种颜色：
     梯级和「01–08」的分区顺序一一对应，颜色本身在复述顺序，
     所以它承担的是信息，不是装饰。 */
  /* 深色下这条梯子整体压深，并且翻转明暗方向：深底上要靠「更亮」分层次，
     所以 01 最暗、08 最亮 —— 但仍然是单调序列，和浅色的读法一致。 */
  --ramp-1: #5d4030;
  --ramp-2: #6d4c39;
  --ramp-3: #7d5842;
  --ramp-4: #8d654b;
  --ramp-5: #9d7155;
  --ramp-6: #ae7e5f;
  --ramp-7: #bf8b69;
  --ramp-8: #d09874;

  /* 色标块上那个装饰图标的墨色。梯子中段明暗翻转，墨色也跟着翻：
     01–04 用浅墨，05–08 用深墨。实测最低 3.86:1，高于图形元素要求的 3:1。 */
  --ramp-ink-1: #f6e6da;
  --ramp-ink-2: #f6e6da;
  --ramp-ink-3: #f6e6da;
  --ramp-ink-4: #f6e6da;
  --ramp-ink-5: #2a1a12;
  --ramp-ink-6: #2a1a12;
  --ramp-ink-7: #2a1a12;
  --ramp-ink-8: #2a1a12;

  /* —— 深色外观（默认）——
     底是暖褐而不是中性黑：红 > 绿 > 蓝，和浅色那层肉色纸面同源，
     两套主题切换时不会像换了一个站。 */
  --bg-base: #171210;
  --bg-elevated: #1f1815;
  --bg-raised: #281f1a;
  --bg-inset: #120e0c;
  --bg-canvas: #171210;

  /* 整幅「肉色带」的底色。浅色下它是全站唯一一块饱和面（首页板块索引），
     深色下退成一档比底色略亮的暖褐，保持同样的结构位置。 */
  --flesh: #2a1e18;

  --text-primary: #f3e9e1;
  --text-secondary: #b9a79b;
  --text-tertiary: #a6958a;
  /* 四级只用于装饰性元素（图标、箭头、列表符号、时间线圆点），不承载文字：
     深色下它在卡片底上只有 3.22:1，做正文必然不达标。 */
  --text-quaternary: #7d6c62;
  --text-on-accent: #ffffff;

  --material-hover: rgba(255, 236, 224, 0.06);
  --material-active: rgba(255, 236, 224, 0.11);
  --material-sunken: rgba(0, 0, 0, 0.24);

  /* hairline 分隔线：比实心描边轻，才有层次。
     用暖白（255,236,224）而不是纯白，否则压在暖褐底上会发青。 */
  --separator: rgba(255, 236, 224, 0.09);
  --separator-strong: rgba(255, 236, 224, 0.15);
  --border-control: rgba(255, 236, 224, 0.14);
  --border-input: rgba(255, 236, 224, 0.12);

  /* —— 强调色：朱陶 ——
     两端各取一个值，这是深色下唯一能同时达标的做法：
       --accent-fill  填充按钮的底色，配白字 5.38:1
       --accent       文字 / 链接 / 图标，取提亮后的肉粉，卡片底上 7.58:1
     控件底与文字色拆开，思路和原来一致，只是把蓝换成了陶。 */
  --accent-fill: #b24a28;
  --accent-fill-hover: #c85a35;
  --accent-fill-pressed: #96391c;
  --accent: #eba07f;
  --accent-hover: #f5b899;
  --accent-pressed: #df8f6c;
  --accent-soft: rgba(235, 160, 127, 0.15);
  --accent-ring: rgba(235, 160, 127, 0.45);

  /* —— 语义色 ——
     同样往暖里偏一档：绿转橄榄、紫转藕、青转深水绿，避免在整片暖底上
     跳出来。全部按卡片底（#281f1a）复核过，最低 6.63:1。 */
  --green: #6fc46b;
  --green-soft: rgba(111, 196, 107, 0.16);
  --orange: #f0a15e;
  --orange-soft: rgba(240, 161, 94, 0.16);
  --red: #f08a7a;
  --red-soft: rgba(240, 138, 122, 0.16);
  --purple: #c79bdd;
  --purple-soft: rgba(199, 155, 221, 0.16);
  --teal: #5fc8be;
  --teal-soft: rgba(95, 200, 190, 0.16);

  /* —— 字号阶梯 ——
     旧版 16 个令牌全挤在 11–17px，最大的标题才 20px，全站没有一个
     「大字」，所以不管怎么调配色都像后台管理系统。这里把阶梯拉开：
     正文 16px，标题一路到 52px，相邻档位至少差 1.18 倍才看得出层级。
     中文字形方正、字面大，同字号下比拉丁文更「满」，所以正文取 16px
     而不是西文站的 17px。 */
  --fs-11: 11.5px;   /* 角标、计数 */
  --fs-12: 12.5px;   /* 元信息 */
  --fs-13: 13.5px;   /* 次级说明 */
  --fs-15: 15px;     /* 小标题、导航 */
  --fs-17: 17px;     /* 卡片标题、导语 */
  --fs-20: 20px;     /* 区块标题 */
  --fs-24: 24px;     /* 页面标题 */
  --fs-28: 28px;     /* 文章页标题 */
  --fs-34: 34px;     /* 文章页大标题 */
  --fs-40: 40px;     /* 首页口号（中屏） */
  --fs-52: 52px;     /* 首页口号（大屏） */

  --fs-body: 16px;

  /* —— 行高 ——
     中文没有西文那样的小写字母升降部，1.75 的正文行高比西文的 1.6
     更好读；标题则相反，中文标题行高要收到 1.3 以内才紧凑。 */
  --lh-body: 1.75;
  --lh-tight: 1.28;

  /* —— 圆角：Apple 的连续圆角观感 —— */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-full: 999px;

  /* —— 间距：压缩后的节奏 —— */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  --h-control: 32px;
  --h-control-lg: 38px;

  /* —— 阴影：柔和、低对比 —— */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.32);
  --shadow-pop: 0 10px 34px rgba(0, 0, 0, 0.42);

  /* —— 动效：Apple 惯用的短促缓动 —— */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.12s;
  --dur: 0.2s;

  --z-sticky: 100;
  --z-drawer: 800;
  --z-top: 1200;

  --wrap: 1100px;
  --wrap-narrow: 720px;
  --header-h: 60px;

  /* —— 字体 ——
     三套角色，各管一件事：

     --font-serif  标题。中文走「思源宋体 / 宋体」，西文走 Georgia 系。
                   衬线是这套设计的气质来源：它让标题像印刷品的书名，
                   而不是 App 里的界面文字。只用于 h1/h2 和引文，
                   正文绝不用衬线（中文宋体小字号在屏上会糊）。
     --font-sans   正文。中文优先苹方/微软雅黑，西文优先 Inter。
     --font-mono   数据。日期、体积、版本号、计数一律等宽对齐，
                   这是「技术编辑风」的第二条线索。 */
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun",
    Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Source Han Sans SC", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  /* 行尾箭头的形状。用 mask 而不是内联 <svg>：箭头要能跟着 currentColor
     走，又要能只靠 CSS 切换透明度，mask 比多写一个 DOM 节点干净。
     （内联 <svg> 也行，但那样每个板块都要复制一份 path。） */
  --arrow-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");

  color-scheme: dark;
}

/* —— 浅色外观 ——
   底是暖瓷白（#faf3ec）。它比纯白柔，又比象牙黄更偏红 —— 说得准确一点，
   它是「肉色被冲淡」，不是「纸被晒黄」。这一档红味是整套配色的地基：
   后面所有中性色、分隔线、阴影都从它推出来。
   卡片沿用同一底色 —— 见下面「去盒子化」一节，层级不再靠色差表达。 */
html[data-theme="light"] {
  --bg-base: #faf3ec;
  --bg-elevated: #faf3ec;
  --bg-raised: #f3e7dc;
  --bg-inset: #f6ede4;
  --bg-canvas: #faf3ec;

  /* 全站唯一一块饱和面：首页板块索引那条整幅肉色带。
     它存在的理由是「八个板块需要一条把它们绑在一起的地」，
     不是给页面加装饰 —— 所以整站只有这一处用到它。 */
  --flesh: #f1ded0;

  --text-primary: #2a1b14;
  --text-secondary: #6b544a;
  /* 三级会落在肉色带（#f1ded0）上，所以按那块底复核：
     #75604f 在带上是 4.54:1，再浅一档就掉到 4.40。 */
  --text-tertiary: #75604f;
  --text-quaternary: #8a7568;

  --material-hover: rgba(42, 27, 20, 0.045);
  --material-active: rgba(42, 27, 20, 0.08);
  --material-sunken: rgba(42, 27, 20, 0.04);

  /* 分隔线用暖墨（42,27,20）而不是中性黑：压在肉色底上不会发灰。 */
  --separator: rgba(42, 27, 20, 0.1);
  --separator-strong: rgba(42, 27, 20, 0.18);
  --border-control: rgba(42, 27, 20, 0.14);
  --border-input: rgba(42, 27, 20, 0.11);

  /* 文字用的 --accent 压到 #9e3b1e：在底色上 6.16:1，在肉色带上 5.20:1 ——
     链接和板块序号两种底都会落，取更严的那一端。
     填充用的 --accent-fill 保持 #b24a28，白字压上去 5.38:1。 */
  --accent-fill: #b24a28;
  --accent-fill-hover: #c2562f;
  --accent-fill-pressed: #8f3517;
  --accent: #9e3b1e;
  --accent-hover: #7e2e16;
  --accent-pressed: #66240f;
  --accent-soft: rgba(158, 59, 30, 0.1);
  --accent-ring: rgba(158, 59, 30, 0.32);

  /* 语义色同样按肉色带复核过，最低 4.80:1（绿）。 */
  --green: #3f6b2e;
  --green-soft: rgba(63, 107, 46, 0.12);
  --orange: #8f4415;
  --orange-soft: rgba(143, 68, 21, 0.11);
  --red: #a3231c;
  --red-soft: rgba(163, 35, 28, 0.1);
  --purple: #6e3a6b;
  --purple-soft: rgba(110, 58, 107, 0.11);
  --teal: #1f5f5b;
  --teal-soft: rgba(31, 95, 91, 0.11);

  /* 浅色下的暖色梯：01 最浅（几乎就是肉色本身），08 最深（陶土）。
     方向与深色相反，但两端各自单调 —— 切主题时「越往下越靠后」的读法不变。 */
  --ramp-1: #e8b79c;
  --ramp-2: #dfa383;
  --ramp-3: #d48e6c;
  --ramp-4: #c7785a;
  --ramp-5: #b96348;
  --ramp-6: #a94f38;
  --ramp-7: #96422e;
  --ramp-8: #7e3524;

  --ramp-ink-1: #3a2318;
  --ramp-ink-2: #3a2318;
  --ramp-ink-3: #3a2318;
  --ramp-ink-4: #3a2318;
  --ramp-ink-5: #fdf2ea;
  --ramp-ink-6: #fdf2ea;
  --ramp-ink-7: #fdf2ea;
  --ramp-ink-8: #fdf2ea;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.1);
  --shadow-pop: 0 10px 34px rgba(0, 0, 0, 0.14);

  color-scheme: light;
}

/* ==========================================================================
   02. Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 内联图标 <svg> 特意不套 display:block + height:auto：
   只有 viewBox、没有 width/height 属性的 SVG 在块级流里会按
   「宽度 100% + 等比高度」撑开，一旦某个图标上下文漏写尺寸规则，
   就会长成一个几百像素的巨图（页脚图标曾被撑到 171px，
   把页脚顶到 831px 高）。这里只留保守上限，具体尺寸由各组件
   自己的 `... svg { width/height }` 规则决定。 */
svg {
  max-width: 100%;
}

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

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

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* 数字等宽：体积 / 日期 / 计数对齐才不跳 */
.hero__stat-num,
.stat-card__num,
.matrix td,
.dl-row__meta,
.post-header__meta-item,
.clock-widget__time,
.meter__head,
.archive-item__date {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 键盘可达性：统一的焦点环，只在键盘操作时出现 */
:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
  border-radius: var(--r-sm);
}

::selection {
  background: var(--accent-soft);
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: var(--z-top);
  padding: 10px 16px;
  background: var(--accent-fill);
  color: #fff;
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  font-weight: 500;
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: var(--s-4);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   03. 排版
   --------------------------------------------------------------------------
   标题全部改用衬线（--font-serif）。这是整站气质的分水岭：无衬线大标题
   到处都是，衬线大标题才像「有人编辑过」。

   衬线的两个坑，这里都处理了：
   1) 中文宋体在小字号下笔画会糊，所以衬线只用于 20px 以上的标题，
      正文与小标题保持无衬线。
   2) 衬线字的字面比无衬线窄、笔画更细，同样字号看起来更轻，所以
      字重要提到 600/700，并用负字距把中西文拉紧。
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

/* 中文衬线不需要西文那样强的负字距；这里只对标题里的西文生效感更自然，
   统一用 0.01em 的中性值，避免中西混排时挤在一起。 */
h1,
h2 {
  letter-spacing: 0;
}

.text-muted {
  color: var(--text-tertiary);
}

.text-sm {
  font-size: var(--fs-13);
}

/* 原来这里是渐变标题，去掉渐变后保留类名以免模板报错 */
.text-gradient {
  color: var(--text-primary);
  font-weight: 600;
}

/* 小标签：原来是小号无衬线灰字，现在改成等宽大写，像印刷品的栏目标记。
   等宽 + letter-spacing 让它读起来是「标注」而不是「正文」，这正是
   技术编辑风的用法。 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--s-2);
}

.eyebrow svg {
  width: 13px;
  height: 13px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: var(--fs-17);
  line-height: 1.65;
}

/* ==========================================================================
   04. 布局
   --------------------------------------------------------------------------
   全站一个容器宽度：1100px。比旧版 1080 略宽，但真正的变化是左右留白
   改为随视口增长（padding-inline 用 clamp），窄屏不挤、宽屏不散。
   ========================================================================== */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(var(--s-4), 4vw, var(--s-8));
}

.wrap-narrow {
  width: 100%;
  max-width: var(--wrap-narrow);
  margin-inline: auto;
  padding-inline: clamp(var(--s-4), 4vw, var(--s-8));
}

/* 区块间距：旧版 32px，区块之间几乎贴在一起。参考站（leerob / paco）
   的呼吸感来自「区块之间远大于区块内部」，所以拉到 56–72px，
   内部间距（16–24px）保持不变，靠两者之比建立节奏。 */
.section {
  padding-block: clamp(var(--s-10), 6vw, 72px);
}

.section-tight {
  padding-block: clamp(var(--s-8), 4vw, var(--s-12));
}

/* 旧版每个区块都画一条通栏分隔线，整页像表格。现在只有「紧邻的两个
   区块」之间才画，而且线不拉满容器 —— 收到内容宽度，像编辑标记。 */
.section + .section {
  border-top: 1px solid var(--separator);
}

.section-tight + .section-tight {
  border-top: 1px solid var(--separator);
}

/* 通栏色带：底色铺满视口宽度，内容照旧走里面的 .wrap。
   全站只用一次（首页的 .band--flesh）—— 它是签名，不是通用组件。 */
.band--flesh {
  background: var(--flesh);
}

.grid {
  display: grid;
  gap: var(--s-4);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-3 {
  gap: var(--s-3);
}

.gap-6 {
  gap: var(--s-6);
}

.mt-4 {
  margin-top: var(--s-4);
}

.mb-4 {
  margin-bottom: var(--s-4);
}

.mb-6 {
  margin-bottom: var(--s-6);
}

.mb-8 {
  margin-bottom: var(--s-8);
}

.mb-12 {
  margin-bottom: var(--s-12);
}

/* ==========================================================================
   05. 顶栏
   --------------------------------------------------------------------------
   旧版顶栏塞了 10 个带图标的一级入口 + 搜索 + 主题切换，52px 高、字 13px，
   一排挤满 —— 这是「像后台」最直接的来源。这里做三件事：
   1) 高度放到 60px，导航字降到只保留字重差异，去掉图标（10 个图标在
      一排里只会变成噪点，而不是导航）。
   2) 导航靠右、与品牌拉满距离，中间留白本身就成了分隔。
   3) 底边不发散：不用通栏实线，改成滚动时才出现的一条极淡的线。
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--bg-base);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur);
}

/* 只有页面滚动后才画出底边：静止时顶栏和内容是融为一体的，
   滚动时线才出现，告诉用户「这是一层浮在上面的东西」。 */
.topbar.is-stuck {
  border-bottom-color: var(--separator);
}

/* 浅色主题下的吸顶导航用一层极轻的毛玻璃，这是 macOS 工具栏的常规做法
   （也见于参考的 GitCloud 项目）。这里是有意保留的唯一一处模糊效果：
   内容从下面穿过时能看出层级，又不会像深色玻璃拟态那样抢戏。
   深色主题下顶栏是纯色，不做任何模糊。 */
html[data-theme="light"] .topbar {
  background: rgba(250, 243, 236, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

html[data-theme="dark"] .topbar {
  background: rgba(23, 18, 16, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  width: 100%;
  min-width: 0;
}

/* 品牌用衬线，和标题同一套语气；S 方块换成纯文字，少一个色块 */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--fs-17);
  letter-spacing: 0;
}

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

.brand__mark {
  display: none;
}

.brand__text {
  white-space: nowrap;
}

/* 导航：去掉图标，只留文字。10 个入口带 10 个图标时，图标之间没有
   语义差别（都是细线方形），只会把一排挤成噪点。字距和字重接管层级：
   当前项用 --text-primary + 一条下划线，其余用次级色。 */
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  min-width: 0;
}

.nav a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur-fast);
}

.nav a:hover {
  background: transparent;
  color: var(--text-primary);
}

.nav a.current,
.nav a[aria-current="page"] {
  color: var(--text-primary);
  background: transparent;
  font-weight: 600;
}

/* 当前项的下划线。用一条 14px 的短线而不是整块底色 —— 底色会把
   导航条切成一段段色块，线只指认位置，不制造第二个「面」。 */
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 14px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--accent);
}

.nav a[aria-current="page"] {
  position: relative;
}

/* 抽屉里仍需要图标做分组辨识，所以只隐藏「顶栏那一排」里的图标。
   裸写 .nav__icon 会连抽屉一起关掉 —— 抽屉复用同一个类名，
   必须带 .topbar 作用域限定。 */
.topbar .nav__icon {
  display: none;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-shrink: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.icon-btn:hover {
  background: var(--material-hover);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.nav-toggle {
  display: none;
}

html[data-theme="light"] .theme-toggle .i-sun,
html:not([data-theme="light"]) .theme-toggle .i-moon {
  display: none;
}

/* 抽屉 */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  display: none;
}

.drawer.is-open {
  display: block;
}

.drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.drawer__panel {
  position: absolute;
  inset: var(--header-h) 0 0 0;
  background: var(--bg-base);
  border-top: 1px solid var(--separator);
  overflow-y: auto;
  padding: var(--s-4) var(--s-6) var(--s-10);
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}

.drawer__title {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--text-tertiary);
}

.drawer__link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: var(--fs-17);
  border-bottom: 1px solid var(--separator);
}

.drawer__link:hover {
  background: var(--material-hover);
  color: var(--text-primary);
}

.drawer__link svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.drawer__link.is-active {
  color: var(--accent);
}

.drawer__link.is-active svg {
  color: var(--accent);
}

.drawer__group {
  margin-top: var(--s-5);
}

.drawer__group-title {
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--s-2);
  padding-left: var(--s-3);
}

/* ==========================================================================
   06. 按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--h-control-lg);
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-15);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

/* 主操作：填充蓝 */
.btn--primary {
  background: var(--accent-fill);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-fill-hover);
  color: #fff;
}

.btn--primary:active {
  background: var(--accent-fill-pressed);
}

/* 次操作：中性填充（不用描边，描边满屏会显得吵） */
.btn--ghost {
  background: var(--material-hover);
  color: var(--text-primary);
}

.btn--ghost:hover {
  background: var(--material-active);
  color: var(--text-primary);
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--fs-13);
}

.btn--sm svg {
  width: 14px;
  height: 14px;
}

.btn.is-disabled,
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  font-size: var(--fs-13);
  font-weight: 500;
}

.link-arrow svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform var(--dur-fast) var(--ease);
}

.card:hover .link-arrow svg {
  transform: translateX(2px);
}

/*
 * 图标用 --text-primary 而不是 --text-secondary：
 * 这些是社交账号入口，需要一眼看清，浅色主题下要接近纯黑
 * （--text-secondary #55555a 偏灰，显得糊）。深色下自然是近白。
 */
.social-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--material-hover);
  color: var(--text-primary);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.social-btn:hover {
  background: var(--material-active);
  color: var(--accent);
}

.social-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

/* ==========================================================================
   07. 卡片
   --------------------------------------------------------------------------
   旧版卡片 = 描边 + 底色 + 圆角，而且全站每个块都是卡片，于是整页变成
   一张密密麻麻的网格线 —— 这是「像后台管理系统」的根因。

   新版只做一件事：卡片不再描边，只保留极淡的底色。
   底色比描边弱得多，同一屏里放十几个也不会互相打架；需要强调时
   （.card--glow）才补一条左侧竖线。空白与排版负责分组，卡片只负责
   「这几行属于一起」。
   ========================================================================== */
.card {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  border: 0;
  background: var(--bg-inset);
}

html[data-theme="light"] .card {
  border-color: transparent;
}

.card--hover {
  transition: background var(--dur-fast);
}

.card--hover:hover {
  background: var(--bg-raised);
}

.card--link {
  color: inherit;
}

.card--link:hover {
  color: inherit;
}

/* 强调卡：左侧竖线。比整卡换色克制，也确实起到了「标记这一条」的作用 */
.card--glow {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}

.card__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

/* 卡片图标底色去掉：一页十几个淡色方块，除了噪声没有别的作用。
   只保留图标本身的颜色。 */
.card__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 0;
  background: none;
  color: var(--accent);
  flex-shrink: 0;
}

.card__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

/* 卡片标题用衬线，和区块标题同一套语气 */
.card__title {
  font-family: var(--font-serif);
  font-size: var(--fs-17);
  font-weight: 600;
  line-height: 1.4;
}

.card__desc {
  color: var(--text-secondary);
  font-size: var(--fs-13);
  line-height: 1.7;
  flex: 1;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-top: auto;
  padding-top: var(--s-3);
}

/* 统计卡：去掉盒子，只留数字 + 标签，四项之间靠间距分组 */
.stat-card {
  padding: 0;
  border-radius: 0;
  border: 0;
  background: none;
}

/* 数字用等宽衬线大字，读起来像报表里的关键值 */
.stat-card__num {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--fs-28);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--text-primary);
}

.stat-card__label {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-12);
  color: var(--text-tertiary);
}

/* 空状态 */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--s-12) var(--s-4);
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-full);
  background: var(--material-hover);
  color: var(--text-quaternary);
}

.empty__icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.empty__title {
  font-size: var(--fs-15);
  font-weight: 600;
  margin-bottom: var(--s-1);
}

.empty__desc {
  color: var(--text-tertiary);
  font-size: var(--fs-13);
}

/* 提示条 */
.notice {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--material-hover);
  border-left: 3px solid var(--text-tertiary);
  color: var(--text-secondary);
  font-size: var(--fs-13);
  line-height: 1.55;
}

.notice svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.notice--warn {
  background: var(--orange-soft);
  border-left-color: var(--orange);
  color: var(--text-primary);
}

.notice--warn svg {
  color: var(--orange);
}

/* ==========================================================================
   08. 标签 / 徽章 / 筛选块
   ========================================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
  background: var(--material-hover);
  color: var(--text-secondary);
}

.tag--brand {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag--cyan {
  background: var(--teal-soft);
  color: var(--teal);
}

.tag--emerald {
  background: var(--green-soft);
  color: var(--green);
}

.tag--amber {
  background: var(--orange-soft);
  color: var(--orange);
}

.tag--rose {
  background: var(--red-soft);
  color: var(--red);
}

.tag--violet {
  background: var(--purple-soft);
  color: var(--purple);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.5;
}

/* 筛选块 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-md);
  background: var(--material-hover);
  color: var(--text-secondary);
  font-size: var(--fs-13);
  font-weight: 500;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.chip:hover {
  background: var(--material-active);
  color: var(--text-primary);
}

.chip.is-active {
  background: var(--accent-fill);
  color: #fff;
}

.chip.is-active:hover {
  background: var(--accent-hover);
  color: #fff;
}

.chip__count {
  font-size: var(--fs-11);
  opacity: 0.7;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.controls__search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.controls__search input {
  width: 100%;
  height: var(--h-control-lg);
  padding: 0 12px 0 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-13);
}

.controls__search input::placeholder {
  color: var(--text-tertiary);
}

.controls__search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.controls__search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-tertiary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  pointer-events: none;
}

/* ==========================================================================
   09. 报头（首页）+ 内页页头
   --------------------------------------------------------------------------
   首页首屏（.masthead）不再用背景图，整块由排版构成 —— 理由见
   index.html 顶部注释。这里只讲间距怎么定的：

   标语上下各留一大段空白（clamp 40–88px），让它在首屏里是孤立的、
   唯一的重音。参考站（leerob / paco / pedro）的首屏共同点就是这个 ——
   一屏基本只讲一件事，其余全是留白。

   内页仍保留 .hero--compact（带底图的标题区），但压得更矮、更克制。
   ========================================================================== */
.masthead {
  padding-block: clamp(48px, 9vw, 104px) clamp(32px, 5vw, 56px);
}

/* 栏目标记：等宽大写小字，像杂志的栏目名 */
.masthead__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: clamp(var(--s-5), 3vw, var(--s-8));
}

/* 整页唯一的大字。衬线 + 700，行高压到 1.16，
   中文大字行距放松会散，收紧才成块。

   max-width 取 24ch、字号上限 5vw：20ch + 5.4vw 时，1440px 下标题会折成
   三行、最后一行只剩「东西。」两个字 —— 中文的孤儿行比西文明显得多，
   因为一个「词」可能只有两个字，断在哪里都很显眼。放宽一档并用
   text-wrap:balance 让浏览器均分两行，这个孤儿就消失了。 */
.masthead__title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, var(--fs-52));
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: 0.01em;
  max-width: 24ch;
  text-wrap: balance;
  margin-bottom: clamp(var(--s-5), 3vw, var(--s-6));
}

.masthead__lede {
  font-size: var(--fs-17);
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 52ch;
}

/* 出版信息：等宽小字 + 顶部细线，四项之间用「·」而不是分隔线，
   避免又变成一排小盒子。 */
.masthead__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: clamp(var(--s-6), 4vw, var(--s-10));
  padding-top: var(--s-5);
  border-top: 1px solid var(--separator);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.masthead__meta b {
  font-weight: 500;
  color: var(--text-primary);
}

/* ==========================================================================
   09b. 内页页头 Hero
   ========================================================================== */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: var(--s-8) var(--s-6);
  border-bottom: 1px solid var(--separator);
}

/* 只有带图的首屏需要这些间距；内页的紧凑标题区不受影响 */
.hero--banner {
  display: flex;
  align-items: flex-end;
  min-height: clamp(300px, 42vh, 440px);
  padding-block: var(--s-10) var(--s-8);
  border-bottom-color: transparent;
}

/* /about/ 与 /404.html 也自带背景图（走 background-image 的 div，
   不是 <img>），它们同样是「有图的首屏」，只是矮一些。 */
.hero--compact.has-bg {
  display: flex;
  align-items: flex-end;
  min-height: 240px;
  padding-block: var(--s-8) var(--s-6);
  border-bottom-color: transparent;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

/* background-image 版的背景（/about/、/404）没有 object-fit，
   用 background-size/position 达到同样效果 */
div.hero__bg {
  background-size: cover;
  background-position: center 42%;
  background-repeat: no-repeat;
}

/* 遮罩默认不显示，只在「这一块真的有背景图」时才画。
   .hero--banner 一定有图；内页则看有没有 .hero__bg。
   这样即使某个页面手写了一个空的 <div class="hero__scrim">（好几个内页
   都这么写），也不会在一张空底色上凭空压一层黑。
   之前靠 .hero__scrim{display:none} 一刀切，等于把 /about/ 和 404 的
   背景图一起关掉了；现在改成按「有没有图」判断。 */
.hero__scrim {
  display: none;
}

.hero--banner .hero__scrim,
.hero:has(.hero__bg) .hero__scrim {
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  /* 只压底部：文字靠左下方坐着，顶部留给背景自己露出来。
     之前是「底部 0.92 + 整体横向 0.55」两层，等于把整块图都盖住了，
     实测文字后面只剩 7~33 的亮度（满值 255），图基本看不见。
     现在改成一道从底部升起的渐变，背景在顶部完全通透。 */
  background: linear-gradient(
    to top,
    rgba(28, 14, 8, 0.86) 0%,
    rgba(28, 14, 8, 0.58) 38%,
    rgba(28, 14, 8, 0.16) 72%,
    rgba(28, 14, 8, 0) 100%
  );
}

/* 浅色主题下背景本来就亮，白字需要更实的底。
   这里只针对 --banner：内页的 --compact 头图另有专门的规则，
   如果这里写成 .hero:has(.hero__bg) 会把那条盖掉
   （html + [data-theme] + .hero + :has() 的权重高于三个类），
   结果就是 /about/ 在浅色下用回了「只压底部」的渐变，最亮处依旧 180。 */
html[data-theme="light"] .hero--banner .hero__scrim {
  background: linear-gradient(
    to top,
    rgba(28, 16, 10, 0.82) 0%,
    rgba(28, 16, 10, 0.52) 42%,
    rgba(28, 16, 10, 0.14) 74%,
    rgba(28, 16, 10, 0) 100%
  );
}

/* 有的内页用自己的图 + 自己的遮罩，文字同样要脱离主题色。
   这类头图只有 240px 高，文字基本铺满整块，所以不能用「只压底部」的渐变
   —— 实测 /about/ 那张照片最亮处亮度 180（满值 255），
   白字压上去只有 2.07:1，连大字要求的 3:1 都不到。
   这里改成一层均匀的深色，保证整块都能托住白字。 */
.hero--compact.has-bg .hero__scrim {
  background: linear-gradient(
    to top,
    rgba(28, 14, 8, 0.74) 0%,
    rgba(28, 14, 8, 0.66) 55%,
    rgba(28, 14, 8, 0.62) 100%
  );
}

.hero--compact.has-bg .hero__title {
  color: #fff;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.5);
}

.hero--compact.has-bg .hero__sub {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

/* 深色模式不再给背景图加滤镜。
   这条原本是为了压暗那张偏亮的照片，但现在的背景是两张各自为对应主题
   调好色的 SVG（tools/make-hero-bg.js），本身已经是目标明度；
   再叠一层 brightness(0.62) 只会把它压成一团黑。
   如果哪天换回照片，这里需要重新按那张图调。 */

.hero--banner .hero__inner {
  max-width: 820px;
}

/* 图上文字必须脱离主题色：这里是固定的白字压深色遮罩，
   不能跟着浅色主题变成深色字。 */
.hero--banner .hero__title {
  color: #fff;
  text-shadow: 0 1px 20px rgba(0, 0, 0, 0.45);
}

.hero--banner .hero__sub {
  color: rgba(255, 255, 255, 0.84);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4);
}

.hero--banner .hero__stats {
  color: rgba(255, 255, 255, 0.66);
}

.hero--compact {
  padding-block: var(--s-6) var(--s-4);
}

.hero__inner {
  max-width: 760px;
}

.hero__title {
  font-size: var(--fs-28);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-block: var(--s-3) var(--s-2);
}

/* 首屏口号：这是整页视觉重量的来源，字号和行距都单独放开 */
.hero--banner .hero__title {
  font-size: clamp(30px, 4.2vw, 52px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.03em;
  margin-block: var(--s-4) var(--s-3);
  max-width: 20ch;
}

.hero__sub {
  font-size: var(--fs-15);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 68ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

/* 一行小字交代体量即可，不做成四个大数字。
   颜色用 tertiary 而不是 quaternary：后者在页面底色上只有 4.10:1，不达标。 */
.hero__stats {
  margin-top: var(--s-4);
  color: var(--text-tertiary);
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
}

.hero__avatar {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 3px 12px 3px 3px;
  border-radius: var(--r-full);
  border: 1px solid var(--separator);
  background: var(--bg-elevated);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text-secondary);
}

.hero__avatar img,
.hero__avatar > span:first-child {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--accent-fill);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 600;
}

.hero__avatar-text {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   首页顶部搜索（默认折叠）
   --------------------------------------------------------------------------
   收起时只占一行、看起来像输入框但其实是按钮；点开或按 / 才展开真正的
   输入框。这样搜索始终在页面最上方伸手可及，又不会在用户想读内容时
   先占掉一大块。
   -------------------------------------------------------------------------- */
.topsearch {
  padding-top: var(--s-4);
}

.topsearch__inner {
  position: relative;
  max-width: 560px;
}

/* [hidden] 必须显式处理：下面 .topsearch__toggle 设了 display:flex，
   而作者样式里的 display 会盖掉浏览器默认的 [hidden]{display:none}。
   漏了这条的后果不是「不隐藏」，而是折叠按钮和展开的输入框同时绘制，
   看上去就是搜索栏重影。.topsearch__panel 同理。 */
.topsearch__toggle[hidden] {
  display: none;
}

.topsearch__toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: var(--fs-13);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}

.topsearch__toggle:hover {
  border-color: var(--separator-strong);
  color: var(--text-secondary);
}

.topsearch__toggle:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
}

.topsearch__toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.topsearch__hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topsearch__kbd {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--text-tertiary);
  border: 1px solid var(--separator-strong);
  border-radius: var(--r-sm);
  padding: 1px 5px;
}

.topsearch__panel {
  position: relative;
  display: flex;
  align-items: center;
}

.topsearch__panel[hidden] {
  display: none;
}

.topsearch__icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  pointer-events: none;
}

.topsearch__input {
  width: 100%;
  height: 38px;
  padding: 0 78px 0 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent);
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-15);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.topsearch__input::placeholder {
  color: var(--text-tertiary);
}

.topsearch__input:focus {
  outline: none;
}

.topsearch__close {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.topsearch__close:hover {
  background: var(--material-hover);
  color: var(--text-primary);
}

.topsearch__close:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
}

.topsearch__close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* 旧的首页搜索框样式保留：别的页面没有顶部条时仍会用到 */
.hero-search {
  position: relative;
  max-width: 460px;
  margin-top: var(--s-5);
}

.hero-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  pointer-events: none;
}

.hero-search__input {
  width: 100%;
  height: 42px;
  padding: 0 60px 0 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-15);
}

.hero-search__input::placeholder {
  color: var(--text-tertiary);
}

.hero-search__input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-base);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.hero-search__kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--text-tertiary);
  border: 1px solid var(--separator-strong);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  pointer-events: none;
}

/* 搜索结果下拉 */
.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: var(--z-sticky);
  background: var(--bg-elevated);
  border: 1px solid var(--separator-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  max-height: 340px;
  overflow-y: auto;
  display: none;
}

.search-results.is-open {
  display: block;
}

.search-results a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-4);
  color: var(--text-primary);
  border-bottom: 1px solid var(--separator);
  font-size: var(--fs-13);
}

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

.search-results a:hover,
.search-results a.is-active {
  background: var(--material-hover);
  color: var(--text-primary);
}

.search-results .sr-type {
  font-size: var(--fs-11);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-results .sr-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   10. 区块标题
   --------------------------------------------------------------------------
   旧版：标题 20px + 右侧说明 + 一条通栏底线。三个元素挤在一行、又被线
   压住，读起来像设置面板的分组标题。

   新版改用「栏目头」的排法：
     · 标题放大到 24px 并换衬线，真正成为一节的开始
     · 说明从「右侧对齐的灰字」改成「标题下面独立一行的导语」——
       中文右对齐的短句非常难读，而且和标题基线对齐会左右打架
     · 底线只留标题下方一小段（用 ::after 画），不是通栏 —— 通栏线会
       把每一节切成表格行；短横线只标记「这一节从这里开始」
   ========================================================================== */
.sec-head {
  display: block;
  margin-bottom: clamp(var(--s-5), 3vw, var(--s-8));
}

.sec-head__title {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  padding-bottom: var(--s-3);
  position: relative;
}

/* 标题下的短横线：宽度跟着文字走（max-content 由 inline-block 决定），
   所以长标题有线、短标题也有线，看起来是「标了重点」而不是「画了边框」。 */
.sec-head__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.sec-head__desc {
  display: block;
  color: var(--text-secondary);
  font-size: var(--fs-15);
  line-height: 1.7;
  max-width: 60ch;
  margin-top: var(--s-3);
  text-align: left;
}

/* 分组标题（工具箱 / 收藏夹）：图标方块去掉，改用左侧短竖条标记分组，
   避免一页里出现十几个彩色方块。 */
.sec-head--icon .sec-head__title {
  display: inline-block;
  padding-left: var(--s-4);
}

.sec-head--icon .sec-head__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25em;
  width: 3px;
  height: 1em;
  border-radius: 2px;
  background: var(--accent);
}

.sec-head--icon .sec-head__title::after {
  left: var(--s-4);
}

.sec-head__icon {
  display: none;
}

/* 分组之间拉开距离，让「分类」这件事一眼可辨 */
.section-tight > .sec-head {
  margin-bottom: clamp(var(--s-5), 3vw, var(--s-8));
}

/* ==========================================================================
   11. 首页板块索引 —— 全站唯一的「肉色带」
   --------------------------------------------------------------------------
   这一块是整站的签名。八个板块需要一条把它们绑在一起的地，所以整幅铺一层
   肉色（--flesh），左右通栏、上下留足空白 —— 全站只有这一处用饱和面，
   其余地方一律是底色加细线。饱和面是稀缺资源，用第二次就不再是签名。

   行本身仍是索引：无盒子、无圆角，靠横线切行，左侧等宽序号 01–08。
   变化在右侧那块色标 —— 八行依次取暖色梯的一级（--ramp-1 … --ramp-8），
   从肉色一路走到陶土。它替换掉原来的八张示意图：示意图是「假截图」，
   信息量是零；色标至少和序号讲的是同一件事 —— 顺序。

   带子用 .band--flesh 包住 .wrap，所以底色通栏、内容仍受 1100px 约束。
   ========================================================================== */
.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--separator);
}

.module {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-2);
  border-bottom: 1px solid var(--separator);
  border-radius: 0;
  background: none;
  color: var(--text-primary);
  transition: background var(--dur-fast);
}

/* hover 只用一层极淡的底色，不做位移、不换描边 —— 行列表里位移会让
   整列跳动，反而显得廉价。 */
.module:hover {
  background: var(--material-hover);
  color: var(--text-primary);
}

/* 序号：等宽，固定在左侧，宽度写死让所有行的名称左边缘对齐。
   01–08 是真实的分区顺序，不是装饰性编号。
   颜色取 --text-tertiary 而不是 --text-quaternary：后者按本设计系统的
   约定只用于装饰元素，而序号是内容（读屏会念出来），必须达到正文对比度。 */
.module__num {
  flex-shrink: 0;
  width: 2.2em;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  transition: color var(--dur-fast);
}

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

/* 色标块：一格实色，取本行自己的梯级（--ramp），中间一个线性图标，
   墨色取 --ramp-ink —— 梯子中段明暗翻转，所以 01–04 深墨、05–08 浅墨，
   两套主题各自把值给好了，这里不需要任何判断。
   尺寸沿用原来的 88×55：它是色标，不是配图，不参与阅读。 */
.module__thumb {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 88px;
  aspect-ratio: 8 / 5;
  border-radius: var(--r-sm);
  background: var(--ramp);
  color: var(--ramp-ink);
  transition: transform var(--dur-fast);
}

.module__thumb svg {
  width: 22px;
  height: 22px;
}

/* hover 时色标轻轻放大 —— 和行尾淡入的箭头一起构成「整行可点」的提示。
   不做位移：行列表里位移会让整列跳动，反而显得廉价。 */
.module:hover .module__thumb {
  transform: scale(1.06);
}

.module__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.module__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
}

/* 名称回到衬线 —— 和页面标题同一套语气，整站才是一个声音 */
.module__name {
  font-family: var(--font-serif);
  font-size: var(--fs-17);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* 计数从「胶囊」改成等宽小字。胶囊会凭空多出八个色块，
   等宽小字只是安静地提供一个数字。 */
.module__count {
  padding: 0;
  border-radius: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 400;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.module__desc {
  font-size: var(--fs-13);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 行尾的箭头：静止时不可见，hover 时淡入并右移。
   这是唯一的动效，用来确认「整行可点」。 */
.module::after {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--dur-fast), transform var(--dur-fast);
  background: currentColor;
  color: var(--accent);
  -webkit-mask: var(--arrow-mask) center / contain no-repeat;
  mask: var(--arrow-mask) center / contain no-repeat;
}

.module:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* 八个板块 = 暖色梯的八级。
   这里只设两个变量，色标块的底和图标墨色都取它 —— 两套主题各自在
   --ramp-N / --ramp-ink-N 里定义过，所以主题切换不用在这里再写一遍。
   梯级和「01–08」的分区顺序绑定：颜色本身在复述顺序，这是信息不是装饰。 */
.module--blog {
  --ramp: var(--ramp-1);
  --ramp-ink: var(--ramp-ink-1);
}

.module--soft {
  --ramp: var(--ramp-2);
  --ramp-ink: var(--ramp-ink-2);
}

.module--drive {
  --ramp: var(--ramp-3);
  --ramp-ink: var(--ramp-ink-3);
}

.module--download {
  --ramp: var(--ramp-4);
  --ramp-ink: var(--ramp-ink-4);
}

.module--projects {
  --ramp: var(--ramp-5);
  --ramp-ink: var(--ramp-ink-5);
}

.module--pentest {
  --ramp: var(--ramp-6);
  --ramp-ink: var(--ramp-ink-6);
}

.module--toolbox {
  --ramp: var(--ramp-7);
  --ramp-ink: var(--ramp-ink-7);
}

.module--bookmarks {
  --ramp: var(--ramp-8);
  --ramp-ink: var(--ramp-ink-8);
}

/* 模块数是偶数（8 个），正好铺满 2 列；如果将来增删成奇数，
   再给最后一项加 grid-column: 1 / -1 补满整行即可。 */
/* ==========================================================================
   安全工具库（/pentest/）
   --------------------------------------------------------------------------
   条目数量多、每条信息量小，所以用 auto-fill 的窄卡片网格：一屏能扫
   十几个工具，卡片之间靠底色和描边分组，不做装饰。
   ========================================================================== */
.pentest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}

.pentest-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--bg-inset);
  transition: background var(--dur-fast);
}

.pentest-card:hover {
  background: var(--bg-raised);
}

.pentest-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}

.pentest-card__name {
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  min-width: 0;
}

/* 类别角标：和分组标题呼应，方便单独搜索时判断来源 */
.pentest-card__cat {
  flex-shrink: 0;
  font-size: var(--fs-11);
  color: var(--text-tertiary);
  border: 1px solid var(--separator);
  border-radius: var(--r-sm);
  padding: 1px 6px;
}

.pentest-card__desc {
  font-size: var(--fs-13);
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.pentest-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--separator);
}

.pentest-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.pentest-card__tags .tag {
  font-size: var(--fs-11);
  height: 20px;
  padding-inline: 6px;
}

/* 宽表格（如仓库结构统计）在窄屏要能横向滚动，而不是撑破视口 */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .pentest-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==========================================================================
   应用图标（软件卡 / 项目卡）
   --------------------------------------------------------------------------
   优先用真实图标：img/icons/*.png 是从各程序 exe 的图标资源里提取出的
   256px 帧（PP-OCRv6、Note Studio、Rime/Weasel），网页工具没有图标，
   用同尺寸同圆角的自绘图标补齐。字母方块只作为兜底保留。
   ========================================================================== */
.app-icon {
  display: block;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  /* 透明底的图标（如 Weasel 的白字 logo）也能看清 */
  background: var(--material-hover);
}

.app-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.app-icon--lg {
  width: 38px;
  height: 38px;
}

/* ==========================================================================
   预览图（软件卡 / 项目卡）
   --------------------------------------------------------------------------
   img/preview/*.svg 是自绘的界面示意图：矢量、几 KB、随主题缩放，
   取代了原先所有文章共用同一张的通用风景照。
   ========================================================================== */
.card__preview,
.soft-card__preview {
  display: block;
  margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) var(--s-4);
  border-bottom: 1px solid var(--separator);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
  background: var(--bg-inset);
}

.card__preview img,
.soft-card__preview img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* 子页面 hero 里的示意图（如安全工具库） */
.hero__figure {
  margin: var(--s-4) 0 0;
  max-width: 560px;
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-inset);
}

.hero__figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* 文章页顶部的界面示意图 */
.post-header__figure {
  margin: var(--s-5) 0 0;
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-inset);
}

.post-header__figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* 文章列表里的一行缩略图（首页 + 博客页都用）
   img/preview/*.svg 是 640x360 的界面示意图，图里带文字，原来只有
   72x44，缩到看不清，等于白占一块位置。现在按 16:9 给到 152px 宽
   （约 86px 高）：行内文字本来就约 93px 高（标题 + 副标题 + 两行摘要），
   所以放大之后并不会把行撑高，是「白捡」的。 */
/* 缩略图去掉描边 —— 一张图本身就是一块内容，再框一圈只是多一条线。
   圆角保留在图上（overflow:hidden 负责裁切）。 */
.post-row__thumb {
  flex-shrink: 0;
  width: 152px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  border: 0;
  overflow: hidden;
  background: var(--bg-inset);
}

.post-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 640px) {
  .post-row__thumb {
    display: none;
  }
}

/* ==========================================================================   12. 文章卡片
   --------------------------------------------------------------------------
   首页「最新文章」用 .post-list，博客页用 .post-list--rich。

   行标题改用衬线。文章列表是整个站点出现次数最多的元素，它的字体决定
   了访客对「这个站是什么气质」的判断 —— 无衬线 15px 半粗体的文章标题，
   任何博客模板都是这样；换成衬线之后，列表本身就带上了编辑感。

   日期 / 阅读时长 / 浏览数交给等宽字体，和页头的数据行呼应。
   ========================================================================== */
.post-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--separator);
}

/* 栅格项默认 min-width:auto，行内的 nowrap 文本会把它顶得比视口还宽，
   而不是按预期省略号截断，所以这里显式归零。 */
.post-list > li {
  min-width: 0;
}

.post-row__link {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-2);
  border-bottom: 1px solid var(--separator);
  color: var(--text-primary);
  transition: background var(--dur-fast);
}

.post-row__link:hover {
  background: var(--material-hover);
  color: var(--text-primary);
}

.post-row__main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

/* 标题用衬线、字重 600、允许两行。
   旧版强制 nowrap + 省略号，中文标题经常被切在半句话上。 */
.post-row__title {
  font-family: var(--font-serif);
  font-size: var(--fs-17);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-row__excerpt {
  font-size: var(--fs-13);
  color: var(--text-tertiary);
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 元信息：等宽 + 制表数字，和页头的数据行同一套写法 */
.post-row__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* 博客页的加强版行：多一行副标题、摘要允许折到两行、
   标签与日期在右侧竖排。首页那版是一行一篇的极简版。 */
.post-list--rich .post-row__link {
  padding: var(--s-6) var(--s-2);
  align-items: flex-start;
}

.post-list--rich .post-row__main {
  gap: 6px;
}

.post-list--rich .post-row__title {
  font-size: var(--fs-20);
}

.post-row__sub {
  font-size: var(--fs-13);
  color: var(--text-secondary);
  line-height: 1.6;
}

.post-list--rich .post-row__excerpt {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: var(--fs-13);
  line-height: 1.7;
}

.post-list--rich .post-row__meta {
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
  padding-top: 4px;
}

/* ==========================================================================
   13. 软件卡
   ========================================================================== */
.soft-card {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  border: 0;
  background: var(--bg-inset);
  transition: background var(--dur-fast);
}

.soft-card:hover {
  background: var(--bg-raised);
}

.soft-card__top {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.soft-card__logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-17);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.soft-card__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.soft-card__head {
  min-width: 0;
  flex: 1;
}

.soft-card__name {
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: 1.35;
}

.soft-card__pub {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: var(--fs-12);
}

.soft-card__desc {
  color: var(--text-secondary);
  font-size: var(--fs-13);
  line-height: 1.55;
  margin-bottom: var(--s-2);
}

.soft-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: var(--s-3);
}

.soft-card__specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  padding-block: var(--s-2);
  border-top: 1px solid var(--separator);
  font-size: var(--fs-11);
  color: var(--text-tertiary);
}

.soft-card__spec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.soft-card__spec svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.soft-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: auto;
  padding-top: var(--s-3);
}

/* ==========================================================================
   14. 云盘 / 工具 / 收藏 / 友链 / 项目
   ========================================================================== */
.drive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}

.drive-card {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  border: 0;
  background: var(--bg-inset);
  transition: background var(--dur-fast);
}

.drive-card:hover {
  background: var(--bg-raised);
}

.drive-card__logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--material-hover);
  color: var(--text-secondary);
  font-size: var(--fs-17);
  font-weight: 600;
  margin-bottom: var(--s-3);
}

.drive-card__name {
  font-size: var(--fs-17);
  font-weight: 600;
  margin-bottom: var(--s-1);
}

.drive-card__desc {
  color: var(--text-secondary);
  font-size: var(--fs-13);
  line-height: 1.55;
  margin-bottom: var(--s-3);
}

.drive-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: var(--s-3);
}

.drive-card__actions {
  display: flex;
  gap: var(--s-2);
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: 1px solid var(--separator);
}

/* 容量条 */
.meter {
  margin-bottom: var(--s-3);
}

.meter__head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  margin-bottom: 5px;
}

.meter__track {
  height: 4px;
  border-radius: var(--r-full);
  background: var(--material-hover);
  overflow: hidden;
}

.meter__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent);
}

/* 工具箱 / 收藏夹 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--s-2);
}

.tool-tile {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-3);
  border-radius: var(--r-md);
  border: 0;
  background: var(--bg-inset);
  color: var(--text-primary);
  min-height: 46px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.tool-tile:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.tool-tile__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--material-hover);
  color: var(--text-tertiary);
  font-size: var(--fs-12);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.tool-tile__icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.tool-tile__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tool-tile__name {
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.3;
}

/* 条目右侧的小标记：开源 / 国内 */
.tool-flag {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  vertical-align: 1px;
}

.tool-flag--cn {
  border-color: var(--separator-strong);
  background: var(--material-hover);
  color: var(--text-tertiary);
}

.tool-tile__desc {
  font-size: var(--fs-11);
  color: var(--text-tertiary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-tile > div:not([class]) {
  min-width: 0;
  flex: 1;
}

/* 时钟 */
.clock-widget {
  display: inline-flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--separator);
  background: var(--bg-elevated);
}

.clock-widget__time {
  font-size: var(--fs-34);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.clock-widget__meta {
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: var(--fs-12);
}

/* 友链 */
.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
}

.friend-grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
}

.friend-card {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  border: 0;
  background: var(--bg-inset);
  color: var(--text-primary);
  transition: background var(--dur-fast);
}

.friend-card:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.friend-card__avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-15);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.friend-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-card__name {
  font-size: var(--fs-15);
  font-weight: 600;
  margin-bottom: 2px;
}

.friend-card__desc {
  color: var(--text-secondary);
  font-size: var(--fs-12);
  line-height: 1.5;
}

/* 技术栈条：projects.html 里 .skill 直接放在 .card 内，靠 margin 分栏 */
.skill {
  margin-bottom: var(--s-4);
}

.skill:last-child {
  margin-bottom: 0;
}

.skill__head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: 5px;
  font-size: var(--fs-13);
}

.skill__name {
  font-weight: 500;
}

.skill__track {
  height: 5px;
  border-radius: var(--r-full);
  background: var(--material-hover);
  overflow: hidden;
}

.skill__fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: var(--accent);
  transition: width 0.6s var(--ease);
}

/* 打勾清单（首页 / 软件页 / 友链页都用它列要点） */
.feature-list {
  display: grid;
  gap: 6px;
  margin-top: var(--s-3);
  list-style: none;
  padding-left: 0;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-13);
  color: var(--text-secondary);
  line-height: 1.55;
}

.feature-list svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--green);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

/* 对照表 */
.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-13);
}

.matrix th,
.matrix td {
  padding: 9px var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--separator);
}

.matrix th {
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--text-tertiary);
}

.matrix td {
  color: var(--text-secondary);
}

.matrix__name {
  color: var(--text-primary);
  font-weight: 500;
}

.matrix tbody tr:hover {
  background: var(--material-hover);
}

/* 下载列表：去掉外层描边框，改成「顶部一条线 + 每行一条分隔线」的
   表格式排法。与首页板块索引同一套语言，全站的行列表现在是一致的。 */
.dl-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--separator);
}

.dl-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-2);
  background: none;
  border-bottom: 1px solid var(--separator);
  min-height: 52px;
}

.dl-row:hover {
  background: var(--material-hover);
}

/* 行图标去掉底色方块，只留图形本身 */
.dl-row__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 0;
  background: none;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.dl-row__icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.dl-row__main {
  flex: 1;
  min-width: 0;
}

.dl-row__name {
  font-size: var(--fs-15);
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 体积 / 平台走等宽，和页头数据行呼应 */
.dl-row__meta {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.dl-row__action {
  flex-shrink: 0;
}

/* 归档 */
.archive-group {
  margin-bottom: var(--s-5);
}

.archive-group__year {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--s-2);
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--separator);
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: 7px 0;
  border-bottom: 1px solid var(--separator);
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item__date {
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  flex-shrink: 0;
  width: 44px;
}

.archive-item__title {
  font-size: var(--fs-13);
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

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

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-8);
}

.pager__btn,
.pager__num {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  background: var(--material-hover);
  color: var(--text-secondary);
  font-size: var(--fs-13);
}

.pager__btn:hover,
.pager__num:hover {
  background: var(--material-active);
  color: var(--text-primary);
}

.pager__num.is-active {
  background: var(--accent-fill);
  color: #fff;
}

/* ==========================================================================
   15. 文章页
   ========================================================================== */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: var(--s-10);
  align-items: start;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--s-10);
  align-items: start;
}

/* .about-comments 的样式在文件后面的「关于页」一节统一给，
   这里不再重复定义 —— 同一组选择器出现两次时，后一条会静默覆盖
   前一条，改样式的人很容易改到不生效的那一份。 */

.post-header {
  padding-block: clamp(var(--s-8), 5vw, var(--s-12)) var(--s-6);
  border-bottom: 0;
}

/* 文章标题：全站最大的字（34px 上限），衬线 + 700。
   正文页的标题必须比列表页的标题明显更大，读者才知道「我进来了」。 */
.post-header__title {
  font-family: var(--font-serif);
  font-size: clamp(var(--fs-24), 3.6vw, var(--fs-34));
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0.01em;
  max-width: 26ch;
  margin-bottom: var(--s-4);
}

.post-header__sub {
  color: var(--text-secondary);
  font-size: var(--fs-17);
  line-height: 1.7;
  max-width: 62ch;
  margin-bottom: var(--s-5);
}

.post-header__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: var(--s-5);
}

/* 文章元信息：等宽，和站内其他地方的数据同一套写法 */
.post-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  padding-top: var(--s-5);
  border-top: 1px solid var(--separator);
}

.post-header__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  /* 不加这条的话，头像或长日期会把这一行撑出视口宽度 */
  min-width: 0;
}

.post-header__meta-item svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  flex-shrink: 0;
}

/* 作者头像：GitHub 返回的是 460×460 原图，必须显式限尺寸 */
.post-header__meta-item img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* 正文：阅读为主，行宽与行距是关键。
   17px / 1.8 / 最大 68ch —— 中文长文的舒适区比西文窄一点，
   超过 70ch 视线回扫就开始丢行。 */
.post-content {
  font-size: var(--fs-17);
  line-height: 1.8;
  color: var(--text-primary);
  padding-block: var(--s-8);
  max-width: 68ch;
}

.post-content > * + * {
  margin-top: var(--s-4);
}

/* 正文 h2/h3 用衬线，和文章标题连成一条线。
   h2 去掉通栏底线（又一条「表格线」），改用顶部留白来分段 ——
   长文里段落之间的空白比一条线更能说明「新的一节开始了」。 */
.post-content h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-top: clamp(var(--s-10), 6vw, 56px);
  padding-bottom: 0;
  border-bottom: 0;
}

.post-content h3 {
  font-family: var(--font-serif);
  font-size: var(--fs-20);
  font-weight: 600;
  margin-top: var(--s-10);
}

.post-content h4 {
  font-size: var(--fs-17);
  font-weight: 600;
  margin-top: var(--s-8);
}

.post-content p {
  color: var(--text-secondary);
}

.post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--accent-soft);
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

.post-content ul,
.post-content ol {
  padding-left: 1.4em;
  color: var(--text-secondary);
}

.post-content li {
  margin-top: 5px;
}

.post-content li::marker {
  color: var(--text-quaternary);
}

.post-content blockquote {
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--separator-strong);
  background: var(--material-hover);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-secondary);
}

.post-content blockquote p {
  margin: 0;
}

.post-content img {
  border-radius: var(--r-md);
  border: 1px solid var(--separator);
  margin-inline: auto;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--separator);
  margin-block: var(--s-8);
}

/* 行内代码与代码块 */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--material-hover);
  color: var(--text-primary);
}

.post-content pre {
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--separator);
  background: var(--bg-inset);
  overflow-x: auto;
  font-size: var(--fs-13);
  line-height: 1.65;
}

.post-content pre code {
  padding: 0;
  background: none;
  color: var(--text-primary);
}

/* Rouge 把代码块渲染成「行号 + 代码」两列表格。
   实际 DOM 结构（kramdown + rouge）是：
     div.language-xx.highlighter-rouge
       └ div.highlight
           └ pre.highlight
               └ code
                   └ table.rouge-table
                       └ td.rouge-gutter / td.rouge-code
   通用 `.post-content pre` 规则给了 pre overflow-x:auto，那会在表格外面
   再套一层滚动容器，于是表格按内容宽度撑开、先把页面顶宽。
   所以这里要把这条链上除「表格自身」以外的 overflow 全部关掉，
   只留 .rouge-table 一个滚动容器。 */
.post-content .highlighter-rouge,
.post-content .highlight,
.post-content pre.highlight {
  max-width: 100%;
  overflow: visible;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
}

.post-content .rouge-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 0;
  background: none;
  font-size: inherit;
  margin: 0;
  padding: 0;
}

.post-content .rouge-table tbody {
  display: block;
  width: 100%;
}

.post-content .rouge-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.post-content .rouge-table td {
  padding: 0;
  border: 0;
  min-width: 0;
}

.post-content .rouge-table .rouge-gutter {
  display: table-cell;
  width: 3em;
  padding-right: var(--s-3);
  text-align: right;
  user-select: none;
  opacity: 0.4;
  overflow: hidden;
  white-space: nowrap;
}

.post-content .rouge-table .rouge-code {
  display: table-cell;
  width: auto;
  min-width: 0;
}

/* 关键：td 是 table-cell，CSS 规范下 table-cell 上的 overflow 不产生滚动容器
   （实测 ovX:auto 的单元格依然让 595px 的内容画到外面）。
   所以真正的滚动容器必须是单元格里的那个内层 <pre>。
   注意这里用 > 直接子选择器，避免误伤外层 pre.highlight —— 外层必须保持
   overflow:visible，否则它会在表格外面再套一层滚动容器。 */
.post-content .rouge-table td.rouge-code > pre,
.post-content .rouge-table td.rouge-gutter > pre {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  padding: 0;
  border: 0;
  background: none;
}

.post-content .rouge-table pre {
  padding: 0;
  border: 0;
  background: none;
  max-width: 100%;
  overflow-x: visible;
}

/* Rouge 的 token span 默认不换行，长行会撑破容器 */
.post-content .rouge-table code,
.post-content .rouge-table code span {
  white-space: pre;
}

/* 表格 */
.post-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-13);
  display: block;
  overflow-x: auto;
}

.post-content th,
.post-content td {
  padding: 8px var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--separator);
  min-width: 0;
}

.post-content th {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-tertiary);
}

.post-content table code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 迁移文章里残留的内联浅色样式（#1677FF / #F0F5FF / #262626 等）
   原本按白底写的，深色模式下会刺眼且对比度不足，这里映射到主题令牌。 */
.post-content [style*="#F0F5FF"],
.post-content [style*="#f0f5ff"],
.post-content [style*="#FFFFFF"],
.post-content [style*="#ffffff"] {
  background: var(--bg-elevated) !important;
}

.post-content [style*="#E8E8E8"],
.post-content [style*="#e8e8e8"] {
  border-color: var(--separator) !important;
}

.post-content [style*="#8C8C8C"],
.post-content [style*="#8c8c8c"],
.post-content [style*="#595959"] {
  color: var(--text-tertiary) !important;
}

.post-content [style*="#262626"] {
  color: var(--text-primary) !important;
}

.post-content a[style*="#1677FF"],
.post-content a[style*="#1677ff"] {
  color: var(--accent) !important;
}

.post-content a[style*="background:#1677FF"],
.post-content a[style*="background:#1677ff"],
.post-content a[style*="background: #1677FF"],
.post-content a[style*="background: #1677ff"] {
  background: var(--accent-fill) !important;
  color: #fff !important;
  border: 0 !important;
}

.post-content a[style*="background:#FFFFFF"],
.post-content a[style*="background:#ffffff"] {
  background: var(--material-hover) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--separator-strong) !important;
}

/* 目录 */
.toc-col {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
}

.toc {
  border-left: 1px solid var(--separator);
  padding-left: var(--s-4);
}

.toc__title {
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--s-2);
}

.toc__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
}

.toc__link {
  display: block;
  padding: 4px 0;
  color: var(--text-tertiary);
  font-size: var(--fs-12);
  line-height: 1.45;
  border-left: 2px solid transparent;
  margin-left: -1px;
  padding-left: var(--s-3);
}

.toc__link:hover {
  color: var(--text-primary);
}

.toc__link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.toc__link.is-sub {
  padding-left: var(--s-5);
}

/* 分享 / 上下篇 */
.share-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding-block: var(--s-5);
  border-top: 1px solid var(--separator);
}

.share-row__label {
  font-size: var(--fs-12);
  color: var(--text-tertiary);
}

.share-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--material-hover);
  color: var(--text-secondary);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.share-btn:hover {
  background: var(--material-active);
  color: var(--text-primary);
}

.share-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.share-btn.is-pinned {
  color: var(--orange);
}

/* ==========================================================================
   静态网站预览覆盖层
   --------------------------------------------------------------------------
   点卡片上的「预览」在页内打开真实站点。面板占满可视区、留出一点边距，
   顶部一条细栏放标题、域名、外部打开和关闭 —— 不再堆装饰。
   ========================================================================== */
.pv {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}

.pv[hidden] {
  display: none;
}

.pv__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.pv.is-open .pv__backdrop {
  opacity: 1;
}

.pv__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1200px, 100%);
  height: min(820px, 100%);
  overflow: hidden;
  border: 1px solid var(--separator-strong);
  border-radius: var(--r-xl);
  background: var(--bg-elevated);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: scale(0.98);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.pv.is-open .pv__panel {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .pv__backdrop,
  .pv__panel {
    transition: none;
  }
}

.pv__bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-shrink: 0;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--separator);
  background: var(--bg-raised);
}

.pv__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--green);
  flex-shrink: 0;
}

.pv__title {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv__host {
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pv__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
  flex-shrink: 0;
}

.pv__body {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--bg-inset);
}

.pv__frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.pv__frame.is-ready {
  opacity: 1;
}

.pv__spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  color: var(--text-tertiary);
  font-size: var(--fs-13);
  text-align: center;
  padding: var(--s-4);
}

.pv__spinner.is-hidden {
  display: none;
}

.pv__spinner-ring {
  width: 18px;
  height: 18px;
  border: 2px solid var(--separator-strong);
  border-top-color: var(--accent);
  border-radius: var(--r-full);
  animation: pv-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes pv-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pv__spinner-ring {
    animation-duration: 2.4s;
  }
}

.pv__note {
  flex-shrink: 0;
  padding: var(--s-2) var(--s-4);
  border-top: 1px solid var(--separator);
  background: var(--bg-raised);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
}

@media (max-width: 640px) {
  .pv {
    padding: 0;
  }

  .pv__panel {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .pv__host {
    display: none;
  }

  /* 手机上给关闭键更大的点按区域 */
  .pv__actions .icon-btn {
    width: 44px;
    height: 44px;
  }
}

/* 卡片上的「预览」入口 */
.pv-trigger {
  gap: 6px;
}

.pv-trigger svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  flex-shrink: 0;
}

/* ==========================================================================
   收藏星标
   --------------------------------------------------------------------------
   原来星标直接复用 .share-btn：32px、无描边、颜色和正文一个灰，
   选中只把描边变橙 —— 在卡片角落里几乎看不见，用户反馈「不够醒目」。
   这里给它独立的、明显是个按钮的样子：更大、有描边、有底色，
   选中时整颗星填实并染成橙色。
   ========================================================================== */
.pin-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}

.pin-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  transition: fill var(--dur-fast);
}

.pin-btn:hover {
  background: var(--material-active);
  border-color: var(--separator-strong);
  color: var(--text-primary);
}

.pin-btn:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
}

/* 选中：填实 + 橙色 + 同色描边和浅底，一眼能看出「已收藏」 */
.pin-btn.is-pinned {
  color: var(--orange);
  border-color: var(--orange);
  background: var(--orange-soft);
}

.pin-btn.is-pinned svg {
  fill: currentColor;
}

/* 「只看收藏」筛选 chip：图标 + 文字，激活时和星标一样变橙 */
.chip--pin {
  gap: 6px;
  padding-inline: 10px;
}

.chip--pin svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.chip--pin.is-active {
  color: var(--orange);
  border-color: var(--orange);
  background: var(--orange-soft);
}

.chip--pin.is-active svg {
  fill: currentColor;
}

/* 工具箱里一行一个的紧凑列表，按钮小一号但保持描边 */
.pin-btn--sm {
  width: 32px;
  height: 32px;
  margin-left: 0;
}

.pin-btn--sm svg {
  width: 16px;
  height: 16px;
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-6);
}

.post-nav__item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  border: 0;
  background: var(--bg-inset);
  color: var(--text-primary);
  transition: background var(--dur-fast);
}

.post-nav__item:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.post-nav__item--next {
  text-align: right;
}

.post-nav__label {
  font-size: var(--fs-11);
  color: var(--text-tertiary);
}

.post-nav__title {
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.4;
}

.post-footer {
  margin-top: var(--s-6);
}

/* 评论 */
.comments {
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--separator);
}

.comments__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-17);
  font-weight: 600;
  margin-bottom: var(--s-4);
}

/* 这个 svg 只有 viewBox、没有 width/height，全局 reset 又只给了
   max-width:100%（故意没给 height:auto，见 reset 里的说明），
   所以必须在这里显式定尺寸，否则它会撑满整个容器宽度变成 860×860。 */
.comments__title svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

/* /about/ 的评论区（about.html 里的 .about-comments）。
   它排在 .about-layout 两栏块之后，默认会撑满 wrap 整宽，看起来像挂在
   页面外面的第 3 栏，所以必须收窄。

   宽度不写死 860px，而是按网格算式反推：总宽 − 侧栏 260px − 栏间距。
   写死数字在别的 wrap 宽度下会错位；反推出来的值让评论区的左右边缘
   和上面正文栏完全对齐（1440px 下两者右边缘相差 0px）。 */
.about-comments {
  max-width: calc(100% - 260px - var(--s-10));
  margin-top: clamp(var(--s-10), 6vw, var(--s-12));
}

/* 标题沿用 .sec-head__title 的「栏目头」写法：衬线 + 一条 40px 短横线。
   全站的区块标题因此是同一个声音，而不是这里冒出一个 17px 无衬线标题。 */
.about-comments__title {
  position: relative;
  display: inline-block;
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  padding-bottom: var(--s-3);
}

.about-comments__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

/* 注意 token 名：本设计系统里没有 --fs-14 也没有 --text-2，
   写了会静默失效（var() 取不到值时该属性等于 unset，于是字号退回继承
   来的 16px、颜色退回默认色），看起来「像生效了」其实没生效。
   小字用 --fs-13，次级文字色用 --text-secondary。 */
.about-comments__desc {
  margin-top: var(--s-3);
  color: var(--text-secondary);
  font-size: var(--fs-15);
  line-height: 1.7;
  max-width: 60ch;
  margin-bottom: var(--s-6);
}

/* 标题和说明已经把间距撑开了，评论块自己那份上边距和分隔线
   在这里是多余的，留着会变成「标题底下一条横线」。 */
.about-comments .comments {
  margin-top: var(--s-5);
  padding-top: 0;
  border-top: 0;
}

/* 关掉内层 giscus 自带的标题（「评论与讨论」）。
   about.html 已经在外面写了「留言」+ 一句说明，内层再来一个标题，
   读者会看到上下两行标题各说一遍同一件事。

   只在 .about-comments 作用域内关：文章页也 include 了同一个
   giscus.html，那里「评论与讨论」是唯一的标题，必须留着。 */
.about-comments .comments__title {
  display: none;
}

/* 时间线 */
.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  position: relative;
  padding-left: var(--s-5);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--separator);
}

.tl-item {
  position: relative;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--s-5) + 1px);
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 2px solid var(--text-quaternary);
}

.tl-item__date {
  font-size: var(--fs-11);
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.tl-item__title {
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 3px;
}

.tl-item__title a {
  color: var(--text-primary);
}

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

.tl-item__body {
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ==========================================================================
   16. 页脚
   ========================================================================== */
.footer {
  margin-top: var(--s-8);
  padding-block: var(--s-6) var(--s-5);
  border-top: 1px solid var(--separator);
  background: var(--bg-inset);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--s-6);
  margin-bottom: var(--s-5);
}

.footer__brand {
  font-size: var(--fs-15);
  font-weight: 600;
  margin-bottom: var(--s-2);
}

.footer__desc {
  color: var(--text-tertiary);
  font-size: var(--fs-13);
  line-height: 1.6;
  max-width: 34ch;
}

.footer__socials {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.footer__col-title {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--s-3);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--text-secondary);
  font-size: var(--fs-12);
}

.footer__link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-quaternary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.footer__link:hover svg {
  color: var(--text-tertiary);
}

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

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-5);
  border-top: 1px solid var(--separator);
  /* 页脚底坐在 --bg-inset 上，比卡片底更暗，quaternary 在这里不够。
     用 tertiary 保证两种主题下都过 4.5:1。 */
  color: var(--text-tertiary);
  font-size: var(--fs-12);
}

/* 回到顶部 */
.to-top {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  z-index: var(--z-sticky);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-full);
  border: 1px solid var(--separator-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur), visibility var(--dur), color var(--dur-fast);
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

.to-top:hover {
  color: var(--text-primary);
}

.to-top svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

/* 阅读进度条：细、贴在顶栏下沿 */
.scroll-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: var(--z-sticky);
}

/* ==========================================================================
   17. 动效：只保留必要的淡入，不做过场动画
   ========================================================================== */
[data-reveal] {
  opacity: 1;
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   18. 响应式
   ========================================================================== */
@media (max-width: 1024px) {
  .post-layout,
  .about-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-6);
  }

  /* 单栏之后没有侧栏可避让，评论区放满整宽 */
  .about-comments {
    max-width: none;
  }

  .toc-col {
    display: none;
  }

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

  .nav a {
    padding-inline: 7px;
  }
}

@media (max-width: 860px) {
  .nav {
    display: none;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .topbar__actions {
    margin-left: auto;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --fs-34: 26px;
    --fs-28: 22px;
    --fs-24: 20px;
  }

  /*
   * .sec-head 在桌面端是「标题 + 右侧说明」的 flex 行，标题还带
   * flex-shrink:0。窄屏上两者并排会把容器顶出视口（实测 360px 下
   * 溢出 59px），所以这里改成上下堆叠并让说明正常换行。
   */
  .sec-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .sec-head__desc {
    text-align: left;
    white-space: normal;
    flex: none;
    width: 100%;
  }

  /* 板块索引在窄屏的排版。
     这一行有四个元素：序号 + （名称 / 数量 / 说明）+ 缩略图 + 箭头。
     360–390px 下塞不进四列，取舍是：
       · 缩略图直接收掉 —— 它只是色标，而名称和说明才是内容；
         硬留下 88px 会把「长文与折腾记录：OCR、输入法、文档工具、
         硬件选购」挤成四行碎句。
       · 序号缩窄到 1.6em（01–08 两位数字够用），省下的宽度全给文字。
       · 名称与数量不再并排：中文名称 + 数量在窄屏并排时，
         数量会被挤到自己换行，看起来像掉出来的孤立小字。 */
  .module {
    gap: var(--s-3);
    padding: var(--s-4) var(--s-2);
  }

  .module__num {
    width: 1.6em;
  }

  .module__thumb {
    display: none;
  }

  /* 行尾箭头也收掉：窄屏没有 hover，这个箭头永远不会出现，
     留着只会白占 16px + gap 的宽度。 */
  .module::after {
    display: none;
  }

  .module__head {
    gap: var(--s-2);
  }

  .post-row__meta .tag {
    display: none;
  }

  .wrap,
  .wrap-narrow {
    padding-inline: var(--s-4);
  }

  .section {
    padding-block: var(--s-6);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-row__meta .tag {
    display: none;
  }


  .post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__meta {
    gap: var(--s-6);
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }

  /* 触屏热区：桌面上的 26–30px 控件在手机上点不准，
     统一放大到接近 Apple 建议的 44px（视觉尺寸不变，靠内边距撑开）。 */
  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .brand {
    min-height: 44px;
  }

  .btn {
    height: 44px;
  }

  .btn--sm {
    height: 38px;
    padding-inline: 13px;
    font-size: var(--fs-13);
  }

  .link-arrow {
    min-height: 38px;
    font-size: var(--fs-13);
  }

  .chip {
    height: 36px;
    padding-inline: 13px;
  }

  .tag {
    height: 26px;
    padding-inline: 9px;
  }

  .tool-tile {
    min-height: 52px;
  }

  .footer__link {
    min-height: 44px;
  }

  .social-btn {
    width: 40px;
    height: 40px;
  }

  .share-btn {
    width: 40px;
    height: 40px;
  }

  .post-content {
    font-size: var(--fs-15);
  }

  .post-content h2 {
    font-size: var(--fs-20);
  }

  .post-content h3 {
    font-size: var(--fs-17);
  }

  .matrix {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ==========================================================================
   19. 无障碍与打印
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .topbar,
  .footer,
  .to-top,
  .comments,
  .share-row,
  .post-nav,
  .toc-col,
  .scroll-progress,
  .drawer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .post-content {
    max-width: none;
    font-size: 11pt;
  }
}
