/* ==========================================================================
   TechLog Pro — GEOcms 专业科技博客主题（独立主题）

   设计语言参考 Bootstrap：中性底色 + 主色强调、清晰边框、克制阴影。
   中文阅读优化：正文 17px+ / 1.8 行高 / ≈40 字每行。

   ① 设计令牌 → ② 基础 → ③ 布局 → ④ 区块（导航/Hero/列表/正文/评论/页脚）
   → ⑤ 响应式 → ⑥ 打印。

   暗色实现：颜色令牌一律 light-dark() 单份声明（依赖 color-scheme），
   不再为 [data-theme=dark] 与 prefers-color-scheme 各抄一份（旧版两份会漂移）。
   不支持 light-dark() 的浏览器丢弃第二条声明，回落到亮色值。
   强调色五档同理：一个 [data-accent] 块同时给出亮/暗两值。
   ========================================================================== */

/* ---------- ① 设计令牌 ---------- */
:root {
  color-scheme: light dark;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Source Han Sans SC",
               "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Cascadia Code", Menlo,
               Consolas, "Courier New", monospace;

  /* 中性色：白画布 + 导航/页脚灰带（--band），靠底色与边框分层 */
  --bg: #ffffff;                                   --bg: light-dark(#ffffff, #16191d);
  --bg-soft: #eef1f5;                              --bg-soft: light-dark(#eef1f5, #1b2026);
  --band: #edf0f4;                                 --band: light-dark(#edf0f4, #1c2129);
  --surface: #ffffff;                              --surface: light-dark(#ffffff, #1d232a);
  --surface-2: #f6f8fa;                            --surface-2: light-dark(#f6f8fa, #21272f);
  --text: #1b1f24;                                 --text: light-dark(#1b1f24, #e9ecef);
  --text-2: #495057;                               --text-2: light-dark(#495057, #c2c8cf);
  --muted: #5f6878;                                --muted: light-dark(#5f6878, #99a0a8);
  --border: #dfe4ea;                               --border: light-dark(#dfe4ea, #2b323a);
  --border-strong: #ced4da;                        --border-strong: light-dark(#ced4da, #3a434d);

  /* 强调（科技蓝，可被 data-accent 覆盖） */
  --accent: #0d6efd;                               --accent: light-dark(#0d6efd, #4c8dff);
  --accent-ink: #0a58ca;                           --accent-ink: light-dark(#0a58ca, #8ab9ff);
  --accent-soft: #e7f1ff;                          --accent-soft: light-dark(#e7f1ff, #17273f);
  /* 暗色下强调色会变亮（#4c8dff），白字对比只剩 3.16:1（不达 AA）：
     实色按钮/徽章的字色改用深墨，与 ink-v3 同口径。 */
  --on-accent: #ffffff;                            --on-accent: light-dark(#ffffff, #08243f);

  /* 状态 */
  --ok-bg: #d1e7dd;   --ok-bg: light-dark(#d1e7dd, #12291d);
  --ok-fg: #0f5132;   --ok-fg: light-dark(#0f5132, #67c98d);
  --ok-bd: #a3cfbb;   --ok-bd: light-dark(#a3cfbb, #235c33);
  --err-bg: #f8d7da;  --err-bg: light-dark(#f8d7da, #2c1417);
  --err-fg: #b02a37;  --err-fg: light-dark(#b02a37, #f28b82);
  --err-bd: #f1aeb5;  --err-bd: light-dark(#f1aeb5, #5c2a2e);
  --warn-fg: #664d03; --warn-fg: light-dark(#664d03, #d9b45c);
  /* --warn-bg / --warn-bd 已删除：techlog 全文件零引用（后台 style.css 有自己的一套，
     互不影响）。留着只会让人误以为前台有黄色提示态。 */

  /* 语法 token */
  --tok-kw: #0b5ed7;  --tok-kw: light-dark(#0b5ed7, #79a8ff);
  --tok-str: #b02a37; --tok-str: light-dark(#b02a37, #ff8f8f);
  --tok-com: #6c757d; --tok-com: light-dark(#6c757d, #99a0a8);
  --tok-num: #b45309; --tok-num: light-dark(#b45309, #e0a458);
  --tok-fn: #6610f2;  --tok-fn: light-dark(#6610f2, #c3a6ff);
  --tok-tag: #0f766e; --tok-tag: light-dark(#0f766e, #4dd0c2);
  --code-bg: #f1f4f8; --code-bg: light-dark(#f1f4f8, #1b2026);

  /* 阴影 / 圆角 / 间距 */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-sm: light-dark(0 1px 2px rgba(16, 24, 40, .06), 0 1px 2px rgba(0, 0, 0, .35));
  --shadow-pop: 0 10px 28px rgba(16, 24, 40, .12);
  --shadow-pop: light-dark(0 10px 28px rgba(16, 24, 40, .12), 0 10px 28px rgba(0, 0, 0, .5));
  --radius-xs: 6px; --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* 字号 11 级（标题流体）。⚠ 不设同值双令牌（--fs-2xs 与 --fs-xs 曾同为 .8125rem）：
     改一个忘另一个必漂移 */
  --fs-xs: .8125rem; --fs-sm: .875rem;
  --fs-md: 1rem; --fs-lg: 1.0625rem;
  --fs-h4: clamp(1rem, .97rem + .16vw, 1.125rem);
  --fs-h3: clamp(1.125rem, 1.08rem + .26vw, 1.25rem);
  --fs-h2: clamp(1.25rem, 1.17rem + .42vw, 1.5rem);
  --fs-h1: clamp(1.625rem, 1.42rem + 1vw, 2.125rem);
  --fs-hero: clamp(2rem, 1.5rem + 2.6vw, 3.25rem);
  --lh-tight: 1.3; --lh-body: 1.8;
  /* label 与 xs 同值但语义独立（标签文字 vs 辅助小字）：引用而非复写，改一处不漂移 */
  --fs-label: var(--fs-xs); --ls-label: .08em;

  /* 布局 */
  --wrap-wide: 1200px;
  --gutter: 24px;
  --side-w: 300px; --side-w-art: 288px;
  --gap-col: 44px; --gap-col-art: 48px;
  --measure-list: 780px; --measure-prose: 700px;
  --prose-fs: clamp(1.0625rem, 1rem + .22vw, 1.125rem);
  --prose-lh: 1.8;
  --head-h: 68px;
  --anchor-offset: calc(var(--head-h) + 16px);
  --hero-glow: color-mix(in srgb, var(--accent) 16%, transparent);

  /* 动效 */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .18s;
}

/* 手动切换优先于系统偏好 */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

/* ---------- 强调色五档（亮/暗一次给全） ----------
   --on-accent 逐档给实色按钮的字色：亮色档一律白字，故强调色本身必须
   与白字达到 AA 4.5:1（violet/teal/green 的原始亮色档仅 3.3–4.0:1，已加深至
   同色系 -600/-700；indigo 暗色档原 #6d67f0 白字仅 4.33:1，同样不足，
   已与亮色档统一为 #4f46e5 —— 白字 6.3:1）。 */
html[data-accent="indigo"] {
  --accent: #4f46e5; --accent: light-dark(#4f46e5, #4f46e5);
  --accent-ink: #4338ca; --accent-ink: light-dark(#4338ca, #a5b4fc);
  --accent-soft: #eef2ff; --accent-soft: light-dark(#eef2ff, #20214a);
  --on-accent: #ffffff; --on-accent: light-dark(#ffffff, #ffffff);
}
html[data-accent="violet"] {
  /* #a855f7 白字仅 4.0:1；#9333ea 白字 5.4:1 */
  --accent: #9333ea; --accent: light-dark(#9333ea, #b875f9);
  --accent-ink: #9333ea; --accent-ink: light-dark(#9333ea, #d8b4fe);
  --accent-soft: #faf5ff; --accent-soft: light-dark(#faf5ff, #291c40);
  --on-accent: #ffffff; --on-accent: light-dark(#ffffff, #2b1b45);
}
html[data-accent="teal"] {
  /* #0d9488 白字仅 3.7:1；#0f766e 白字 5.5:1 */
  --accent: #0f766e; --accent: light-dark(#0f766e, #2dd4bf);
  --accent-ink: #0f766e; --accent-ink: light-dark(#0f766e, #5eead4);
  --accent-soft: #f0fdfa; --accent-soft: light-dark(#f0fdfa, #0e2f2b);
  --on-accent: #ffffff; --on-accent: light-dark(#ffffff, #042f2b);
}
html[data-accent="green"] {
  /* #16a34a 白字仅 3.3:1；#15803d 白字 5.0:1 */
  --accent: #15803d; --accent: light-dark(#15803d, #3fbf68);
  --accent-ink: #15803d; --accent-ink: light-dark(#15803d, #86efac);
  --accent-soft: #f0fdf4; --accent-soft: light-dark(#f0fdf4, #12291b);
  --on-accent: #ffffff; --on-accent: light-dark(#ffffff, #052e16);
}

/* ---------- ② 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  letter-spacing: .01em;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-tight); letter-spacing: -.012em; font-weight: 700;
  text-wrap: balance; margin: 0 0 .5em;
}
h1 { font-size: var(--fs-h1); } h2 { font-size: var(--fs-h2); } h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 18px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

/* ---------- ③ 布局 ---------- */
.wrap { max-width: var(--wrap-wide); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 560px; margin: 0 auto; padding: 0 var(--gutter); }
.list-main, .single-main { min-width: 0; }
.list-layout.is-solo .list-main { max-width: var(--measure-list); margin: 0 auto; }
.single-layout.is-solo .single-main { max-width: var(--measure-prose); margin: 0 auto; }

.list-layout, .single-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w);
  gap: var(--gap-col); align-items: start;
}
.single-layout { grid-template-columns: minmax(0, 1fr) var(--side-w-art); gap: var(--gap-col-art); }
.list-layout.is-solo, .single-layout.is-solo { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.list-layout.is-solo > *, .single-layout.is-solo > * { width: 100%; }
/* 主列左右竖线 + 侧栏右线：[线]主列[线]侧栏[线] 的三栏框 */
.list-layout:not(.is-solo) .list-main {
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  margin-left: calc(var(--gap-col) / -2 + 1px); margin-right: calc(var(--gap-col) / -2 + 1px);
  padding-left: calc(var(--gap-col) / 2 - 1px); padding-right: calc(var(--gap-col) / 2 - 1px);
}
.single-layout:not(.is-solo) .single-main {
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  margin-left: calc(var(--gap-col-art) / -2 + 1px); margin-right: calc(var(--gap-col-art) / -2 + 1px);
  padding-left: calc(var(--gap-col-art) / 2 - 1px); padding-right: calc(var(--gap-col-art) / 2 - 1px);
}
/* 侧栏线用容器伪元素：.site-side 是 sticky + 限高，自身边框只会画到视口高度 */
.list-layout:not(.is-solo), .single-layout:not(.is-solo) { position: relative; }
.list-layout:not(.is-solo)::after,
.single-layout:not(.is-solo)::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--border); pointer-events: none;
}
.list-layout:not(.is-solo)::after { right: calc(var(--gap-col) / -2 + 1px); }
.single-layout:not(.is-solo)::after { right: calc(var(--gap-col-art) / -2 + 1px); }

/* ⚠ 不再给主内容容器做 opacity 入场动画：首屏 LCP 元素（标题 / 首图 / 正文首屏）
   在动画期间透明度不足，LCP 计时被推迟到动画结束（380ms 白丢）。
   动效只允许落在非首屏装饰元素上，且不得改变其可见性起点（纯 transform）。 */
.site-main { min-height: 55vh; padding: 0 0 var(--sp-7); }

/* 按设备可见性（::: hide-* / only-* 容器）。
   ⚠ 断点必须与导航抽屉同源（900px）：761–900px 区间界面已是汉堡抽屉形态，
      「移动专属」内容若还按 760px 判定会照常显示，与「见抽屉即移动端」的认知矛盾。
      下方 ⑤ 响应式里另有一个 760px 纯样式块（--head-h/hero/表单字号），与本题无关。 */
.only-mobile { display: none !important; }
/* 见 ink-v3 同名规则：桌面限定块在移动端必须隐藏 */
.only-desktop { display: none !important; }
@media (max-width: 900px) {
  .hide-mobile { display: none !important; }
  .only-mobile { display: revert !important; }
  .hide-desktop { display: revert !important; }
}
@media (min-width: 901px) {
  .hide-desktop { display: none !important; }
  .only-desktop { display: revert !important; }
}

/* ---------- ④-1 导航 ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50; height: var(--head-h);
  background: color-mix(in srgb, var(--band) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-strong);
}
.head-inner {
  max-width: var(--wrap-wide); margin: 0 auto; padding: 0 var(--gutter);
  height: 100%; display: flex; align-items: center; gap: var(--sp-3);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  color: var(--on-accent); font-weight: 800; font-size: 1rem; line-height: 1; letter-spacing: 0;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: row; align-items: baseline; gap: var(--sp-2); min-width: 0; line-height: 1.25; }
.brand-title { font-weight: 750; font-size: var(--fs-h3); letter-spacing: -.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-slogan {
  font-size: var(--fs-xs); color: var(--muted); white-space: nowrap;
  /* 长口号（后台可填任意长度）在 >1120px 仍会顶开导航：brand/brand-text 虽有
     min-width:0，但口号自身 nowrap 且不可收缩 ⇒ 吃掉全部余量后把 .site-nav
     推出视口（横向滚动 + 裁下拉菜单）。给它同样的省略号截断，与标题同构。 */
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
/* 901–1120 区间收起品牌口号：让出的宽度足够导航自然排布，避免进入「横向滚动」状态
   （滚动状态会裁剪下拉子菜单，见 .nav-list.can-scroll 注释） */
@media (min-width: 901px) and (max-width: 1120px) {
  .brand-slogan { display: none; }
}
/* 导航在更宽的视口也放不下时（后台加了导航项），由 theme.js 实测后加类，同样收起口号；
   这是 .can-scroll 之前的第一档降级——开横向滚动会连带裁掉下拉子菜单。 */
html.nav-tight .brand-slogan { display: none; }

.site-nav { margin-left: auto; min-width: 0; }
.nav-list { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; flex-wrap: nowrap; }
/* ⚠ 宽屏放不下时的降级顺序（theme.js 逐档实测后加类，实测前一律先摘类再量）：
   ① nav-tight 收起品牌口号 → ② 无下拉子菜单的导航开 .can-scroll 内部横向滚动
   → ③ 有下拉子菜单的导航切汉堡抽屉（html.nav-drawer）。
   ⚠ 绝不接受「让 sticky 头部撑宽」：那会产生 body 级横向滚动（整页跟着左右晃）。
   can-scroll 只对「没有下拉子菜单」的导航开放：overflow-x 非 visible 时 overflow-y 的
   计算值也变成 auto（规范如此，写 visible 无效），绝对定位的下拉子菜单会被整块裁掉——
   看不见也 elementFromPoint 不到，等于整站二级菜单失效。
   子菜单也不能改用 position:fixed 逃逸：.site-head 有 backdrop-filter，会为 fixed
   后代创建包含块并照样裁剪。故第三档直接退化成抽屉形态（与 ≤900px 断点同构）。 */
@media (min-width: 901px) {
  .nav-list.can-scroll { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
  .nav-list.can-scroll::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; }
  /* 子菜单与触发项之间 8px 视觉间隙的悬停桥：鼠标穿过间隙时 hover 中断会收起菜单。
     挂在子菜单自身（上沿外扩 8px）而非父项上——菜单关闭时不占位、不截获点击。 */
  .nav-sub::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
  /* 第三档：汉堡抽屉（JS 复用 ≤900px 同一套 is-open / aria-expanded / 焦点束缚逻辑）。
     ⚠ 不套 geo-drop 动画：该 @keyframes 定义在 ≤900px 媒体块内，宽屏不匹配即失效。 */
  html.nav-drawer .nav-toggle { display: block; }
  html.nav-drawer .site-nav {
    display: none; position: absolute; top: var(--head-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    margin: 0; box-shadow: var(--shadow-pop);
    max-height: calc(100vh - var(--head-h));
    max-height: calc(100dvh - var(--head-h));
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  html.nav-drawer .site-nav.is-open { display: block; }
  html.nav-drawer .nav-list { flex-direction: column; align-items: stretch; padding: var(--sp-2); }
  html.nav-drawer .nav-item > a { display: block; border-radius: var(--radius-sm); }
  html.nav-drawer .nav-item.nav-search { margin-left: 0; }
  html.nav-drawer .nav-item.has-sub { flex-wrap: wrap; }
  html.nav-drawer .nav-item.has-sub > a { flex: 1 1 auto; min-width: 0; }
  html.nav-drawer .nav-sub {
    position: static; box-shadow: none; border: 0; background: none; display: none;
    padding-left: var(--sp-4); flex: 1 1 100%;
  }
  html.nav-drawer .nav-item.is-open .nav-sub { display: block; }
}
.nav-item { position: relative; }
.nav-item > a {
  display: inline-block; padding: 8px 14px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item > a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-item > a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
/* 会员中心：全站唯一收费点的常驻入口（v3.13.0），v3.15.0 升级为 ghost 描边胶囊 ——
   与普通导航文字、搜索实底胶囊形成三个视觉层级；图标沿用线性人形，不另引资源 */
.nav-item.nav-member > a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-ink); font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.nav-item.nav-member > a:hover { background: var(--accent-soft); text-decoration: none; }
/* 站内搜索：区别于普通导航文字——accent 描边胶囊 + 放大镜图标 */
.nav-item.nav-search { margin-left: var(--sp-2); }
.nav-item.nav-search > a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-ink); font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}
.nav-item.nav-search > a:hover {
  /* 暗色强调色变亮（#4c8dff），白字对比仅 3.16:1 不达 AA —— 与实色按钮同口径用 --on-accent */
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); text-decoration: none;
}
.nav-search-icon { flex: none; }
.nav-item.has-sub { display: flex; align-items: center; }
.sub-toggle {
  border: 0; background: none; color: var(--muted); padding: 6px; margin-left: -6px;
  cursor: pointer; display: inline-flex; transition: transform var(--dur) var(--ease);
}
.nav-item.is-open .sub-toggle { transform: rotate(180deg); }
.nav-sub {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); list-style: none; margin: 0; padding: 6px; z-index: 60;
}
.nav-item.is-open .nav-sub { display: block; }
/* 纯键盘用户：子菜单需支持 :focus-within 展开（原实现只有 JS 按钮态与 :hover）。
   ⚠ 必须限位「桌面 hover + 宽屏」：本条特异性 (0,4,0) 恒胜 .nav-item.is-open .nav-sub
   (0,3,0)，而点击展开后按钮仍持有焦点 —— 触屏与 ≤900px 抽屉里再点一次，is-open 已移除、
   focus-within 却继续命中 ⇒ 菜单收不回且 aria-expanded 撒谎。故 hover:none（触屏）
   与窄屏抽屉只信 is-open 单一真相，不进本条。 */
@media (hover: hover) and (min-width: 901px) {
  /* .is-closed：JS 在「主动收起」时打上，把 :focus-within 压下去 ——
     否则按钮仍持有焦点，键盘/鼠标点第二次收不回菜单，aria-expanded 还会撒谎。 */
  .nav-item.has-sub:focus-within:not(.is-closed) .nav-sub { display: block; }
}
.nav-sub a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--text-2); }
.nav-sub a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
@media (hover: hover) { .nav-item.has-sub:hover .nav-sub { display: block; } }

.theme-toggle {
  width: 36px; height: 36px; flex: none;
  /* ⚠ 默认隐藏，由 theme.js 初始化成功后给根元素加 .js 才显示：
     脚本缺失/加载失败时按钮点下去毫无反应（纯死控件），不如根本不出现。
     ⚠ 只在 JS 接管后显示，同时 aria-label/title 的修正脚本（header 内联）也已在位。 */
  display: none;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  border-radius: var(--radius-pill); cursor: pointer;
  align-items: center; justify-content: center;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
html.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun { display: block; }
}
.nav-toggle {
  display: none; position: relative; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--radius-sm); cursor: pointer; margin-left: auto;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  position: absolute; left: 9px; width: 18px; height: 2px; border-radius: 2px;
  background: var(--text-2); transition: transform .2s var(--ease);
}
.nav-toggle-bar { top: 17px; }
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; left: 0; }
.nav-toggle-bar::before { top: -6px; } .nav-toggle-bar::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(-90deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { opacity: 0; }

/* ---------- ④-2 Centered Hero ---------- */
.hero-center { position: relative; border-bottom: 1px solid var(--border); text-align: center; overflow: hidden; }
.hero-center-inner { position: relative; z-index: 1; padding: clamp(48px, 7vw, 84px) var(--gutter) clamp(44px, 6vw, 68px); max-width: 880px; margin: 0 auto; }
.hero-display {
  overflow-wrap: anywhere;
  font-size: var(--fs-hero); font-weight: 800; letter-spacing: -.022em;
  line-height: 1.14; margin: 0 0 var(--sp-4); text-wrap: balance;
}
.hero-lead {
  overflow-wrap: anywhere;
  color: var(--text-2); font-size: var(--fs-lg); line-height: 1.75;
  max-width: 42em; margin: 0 auto var(--sp-5); text-wrap: pretty;
}
.hero-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* 风格：渐变（默认）——主色辉光 + 网格点阵 */
.hero-center.is-gradient { background: var(--bg-soft); }
.hero-center.is-gradient::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(620px 340px at 50% -10%, var(--hero-glow), transparent 70%),
    radial-gradient(420px 240px at 85% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
}
.hero-center.is-gradient::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 26%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .5), transparent 72%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .5), transparent 72%);
}
/* 风格：背景图 —— 深色纵深蒙版 + 白字，任意照片都压得住。
   图由 <img class="hero-bg"> 承载（可爬 + 有 alt），不再用内联 background-image */
.hero-center.is-image:not(.has-bg) { background: var(--surface); }
.hero-center.is-image.has-bg { background-color: #0c1322; }
.hero-center.is-image .hero-bg {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: center;
}
.hero-center.is-image.has-bg::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  /* ⚠ 文字区最低遮罩 60%：原先顶部只有 40%，纯白照片上白字对比度约 2.85:1（不达 AA）。
     60% 时最坏情况（纯白底）白字仍有 ≈5.1:1，且不再依赖图片本身的明暗。 */
  background: linear-gradient(180deg, rgba(8, 12, 24, .60) 0%, rgba(8, 12, 24, .70) 52%, rgba(8, 12, 24, .85) 100%);
}
.hero-center.is-image.has-bg .hero-center-inner { padding: clamp(72px, 11vw, 112px) var(--gutter) clamp(64px, 10vw, 100px); }
.hero-center.is-image.has-bg .hero-display { color: #fff; text-shadow: 0 2px 24px rgba(0, 0, 0, .45); }
.hero-center.is-image.has-bg .hero-lead { color: rgba(255, 255, 255, .88); }
.hero-center.is-image.has-bg .btn-outline {
  color: #fff; border-color: rgba(255, 255, 255, .62); background: rgba(255, 255, 255, .10);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hero-center.is-image.has-bg .btn-outline:hover { background: #fff; border-color: #fff; color: #10182a; }
.hero-center.is-image.has-bg .btn-primary { box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 42%, transparent); }
/* 风格：纯色极简 */
.hero-center.is-plain { background: var(--surface); }

/* ---------- ④-3 按钮 / 徽标 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 550; line-height: 1.5;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); color: var(--accent-ink); }
.btn-outline:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-ink); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-lg { padding: 12px 28px; font-size: var(--fs-md); border-radius: 10px; }
.btn-sm { padding: 5px 13px; font-size: var(--fs-xs); }
/* v3.8.0：链接型按钮常态给 24×24 最小命中区（WCAG 2.5.8），不再只靠粗指针媒体查询 */
.link-btn { border: 0; background: none; color: var(--accent-ink); cursor: pointer; padding: 2px 4px; min-height: 24px; font-size: inherit; }
/* 移动抽屉打开时锁背景滚动（theme.js setNav 切换 nav-open） */
body.nav-open { overflow: hidden; }
.link-btn:hover { text-decoration: underline; }

.chip {
  display: inline-block; font-size: var(--fs-xs); font-weight: 500; line-height: 1.6;
  padding: 2px 11px; border-radius: var(--radius-pill);
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
a.chip:hover { text-decoration: none; color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.chip-cat { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.side-chips-sub { margin-top: 6px; padding-left: 10px; border-left: 1px solid var(--border); gap: 4px; }
.chip-sub { font-size: var(--fs-xs); }
.chip-tag { background: var(--bg-soft); }
.chip-count { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; font-variant-numeric: tabular-nums; }

/* ---------- ④-4 列表 ---------- */
.section-label { font-size: var(--fs-h3); font-weight: 700; margin: var(--sp-6) 0 var(--sp-5); }
/* 功能性窄页（搜索/联系/口令/读者/404）的页级 h1：与 single-title 同一字号带。
   ⚍ 原先用 .section-label（h3 级）当页面唯一 h1，与归档页的 .archive-title（h1 级）
   差两档层级，跨页浏览时主标题权重跳跃；section-label 保留给页内区块标题。 */
.page-title { overflow-wrap: anywhere; font-size: clamp(1.375rem, 1.2rem + 1.05vw, 1.875rem); line-height: 1.3; letter-spacing: -.02em; font-weight: 800; margin: 0 0 var(--sp-4); }
.list-head {
  display: flex; align-items: baseline; gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-1); padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.list-title { font-size: var(--fs-h3); font-weight: 750; margin: 0; letter-spacing: -.012em; }
.list-count { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

/* 文章行：不画卡片边框，相邻文章用分割线区隔（末行不画尾线） */
.post-row {
  position: relative; padding: var(--sp-5) 2px;
  border-bottom: 1px solid var(--border);
}
.post-row:last-of-type { border-bottom: 0; }
.post-row::before {
  content: ""; position: absolute; left: -14px; top: var(--sp-5); bottom: var(--sp-5);
  width: 3px; border-radius: 2px; background: var(--accent);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.post-row-title { font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem); font-weight: 700; line-height: 1.4; margin: 0 0 7px; letter-spacing: -.008em; overflow-wrap: anywhere; }
.post-row-title a { color: var(--text); }
.post-row-title a:hover { color: var(--accent-ink); text-decoration: none; }
/* 基础排版（display/flex-wrap/align-items/gap/color/font-size）与 .card-meta 逐字相同，
   统一收在文末 .card-meta, .post-row-meta 合并块里，这里只留本选择器特有的间距。 */
.post-row-meta { margin-bottom: var(--sp-2); }
.card-meta time, .post-row-meta time { font-variant-numeric: tabular-nums; }
.post-row-meta .dot { opacity: .5; }
.post-row-excerpt {
  color: var(--text-2); font-size: var(--fs-sm); line-height: 1.75; /* 与页脚/卡片导语统一：原 1.78 是孤立值，同字号下肉眼几乎无差 */ margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: pretty;
}
@media (hover: hover) {
  .post-row { transition: background-color var(--dur) var(--ease); }
  .post-row:hover { background: color-mix(in srgb, var(--bg-soft) 55%, transparent); }
  .post-row:hover::before { opacity: 1; }
}

/* 卡片（归档/搜索复用的旧形态，保留兼容） */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: var(--sp-4); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-pop); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateY(-2px); }
}
.card-body { padding: var(--sp-5) 26px; }
.card-title { font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem); font-weight: 700; line-height: 1.4; margin: 0 0 var(--sp-2); overflow-wrap: anywhere; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent-ink); text-decoration: none; }
/* 同 .post-row-meta：基础排版见文末合并块，这里只留特有的间距。 */
.card-meta { margin-bottom: var(--sp-2); }
.card-excerpt {
  color: var(--text-2); font-size: var(--fs-sm); line-height: 1.75; /* 与页脚/卡片导语统一：原 1.78 是孤立值，同字号下肉眼几乎无差 */ margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.empty-state {
  text-align: center; color: var(--muted); padding: var(--sp-8) var(--sp-4);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2);
}
.empty-icon { display: block; font-size: 1.5rem; line-height: 1; opacity: .55; margin-bottom: var(--sp-3); }
.empty-state p { margin: 0; }
/* 空态的第二槽位（外链 / 附加操作）：与正文 <p> 并列，不再塞进 <p> 里靠解析器隐式闭合 */
.empty-extra { margin-top: var(--sp-3); }
/* 加载态：异步区块（评论表单/验证码刷新）统一用骨架占位，避免操作无反馈 */
.is-loading { position: relative; pointer-events: none; opacity: .6; }
.is-loading::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  animation: geo-shimmer 1.2s linear infinite;
}
@keyframes geo-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
/* 归档/搜索/作者页复用：与首页 .post-row 同款扁平分割行 */
.post-card.is-compact { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; margin-bottom: 0; }
.post-card.is-compact .card-body { padding: var(--sp-5) 2px; }
.post-card.is-compact .card-title { font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem); }
.post-card.is-compact .card-excerpt { -webkit-line-clamp: 2; }
@media (hover: hover) {
  .post-card.is-compact { transition: background-color var(--dur) var(--ease); }
  .post-card.is-compact:hover { background: color-mix(in srgb, var(--bg-soft) 55%, transparent); box-shadow: none; transform: none; }
}

/* ---------- ④-5 阅读辅助 ---------- */
.reading-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-ink));
  pointer-events: none; transition: width .08s linear;
}
.to-top {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5);
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-pop); opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
              visibility var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  z-index: 45;
}
.to-top.is-on { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--accent-ink); border-color: var(--accent); }
.side-contact {
  position: fixed; right: var(--sp-5); bottom: calc(var(--sp-5) + 52px);
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-pop); z-index: 45;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.side-contact:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---------- ④-6 侧栏 ---------- */
.site-side {
  position: sticky; top: calc(var(--head-h) + 16px);
  max-height: calc(100vh - var(--head-h) - 32px); overflow-y: auto;
  scrollbar-width: thin; overscroll-behavior: contain;
}
/* 列表页：侧栏顶部下移，与主列 .list-head 对齐 */
.list-layout .site-side { margin-top: var(--sp-6); }
.side-box { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
.side-box + .side-box { border-top: 1px solid var(--border); margin-top: var(--sp-4); padding-top: var(--sp-4); }
.side-title {
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: .02em; color: var(--text);
  margin: 0 0 var(--sp-3); padding-left: 10px; border-left: 3px solid var(--accent); line-height: 1.35;
}
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex; gap: var(--sp-2); align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm);
}
.side-list li:last-child { border-bottom: 0; }
/* min-width:0 + 省略号：长标题在 300px 侧栏里不再把 .side-meta 挤出去或撑破容器 */
.side-list li a { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list li a:hover { color: var(--accent-ink); text-decoration: none; }
.side-rank {
  flex: none; width: 20px; height: 20px; border-radius: var(--radius-xs);
  background: var(--bg-soft); color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.side-rank.is-top { background: var(--accent); color: var(--on-accent); }
.side-meta { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); flex: none; }
.side-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.side-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- ④-7 单篇 ---------- */
.breadcrumb { font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-5) 0 var(--sp-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent-ink); }
.breadcrumb-sep { opacity: .55; }
.single-head { margin-bottom: var(--sp-5); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.single-title { overflow-wrap: anywhere; font-size: clamp(1.375rem, 1.2rem + 1.05vw, 1.875rem); line-height: 1.3; letter-spacing: -.02em; font-weight: 800; }
.single-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; font-size: var(--fs-xs); color: var(--muted); }
.single-meta time { font-variant-numeric: tabular-nums; }
.single-updated { color: var(--warn-fg); }
.single-author { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 550; }
.single-author::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.single-author:hover { color: var(--accent-ink); }
.single-tags { margin-top: var(--sp-3); display: flex; flex-wrap: wrap; gap: 6px; }
.single-cover { margin: 0 0 var(--sp-5); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); }
.single-cover .cover-img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; }

.keypoints {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--radius); padding: var(--sp-4) 22px; margin: 0 0 var(--sp-5);
}
.keypoints h2 { font-size: var(--fs-sm); color: var(--accent-ink); margin: 0 0 var(--sp-2); letter-spacing: .02em; }
.keypoints ul { margin: 0; padding-left: 1.2em; }
.keypoints li { font-size: var(--fs-sm); margin: 4px 0; text-wrap: pretty; }

/* TOC */
.toc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) 20px; margin: 0 0 var(--sp-5); font-size: var(--fs-sm); }
.toc-title { font-size: var(--fs-label); font-weight: 650; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--muted); margin: 0 0 var(--sp-2); }
.toc ol { margin: 0; padding-left: 0; list-style: none; }
.toc li { margin: 3px 0; }
.toc li > a { color: var(--text-2); }
.toc li > a.is-active { color: var(--accent-ink); font-weight: 600; }
.toc-sub { padding-left: 1.4em; font-size: var(--fs-xs); }
.side-box .toc { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
.side-box .toc ol { border-left: 2px solid var(--border); }
.side-box .toc li { margin: 0; }
.side-box .toc li > a {
  display: block; padding: 5px 0 5px 12px; margin-left: -2px;
  border-left: 2px solid transparent; color: var(--text-2); line-height: 1.5;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.side-box .toc li > a:hover { color: var(--text); }
.side-box .toc li > a.is-active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.toc-box:empty, .single-toc-slot:empty { display: none; }
/* JS 把目录搬到窄屏正文槽位后给空壳加 hidden：display:none 不能让 .side-box + .side-box
   相邻选择器失效（它按 DOM 相邻判定），必须显式摘掉残留的分割线/间距 */
.toc-box[hidden] + .side-box { border-top: 0; margin-top: 0; padding-top: 0; }

/* ---------- ④-8 正文 ----------
   中文可读性：17px+ / 1.8，单行 ≈40 字 */
/* overflow-wrap：长 URL / 无空格串不撑破正文栏（标题另用 anywhere，允许更激进的断行） */
.prose { font-size: var(--prose-fs); line-height: var(--prose-lh); color: var(--text); scroll-margin-top: var(--anchor-offset); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4, .prose h5 { scroll-margin-top: var(--anchor-offset); position: relative; }
.prose h2 { font-size: clamp(1.25rem, 1.15rem + .5vw, 1.5rem); font-weight: 700; margin: 2.2em 0 .7em; padding-bottom: .4em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem); font-weight: 650; margin: 1.9em 0 .55em; }
.prose h4 { font-size: var(--fs-lg); font-weight: 650; margin: 1.7em 0 .5em; color: var(--text-2); }
/* 标题锚点由 theme.js 插入，绝对定位到左外侧，不占行内空间 */
.heading-anchor {
  position: absolute; left: -.85em; top: 0;
  color: var(--muted); font-weight: 400; text-decoration: none;
  opacity: 0; transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
}
/* 无悬停设备（触屏）上 opacity:0 的元素照样命中测试：标题左侧那条 ≈10px 的窄带
   会吃掉点击/选区，用户感觉「这里有个看不见的东西」。桌面端的价值是悬停即现的
   快速取链，触屏没有悬停语义，直接整体撤掉，不给 invisible tap target。 */
@media (hover: none) {
  .heading-anchor { display: none; }
}
.prose h2:hover > .heading-anchor, .prose h3:hover > .heading-anchor, .prose h4:hover > .heading-anchor,
.heading-anchor:focus-visible { opacity: .75; }
.heading-anchor:hover { color: var(--accent-ink); opacity: 1; text-decoration: none; }
/* 复制反馈：与行内代码同一套 data-msg 机制（JS 复制后置入，1.4s 后移除） */
.heading-anchor::after { content: attr(data-msg); margin-left: 4px; font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; }
.heading-anchor.is-done { color: var(--ok-fg); } .heading-anchor.is-fail { color: var(--err-fg); }
.heading-anchor.is-done, .heading-anchor.is-fail { opacity: 1; }
.prose p { text-wrap: pretty; margin: 0 0 1.25em; }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.5em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; color: var(--text); }
.prose a {
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose blockquote {
  margin: 1.5em 0; padding: 12px 20px; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2);
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose figure { margin: 1.6em 0; }
.prose figcaption { margin-top: .5em; font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.prose .ta-c { text-align: center; } .prose .ta-r { text-align: right; } .prose .ta-l { text-align: left; }
/* ⚠ 不能给 table 加 display:block：WebKit 会因此丢掉 table 角色（WCAG 1.3.1）。
   横向滚动交外层容器承担，table 自身保持 display:table（语义与滚动两全）。 */
.prose table { width: max-content; min-width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: var(--fs-sm); }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; overflow-wrap: anywhere; }
/* 宽表横向滚动容器：由服务端 geocms_wrap_tables() 随正文一起渲染（无 JS 也生效），
   tabindex=0 使其可被键盘滚动（WCAG 2.1.1），自带 role=region + aria-label。 */
.table-scroll { overflow-x: auto; max-width: 100%; scrollbar-width: thin; overscroll-behavior-x: contain; }
.table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
.table-wrap { margin: 1.5em 0; }
/* JS 包装后内层 table 自带的 1.5em 会和外层叠加成 3em：正文里每张表上方
   凭空多出一倍空隙，与段落/代码块节奏不一致。外包存在时内边距归零。 */
.table-wrap table { margin: 0; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose tbody tr:nth-child(2n) { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

/* ---------- ④-9 代码 ---------- */
.prose code { font-family: var(--font-mono); font-size: .88em; }
/* ⚠ 必须同时覆盖「.prose 直接子元素」：Markdown 用 <br> 连接的行内代码块
   （`<pre>…</pre><br>行内 <code>` 这种）不会包进 <p>，只写 `.prose :not(pre) > code`
   时既不匹配样式、也不生成 ::after 反馈 —— 表现为「行内代码没有灰底、点了没反应」。 */
.prose :not(pre) > code,
.prose > code { background: var(--code-bg); border: 1px solid var(--border); padding: .12em .4em; border-radius: var(--radius-xs); }
/* ⚠ 手型光标只在脚本在位（html.js）时出现：无 JS 时点击不会复制，指针却在暗示可点。
   ⚠ 短代码（<8 字符，theme.js 打的 .code-static）连可聚焦都没有（无 tabindex/role），
      更要收掉指针与「点击复制」提示，否则又是一个「看着能点、键盘到不了」的控件。 */
html.js .prose :not(pre) > code,
html.js .prose > code { cursor: pointer; }
html.js .prose code.code-static { cursor: default; }
/* 属性门控：缺 data-msg 时伪元素仍会生成、margin-left 照常生效 ⇒ 每个行内代码
   右侧平白多出 6px 幽灵间距（与 .engine-pill 的 [data-msg]:not([data-msg=""]) 同思路） */
.prose :not(pre) > code[data-msg]::after,
.prose > code[data-msg]::after { content: attr(data-msg); margin-left: 6px; font-size: var(--fs-xs); color: var(--accent-ink); }
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; font-size: var(--fs-sm); line-height: 1.7;
  margin: 0; tab-size: 2; scrollbar-width: thin;
}
.code-block { position: relative; margin: 1.5em 0; }
.code-block::before {
  content: attr(data-lang); position: absolute; top: 0; left: 12px; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .04em;
  color: var(--muted); background: var(--bg); border: 1px solid var(--border);
  padding: 0 6px; border-radius: var(--radius-pill); z-index: 2;
}
.code-block:not([data-lang])::before { display: none; }
.code-copy {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  border-radius: var(--radius-xs); font-size: var(--fs-xs); padding: 3px 10px; cursor: pointer;
  opacity: 0; transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.code-block:hover .code-copy, .code-copy:focus-visible, .code-copy.is-done, .code-copy.is-fail { opacity: 1; }
.code-copy.is-done { color: var(--ok-fg); border-color: var(--ok-bd); }
.code-copy.is-fail { color: var(--err-fg); border-color: var(--err-bd); }
@media (hover: none) { .code-copy { opacity: 1; } }
.tok-kw { color: var(--tok-kw); font-weight: 600; } .tok-str { color: var(--tok-str); }
.tok-com { color: var(--tok-com); font-style: italic; } .tok-num { color: var(--tok-num); }
.tok-fn { color: var(--tok-fn); } .tok-tag { color: var(--tok-tag); }

/* ---------- ④-10 容器（FAQ / :::） ---------- */
.faq { margin: 1.2em 0; }
/* faq-item 与 ctx-details 的 summary 规则相同：合并选择器单一出处（原先两份逐字重复） */
.faq-item summary, .ctx-details summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: var(--fs-sm); }
.faq-item summary:hover, .ctx-details summary:hover { background: var(--surface-2); }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: var(--sp-2) 0; background: var(--surface); overflow: hidden; }
.faq-answer { padding: 0 14px 12px; font-size: var(--fs-sm); color: var(--text-2); }
.ctx { margin: 1.2em 0; }
.ctx-tabs { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 1.2em 0; }
.ctx-tabs-bar { display: flex; flex-wrap: wrap; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ctx-tab {
  border: 0; background: none; padding: 9px 16px; font-size: var(--fs-sm);
  color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.ctx-tab:hover { color: var(--text); }
.ctx-tab.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); background: var(--surface); }
.ctx-panel { padding: 4px 16px 12px; background: var(--surface); }
.ctx-details { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 1em 0; background: var(--surface); overflow: hidden; }
.ctx-details > *:not(summary) { padding: 0 14px; }

/* ---------- ④-11 上下篇 / 相关 ---------- */
.single-foot { display: flex; gap: var(--sp-2); margin: var(--sp-6) 0 var(--sp-2); padding-top: var(--sp-5); border-top: 1px solid var(--border); flex-wrap: wrap; }
.single-foot .btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); padding: 7px 16px; border-radius: var(--radius-pill); }
.single-foot .btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin: var(--sp-4) 0 var(--sp-6); }
.post-nav-link {
  display: flex; flex-direction: column; gap: 6px; padding: var(--sp-4) 20px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.post-nav-link.is-next { text-align: right; }
.post-nav-link:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.post-nav-label { font-size: var(--fs-xs); color: var(--muted); letter-spacing: .02em; }
.post-nav-link[rel="prev"] .post-nav-label::before { content: "← "; }
.post-nav-link.is-next .post-nav-label::after { content: " →"; }
.post-nav-title { font-size: var(--fs-sm); font-weight: 550; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-nav-link.is-empty { visibility: hidden; }
.related { margin: var(--sp-5) 0; padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.related-list { list-style: none; margin: 0; padding: 0; }
.related-list li { border-bottom: 1px solid var(--border); }
.related-list a { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 11px 2px; align-items: baseline; }
.related-list a:hover { text-decoration: none; }
.related-title { color: var(--text); font-size: var(--fs-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-list a:hover .related-title { color: var(--accent-ink); }
.related-meta { color: var(--muted); font-size: var(--fs-xs); flex: none; }

/* ---------- ④-12 评论 / 表单 ---------- */
.comments { margin: var(--sp-7) 0 0; padding-top: var(--sp-6); border-top: 1px solid var(--border); }
.comments-title { font-size: var(--fs-h3); font-weight: 700; }
.comment-list, .comment-children { list-style: none; margin: 0; padding: 0; }
.comment-children { margin-left: 28px; border-left: 2px solid var(--border); padding-left: var(--sp-4); }
/* 三层以上不再缩进：5 层楼中楼在 320px 下正文只剩几十像素 */
.comment-children .comment-children .comment-children { margin-left: 0; padding-left: var(--sp-3); }
.comment { padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); }
.comment-avatar {
  width: 28px; height: 28px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.comment-author { font-weight: 600; }
.comment-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.comment-reply { margin-left: auto; font-size: var(--fs-xs); }
.comment-body { margin-top: 6px; font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; text-wrap: pretty; }

.comment-form, .contact-form {
  scroll-margin-top: var(--anchor-offset, 84px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 22px; margin-top: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.comment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.comment-form label, .contact-form label, .auth-form label { display: block; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 5px; }
.comment-form input, .comment-form textarea, .contact-form input, .contact-form textarea,
.search-form input, .pw-card input, .auth-form input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: inherit; font-size: var(--fs-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.comment-form textarea, .contact-form textarea { resize: vertical; line-height: 1.7; }
.comment-form input:focus, .comment-form textarea:focus,
.contact-form input:focus, .contact-form textarea:focus,
.search-form input:focus, .pw-card input:focus, .auth-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.comment-form p, .contact-form p { margin: 0 0 var(--sp-3); }
.replying { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 6px 10px; font-size: var(--fs-xs); }
/* 联系页字段级错误说明（输入框 aria-describedby 指向它）：与 .notice-error 同色系 */
.field-err { display: block; margin-top: 4px; font-size: var(--fs-xs); color: var(--err-fg); line-height: 1.6; }
/* 验证码行：图片本身就是「换一张」（JS 在位就地换 token，无 JS 时是 ?c=refresh 链接） */
.captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.captcha-refresh { position: relative; display: inline-flex; flex: none; border-radius: var(--radius-sm); line-height: 0; }
.captcha-img { border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; max-width: 100%; height: auto; }
/* 验证码是服务端固定浅色位图，light-dark() 管不到：暗色下反相避免刺眼白块。
   手动暗色与「系统深色且未手动切换」（data-theme=""，最常见的暗色场景）都要覆盖 */
html[data-theme="dark"] .captcha-img { filter: invert(1) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .captcha-img { filter: invert(1) hue-rotate(180deg); }
}
.captcha-q { font-family: var(--font-mono); background: var(--bg-soft); padding: 6px 12px; border-radius: var(--radius-sm); letter-spacing: .1em; font-size: var(--fs-lg); line-height: 1.4; }
.captcha-badge {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; letter-spacing: 0;
  background: var(--accent); color: var(--on-accent);
  opacity: 0; transform: translateY(3px); pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.captcha-refresh:hover .captcha-badge, .captcha-refresh:focus-visible .captcha-badge { opacity: 1; transform: none; }
/* 触屏没有 hover：角标常驻，否则「图片可点」这件事没人知道 */
@media (hover: none) { .captcha-badge { opacity: .92; transform: none; } }
.captcha-refresh.is-busy { opacity: .55; pointer-events: none; }
.captcha-hint { flex: 1 1 100%; font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.captcha-row input { max-width: 140px; }
/* 蜜罐字段：视觉移出视口（真人不可见），但必须保持可聚焦/可交互 —— 自动化填表工具会把它当普通字段填充。禁止改回 display:none/visibility:hidden（会让 Playwright fill 与 AI 代理直接跳过） */
.field-website { position: absolute; left: -9999px; height: 1px; overflow: hidden; }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--fs-sm); margin: var(--sp-3) 0; }
.notice-success { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-bd); }
.notice-error { background: var(--err-bg); color: var(--err-fg); border: 1px solid var(--err-bd); }
.notice-info { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- ④-13 归档 / 作者 / 时间线 ---------- */
/* 头部两行式（分类/标签/归档共用）：上方不再画分割线，保留下方分割线作为列表上缘分隔 */
.archive-head { margin: var(--sp-6) 0 0; padding: var(--sp-4) 2px var(--sp-4); border-bottom: 1px solid var(--border); }
.author-head { margin: var(--sp-6) 0 var(--sp-5); display: flex; flex-direction: column; align-items: center; text-align: center; }
.eyebrow { font-size: var(--fs-label); font-weight: 600; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--accent-ink); margin: 0 0 6px; }
.archive-title { font-size: var(--fs-h1); font-weight: 800; margin: 0 0 var(--sp-2); overflow-wrap: anywhere; }
.archive-count { color: var(--muted); font-size: var(--fs-xs); margin: 0 0 var(--sp-3); font-variant-numeric: tabular-nums; }
/* 头部两行式：第一行「标题 + 眉标」、第二行「共 N 篇 + Markdown 索引」，各占一行 */
.archive-title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 var(--sp-2); }
.archive-title-row .archive-title, .archive-title-row .eyebrow { margin: 0; }
.archive-meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.archive-meta-row .archive-count { margin: 0; }
.author-avatar {
  width: 68px; height: 68px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-ink); font-size: 1.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-3);
}
.author-bio { color: var(--text-2); font-size: var(--fs-sm); max-width: 36em; }
.timeline-year { margin: var(--sp-6) 0; }
.timeline-month { margin: 0 0 12px; }
.timeline-year-label { font-size: var(--fs-h2); font-weight: 800; color: var(--accent-ink); margin-bottom: 10px; }
.timeline-label { font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-4) 0 6px; }
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li { display: flex; gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.timeline-list time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.timeline-list a { overflow-wrap: anywhere; }
.timeline-list a:hover { text-decoration: none; color: var(--accent-ink); }
/* 归档年份索引（/archives）：三级下钻的最轻一层，年份行 + 每篇数 */
.archive-years { list-style: none; margin: var(--sp-5) 0 0; padding: 0; }
.archive-years li { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.archive-years a { font-size: var(--fs-h3); font-weight: 700; color: var(--accent-ink); }
.archive-years a:hover { text-decoration: none; opacity: .82; }
.archive-years .archive-count { margin: 0; }
/* 年份页月份标题：链到单月页（/archives/YYYY/MM），下钻第三级入口 */
.timeline-label a { color: var(--accent-ink); font-weight: 600; }
.timeline-label a:hover { text-decoration: none; opacity: .82; }

/* ---------- ④-14 搜索 / 留言 ---------- */
.search-form { display: flex; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-3); }
.search-form input { flex: 1; }
.engine-picker { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-4); }
/* 胶囊是带 form 属性的提交按钮（指向搜索表单 id geo-search-form-{uid}，无 JS 也能切换引擎） */
.engine-pill {
  padding: 5px 14px; background: none;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  font: inherit; font-size: var(--fs-xs); line-height: 1.6; color: var(--text-2); cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.engine-pill:hover { border-color: var(--accent); color: var(--accent-ink); }
.engine-pill.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.engine-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 弹窗被拦截时的短反馈：与标题锚点/行内代码同一套 data-msg 机制（JS 置入，2.4s 后移除） */
.engine-pill[data-msg]:not([data-msg=""])::after {
  content: attr(data-msg); display: block; margin-top: 4px;
  font-size: var(--fs-xs); font-weight: 400; color: var(--accent-ink);
}
.results-line { color: var(--muted); font-size: var(--fs-xs); margin: var(--sp-2) 0 var(--sp-4); }
.fallback-line { color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- ④-15 口令 / 404 ---------- */
.pw-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-6); margin: var(--sp-7) auto; box-shadow: var(--shadow-sm); }
.pw-card input { max-width: 280px; }
/* 输入框 + 按钮同一行：窄屏自动折成两行并各自撑满（按钮不再被挤压成半宽） */
.pw-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.pw-row input { flex: 1 1 220px; }
.pw-row .btn { flex: 0 0 auto; }
.pw-hint { color: var(--text-2); font-size: var(--fs-sm); }
.pw-hint-ttl { color: var(--muted); font-size: var(--fs-xs); }
/* .not-found 不自造 padding：间距统一由 .empty-state 提供（两套口径会互相叠加） */
.nf-code {
  font-size: clamp(3.5rem, 2.5rem + 5vw, 5rem); font-weight: 800; line-height: 1; margin: 0; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--accent); /* 不支持背景裁剪时回落纯色 */
}
.nf-links { display: flex; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-4); flex-wrap: wrap; }

/* ---------- ④-16 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: var(--sp-2); margin: var(--sp-6) 0; font-size: var(--fs-sm); }
.pager-link {
  padding: 8px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text); font-weight: 550;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
              background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.pager-link:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; background: var(--accent-soft); }
.pager-cur { color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 var(--sp-2); }

/* ---------- ④-17 页脚 ---------- */
/* 页脚四列：整体宽度与顶栏导航一致（同用 .wrap 的 --wrap-wide），
   只把品牌列比例让给链接区（1.2fr→1fr），否则 4×~160px 的列宽会把「分类目录」类标题折行 */
.site-foot { border-top: 1px solid var(--border-strong); background: var(--band); margin-top: var(--sp-8); }
.foot-top { padding: var(--sp-7) 0 var(--sp-6); display: grid; grid-template-columns: minmax(220px, 1fr) 2.4fr; gap: var(--sp-6); }
.foot-title { font-weight: 750; font-size: var(--fs-lg); margin: 0 0 var(--sp-2); }
.foot-about { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.75; margin: 0; max-width: 34em; text-wrap: pretty; }
.foot-brand-text { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.75; }
/* 子主题继承父主题的 footer.php 会用到这些类，techlog 只加载自身 style.css，必须自带 */
.foot-brand { display: flex; flex-direction: column; gap: 6px; }
/* 轨道用 minmax(0,1fr) 而非 1fr：1fr 的最小值是 min-content，任一列出现长链接时
   该轨道会被撑宽、合计超出 .foot-top → 末列被挤出可视区（表现为「列掉队」）。
   --foot-cols 由 footer.php 按实际列数下发（count(geocms_footer_columns())）：固定
   4 轨时，3 列站点（如无标签）的第 4 轨会空占 1fr。缺省值 4 保持旧行为。
   grid-auto-flow:column 是兜底：即使页脚列数超过声明的轨数，也只会向右延伸，永不换行掉到下一行。 */
.foot-cols { display: grid; grid-template-columns: repeat(var(--foot-cols, 4), minmax(0, 1fr)); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 20px; }
.foot-col { min-width: 0; }
.foot-col-title { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col a { font-size: var(--fs-sm); color: var(--text-2); display: inline-block; padding: 3px 0; overflow-wrap: break-word; }
.foot-col a:hover { color: var(--accent-ink); }
.foot-bottom {
  border-top: 1px solid var(--border); padding: var(--sp-4) 0 var(--sp-5);
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
}
.foot-slot { text-align: right; }
.foot-slot .copyright { margin: 0; color: var(--muted); font-size: var(--fs-xs); }
.foot-credit { font-size: var(--fs-xs); color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.foot-credit a { color: var(--muted); }
.foot-credit a:hover { color: var(--accent-ink); }
.foot-bottom > .foot-credit { margin-left: auto; text-align: right; }
.foot-credit-custom { color: var(--muted); }

/* ---------- ⑤ 响应式 ---------- */
@media (max-width: 1120px) {
  .list-layout, .single-layout { grid-template-columns: 1fr; }
  .list-layout:not(.is-solo) .list-main, .single-layout:not(.is-solo) .single-main {
    border-right: 0; border-left: 0; margin-right: 0; margin-left: 0; padding-right: 0; padding-left: 0;
  }
  .list-layout:not(.is-solo)::after, .single-layout:not(.is-solo)::after { content: none; }
  .site-side { position: static; max-height: none; margin-top: var(--sp-6); }
  /* ⚍ 只解除两栏栅格，measure 约束必须保留（原先 max-width:none + margin:0 把
     正文放宽到 713–1072px，17px 字号下每行 45–65+ 汉字，远超 ~40 字/行的
     阅读度量）。窄于 measure 时 min() 自动退化为全宽，不影响小屏。 */
  .list-layout.is-solo .list-main { max-width: min(100%, var(--measure-list)); margin-left: auto; margin-right: auto; }
  .single-layout.is-solo .single-main { max-width: min(100%, var(--measure-prose)); margin-left: auto; margin-right: auto; }
}
@media (max-width: 900px) {
  .brand-slogan { display: none; }
  /* ⚠ 汉堡入口与断点必须一致（与父主题 ink-v3 同步）：原先 ≤900px 改横向滚动、
     汉堡却 ≤760px 才出现 ⇒ 761–900px 区间菜单溢出且不可达。整套抽屉上移到 900px。 */
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: var(--head-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    margin: 0; box-shadow: var(--shadow-pop);
    /* ⚠ 抽屉自己必须能滚：body.nav-open 把背景滚动彻底锁死，而菜单项多或展开多个
       子菜单时抽屉高度会超过视口下沿 —— 没有 max-height + overflow-y 的那部分菜单
       永久不可达（横屏小屏几乎必现）。--head-h 在 ≤760px 断点另有覆盖值，这里只
       引用变量不写死像素；dvh 前先给 vh 兜底（老浏览器不认 dvh 会整条声明丢弃）。 */
    max-height: calc(100vh - var(--head-h));
    max-height: calc(100dvh - var(--head-h));
    overflow-y: auto;
    overscroll-behavior: contain; /* 滚到尽头不把 body 带着一起滚（锁滚动下的橡皮筋） */
    -webkit-overflow-scrolling: touch;
  }
  .site-nav.is-open { display: block; animation: geo-drop .18s var(--ease); }
  @keyframes geo-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  .nav-list { flex-direction: column; align-items: stretch; padding: var(--sp-2); gap: 2px; }
  .nav-item > a { display: block; border-radius: var(--radius-sm); }
    .nav-item.nav-search { margin-left: 0; }
  /* ⚠ .nav-item.has-sub 仍是横向 flex（基础规则），而 .nav-sub 在这里已静态化，
     于是它变成第三个横向 flex item 被挤到父链接旁边甚至溢出容器。
     允许折行 + 子菜单独占整行，抽屉里的层级才正确。 */
  .nav-item.has-sub { flex-wrap: wrap; }
  .nav-item.has-sub > a { flex: 1 1 auto; min-width: 0; }
  .nav-sub { position: static; box-shadow: none; border: 0; background: none; display: none; padding-left: var(--sp-4); flex: 1 1 100%; }
  .nav-item.is-open .nav-sub { display: block; }
  .foot-top { grid-template-columns: 1fr; gap: var(--sp-5); }
}
/* ⚠ 塌成两列的临界点是 700px 而不是 900px：≤900px 时品牌列已独占一行（.foot-top 变单列），
   链接区拿到整栏宽度，四列在 701–900px 仍有 148–205px，比 901px 时的 127px 更宽松。
   原先挂在 900px 断点上会让 701–900px 白扔一半横向空间（2×408px 两列）。 */
@media (max-width: 700px) {
  /* 这里必须把 grid-auto-flow 还原成 row，否则列会一直向右排，两列模板形同虚设 */
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-columns: auto; }
}
@media (max-width: 760px) {
  :root { --head-h: 62px; --gutter: 20px; }
  .hero-center-inner { padding: var(--sp-7) var(--gutter) var(--sp-6); }
  .hero-center.is-image.has-bg .hero-center-inner { padding: var(--sp-8) var(--gutter) var(--sp-7); }
  .hero-display { font-size: clamp(1.75rem, 7vw, 2.4rem); }
  .hero-lead { font-size: var(--fs-md); }
  .hero-actions .btn { width: 100%; }
  .post-row { padding: var(--sp-4) 0; }
  .post-row::before { left: -12px; }
  .card-body { padding: var(--sp-4) 20px; }
  .foot-bottom { flex-direction: column; align-items: flex-start; }
  .foot-bottom > .foot-credit { margin-left: 0; text-align: left; }
  .foot-slot { text-align: left; }
  /* 防 iOS 聚焦缩放：必须覆盖 textarea 与全部输入框 —— 评论/留言/搜索/口令/会员页都会聚焦 */
  .comment-form input, .comment-form textarea,
  .contact-form input, .contact-form textarea,
  .search-form input, .pw-card input, .auth-form input { font-size: 16px; }
}
@media (max-width: 530px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.is-empty { display: none; }
  .comment-grid { grid-template-columns: 1fr; }
  .foot-cols { grid-template-columns: 1fr; }
}

/* 尊重系统的「减少动效」偏好：一次性关掉全部过渡与动画 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- ⑥ 打印 ---------- */
@media print {
  .site-head, .site-foot, .toc, .single-foot, .related, .pager, .skip, .site-side,
  .post-nav, .comments, .theme-toggle, .nav-toggle, .code-copy, .hero-center,
  .breadcrumb, .reading-bar, .to-top, .side-contact, .heading-anchor, .single-toc-slot, .unlock-bar { display: none !important; }
  body { font-size: 12pt; color: #000; background: #fff; }
  .prose { font-size: inherit; }
  .prose a { color: #000; text-decoration: underline; }
  .prose pre, .prose blockquote { border: 1px solid #999; background: #fff; }
  .single-layout, .list-layout { display: block; }
  .card { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
}


/* ---------- Windows 高对比度（forced-colors）----------
   按钮/卡片/侧栏盒/提示条的表意主要靠底色与 1px 边框，强制配色会把
   background / border-color 全部丢弃 ⇒ 块与块糊成一片。这里补回系统色边框。
   本模式下的全部规则集中在同一个块里（焦点 outline 见块尾），避免同一选择器的
   声明散落两处、后者静默覆盖前者（合并前 .btn 的 CanvasText 边框就是这样被冲掉的）。 */
@media (forced-colors: active) {
  .chip, .card, .side-box, .notice, .toc, .keypoints, .post-row { border: 1px solid CanvasText; }
  .btn-primary { background: ButtonFace; border-color: ButtonText; color: ButtonText; }
  .btn-ghost { background: transparent; }
  .side-rank, .side-rank.is-top { background: Canvas; color: CanvasText; border: 1px solid CanvasText; }
  a { text-decoration: underline; }
  /* 渐变文字（background-clip:text + transparent 字色）在强制配色下整块变透明 ⇒ 404 数字消失。
     这里丢弃背景裁剪，改用系统前景色 + 显式底色。 */
  .nf-code { background: none; -webkit-text-fill-color: CanvasText; color: CanvasText; }
  .pw-card, .empty-state { border: 1px solid CanvasText; }
  /* 强制配色模式（Windows 高对比度）会丢弃 box-shadow：只靠阴影表示焦点的控件
     在此模式下完全没有焦点指示，补回系统色 outline。 */
  :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
  /* .btn 在两块里重复出现过（CanvasText / ButtonBorder）：按按钮语义保留 ButtonBorder 一条。 */
  .btn, .card, .engine-pill { border: 1px solid ButtonBorder; }
}

/* ===================================================================
   触控命中区与焦点可见性（v3.1）
   ------------------------------------------------------------------ */
/* ⚠ .sub-toggle 22px、主题/导航按钮 36–38px、悬浮按钮 42px，均低于 44px 触控下限。
   只在粗指针设备放大命中区，桌面视觉尺寸保持不变。 */
@media (pointer: coarse) {
  .sub-toggle, .theme-toggle, .nav-toggle, .btn-sm, .to-top, .side-contact { min-width: 44px; min-height: 44px; }
  .sub-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .engine-pill { min-height: 44px; }
  /* 同批低于 44px 下限的还有筛选胶囊、分页器与列表/页脚/侧栏的文字链接（实测 24–36px）。
     ⚠ min-height 对 inline 不生效：.chip/.pager-link 必须同时 flex 化并居中，
     否则规则写了等于没写（这正是上一轮只补了按钮、漏了链接的原因）。 */
  .chip, .pager-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
  .side-list li a { display: block; min-height: 44px; }
  /* 文字链接（复制链接/回复/页脚/面包屑/代码复制/归档时间线）同样是 inline：
     不 flex 化的话 min-height 直接被忽略。⚠ 只给 li a，避免把整行 li 撑高。 */
  .link-btn, .comment-reply, .foot-col a, .breadcrumb a, .code-copy, .timeline-list li a {
    display: inline-flex; align-items: center; min-height: 44px;
  }
}
/* 卡片元信息与列表行元信息规则几乎逐字重复：合并为基础规则，差异只在各自的下外边距
   （写在 .card-meta / .post-row-meta 各自那条里，勿在此重复基础排版）。
   ⚠ color 必须写 --muted：早先误用未定义的 --text-3，计算值失效后回退继承色，
   元信息失去弱化层级（CDP 实测拿到 rgb(27,31,36) 而非 muted 的 rgb(95,104,120)）。 */
.card-meta, .post-row-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  color: var(--muted); font-size: var(--fs-xs);
}

/* ---------- 付费墙 / 读者中心（v3.9.0） ---------- */
.paywall {
  margin: 2rem 0 1rem; padding: 1.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-align: center;
  /* 顶部渐变遮罩：暗示「正文在这里被截断」，纯视觉，不承担任何权限职责 */
  box-shadow: inset 0 1px 0 var(--border);
}
.paywall-title { margin: 0 0 .5rem; font-size: var(--fs-lg); }
.paywall-lead { margin: 0 0 1rem; color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }
.paywall-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 0; }
/* 次级转化行：承接主 CTA 之外的无账号访客（还不是会员？立即开通） */
.paywall-sub { margin: .7rem 0 0; color: var(--muted); font-size: var(--fs-xs); }
.paywall-sub a { color: var(--accent-ink); font-weight: 600; }

/* ---------- 悬浮解锁底栏（v3.13.0）：滚动越过付费墙后唤起，拇指可达的常驻转化位 ---------- */
.unlock-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  transform: translateY(100%); visibility: hidden;
  transition: transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.unlock-bar.is-on { transform: translateY(0); visibility: visible; }
.unlock-bar-in {
  display: flex; align-items: center; gap: var(--sp-3);
  /* --wrap 不存在（唯一宽度令牌是 --wrap-wide）：无效 var 使 max-width 解析为 none，
     解锁底栏横贯整屏、标题贴屏幕左缘 —— 对齐全站 1200px 网格 */
  max-width: var(--wrap-wide); margin: 0 auto; padding: 10px var(--sp-4);
}
.unlock-bar-title {
  flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.unlock-bar .btn { flex: none; }
/* 底栏在场时右下角悬浮按钮组让位（to-top / 联系按钮），避免遮挡 */
html.has-unlock-bar .to-top { bottom: calc(var(--sp-5) + 58px); }
html.has-unlock-bar .side-contact { bottom: calc(var(--sp-5) + 52px + 58px); }
@media (max-width: 480px) {
  .unlock-bar-in { padding: 8px var(--sp-3); }
  .unlock-bar-title { font-size: var(--fs-xs); }
}

/* ---------- 会员中心（登录 / 注册 / 账号）：与 pw-card 同族的卡片范式 ----------
   v3.15.0：表单原先裸排在页面上，无语境、无切换、无加载/错误形态。统一进 auth-card，
   复用全站 token（surface/border/radius/shadow），输入框样式并入表单段共享选择器组。 */
.reader-page { padding-block: clamp(2.5rem, 7vh, 4.5rem); }
.auth-card {
  max-width: 420px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-6) var(--sp-6) var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.auth-card-account { max-width: 520px; }
/* 登录/注册分段切换：bg-soft 槽 + 激活片浮起（与全站 pill/chip 的克制风格一致） */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg-soft); border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: var(--sp-5);
}
.auth-tab {
  text-align: center; padding: 8px 0; border-radius: var(--radius-xs);
  font-size: var(--fs-sm); color: var(--muted); text-decoration: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.auth-tab:hover { color: var(--text); text-decoration: none; }
.auth-tab.is-active {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.auth-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-head { margin-bottom: var(--sp-4); }
.auth-title { font-size: 1.375rem; line-height: 1.3; margin: 0 0 var(--sp-2); }
.auth-sub { margin: 0; font-size: var(--fs-sm); color: var(--muted); line-height: 1.7; }
/* 错误态：图标 + 描述一行内；role=alert 由模板输出 */
.auth-error {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  background: var(--err-bg); color: var(--err-fg); border: 1px solid var(--err-bd);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: var(--fs-sm); line-height: 1.6; margin: 0 0 var(--sp-4);
}
.auth-error svg { flex: none; margin-top: 3px; }
.auth-form { display: grid; gap: var(--sp-4); }
.auth-form .field { margin: 0; }
/* 口令可见性切换：输入框右侧内嵌图标按钮（主题悬浮控件的 44px 命中口径） */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-right: 44px; }
.pass-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: var(--radius-xs);
  background: none; color: var(--muted); cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pass-toggle:hover { color: var(--text); background: var(--bg-soft); }
/* ⚠ [hidden] 必须显式压掉上面的 display:inline-flex —— 类选择器 (0,1,0) 会盖过
   [hidden] 的 UA 样式，按钮将永远可见（JS 失败时点了没反应的死控件）。
   默认 hidden，由 theme.js initPassToggle 初始化成功后移除。 */
.pass-toggle[hidden] { display: none; }
.pass-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pass-toggle .ic-eye-off { display: none; }
.pass-toggle[aria-pressed="true"] .ic-eye { display: none; }
.pass-toggle[aria-pressed="true"] .ic-eye-off { display: block; }
/* 提交：整宽 + 升档（与 btn-lg 同族的触达面积） */
.auth-form .btn { width: 100%; justify-content: center; padding-block: 11px; font-size: var(--fs-md); margin-top: var(--sp-1); }
.auth-form .btn.is-loading { opacity: .7; pointer-events: none; }
/* 注册权益行：虚线分隔的三枚胶囊（复用 chip 的视觉词汇） */
.auth-chips {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin: var(--sp-5) 0 0; padding-top: var(--sp-4);
  border-top: 1px dashed var(--border);
}
.auth-chip { font-size: var(--fs-xs); color: var(--text-2); background: var(--bg-soft); border-radius: var(--radius-pill); padding: 4px 11px; }
/* 模式互跳与账号页信息行 */
.auth-alt { text-align: center; font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-4) 0 0; }
.auth-alt a { color: var(--accent-ink); }
.reader-dl { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.25rem; margin: var(--sp-4) 0 var(--sp-5); }
.reader-dl dt { color: var(--muted); font-size: var(--fs-sm); }
.reader-dl dd { margin: 0; overflow-wrap: anywhere; }
.reader-actions { display: flex; gap: .6rem; }
.chip-tier { background: var(--accent-soft); color: var(--accent-ink); }
/* 会员有效期：过期态的账号页胶囊（err 色系，与 notice-error 同源） */
.chip-expired { background: var(--err-bg); color: var(--err-fg); }
/* 蜜罐字段改用全站统一的 .field-website（style.css 表单段已有定义） */
/* 会员卡在场时右下角悬浮联系钮让位（与 html.has-unlock-bar 同一口径）：
   窄屏下全宽主按钮延伸到卡片右缘，悬浮钮原位会压住按钮角部。 */
@media (max-width: 530px) {
  body:has(.auth-card) .side-contact { bottom: calc(var(--sp-5) + 52px + 58px); }
}
@media (max-width: 480px) {
  .auth-card { padding: var(--sp-5) var(--sp-4) var(--sp-4); border-radius: var(--radius); }
  .auth-title { font-size: 1.25rem; }
}
