/* ============================================================
   博客前台样式
   ------------------------------------------------------------
   设计系统：纸墨（Paper & Ink）

   原则
   - 排版优先：明确的字号层级 + 克制的装饰 + 充足留白
   - 卡片不靠边框和阴影堆叠，靠留白与分隔线组织
   - 动画只用 transform / opacity，保证 60fps
   - 支持浅色 / 深色主题，跟随系统 + 手动切换
   - 支持 View Transitions API
   - 响应式，移动优先
   ============================================================ */

/* ============================================================
   1. 设计变量
   ============================================================ */
:root {
  /* 强调色（实际值由后台「站点设置 → accent_color」注入覆盖，这里是兜底） */
  --accent: #6d4aff;
  --accent-strong: #5b3ce0;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 5%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 22%, transparent);

  /* 中性色：暖调纸面 */
  --bg: #faf9f7;
  --bg-alt: #f2f0ec;
  --panel: #ffffff;
  --panel-2: #fbfaf8;
  --text: #14161a;
  --text-2: #474c56;
  --muted: #8b909b;
  --line: #e8e5df;
  --line-2: #f1efeb;

  --code-bg: #f6f5f2;

  /* 语义色 */
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --ok-line: #bbf7d0;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-line: #fde68a;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --info-line: #bfdbfe;

  /* 形状 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --pill: 999px;

  /* 阴影：克制 */
  --shadow-xs: 0 1px 2px rgba(20, 22, 26, .04);
  --shadow-sm: 0 1px 3px rgba(20, 22, 26, .06), 0 1px 2px rgba(20, 22, 26, .04);
  --shadow: 0 6px 20px -6px rgba(20, 22, 26, .10), 0 2px 6px rgba(20, 22, 26, .04);
  --shadow-lg: 0 20px 46px -18px rgba(20, 22, 26, .20), 0 4px 12px rgba(20, 22, 26, .05);

  /* 尺寸 */
  --header-h: 62px;
  --container: 1180px;
  --prose: 46rem;

  /* 缓动 */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

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

html[data-theme="dark"] {
  --accent: #a5b4fc;
  --accent-strong: #c7d2fe;
  --accent-ink: #14161a;
  --accent-line: color-mix(in srgb, var(--accent) 28%, transparent);

  --bg: #0f1115;
  --bg-alt: #171a20;
  --panel: #161920;
  --panel-2: #1b1f27;
  --text: #e8eaee;
  --text-2: #aeb4c0;
  --muted: #767d8a;
  --line: #262a33;
  --line-2: #1e222a;

  --code-bg: #12151b;

  --ok: #6ee7a0;
  --ok-bg: #0e2016;
  --ok-line: #1c5133;
  --warn: #fcd34d;
  --warn-bg: #241d0c;
  --warn-line: #6b4a12;
  --danger: #fca5a5;
  --danger-bg: #241112;
  --danger-line: #6b2124;
  --info: #93c5fd;
  --info-bg: #101d33;
  --info-line: #1e3a8a;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow: 0 6px 20px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 22px 50px -20px rgba(0, 0, 0, .7);
}

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

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
  /* 底色放在 html 上，body 保持透明，这样 z-index:-1 的光晕层才看得见 */
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.72;
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

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

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

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: var(--pill);
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 10px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0 0 10px 0;
  font-size: 14px;
}
.skip-link:focus { left: 0; }

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 100;
  pointer-events: none;
  background: transparent;
}
.reading-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transform-origin: 0 50%;
  transition: width .1s linear;
}

/* ============================================================
   2b. 背景光晕（Aurora）
   ------------------------------------------------------------
   三个不同颜色的模糊光团，铺在整页背景上缓慢波动。

   实现要点
   - 用 radial-gradient 做柔化，而不是 filter: blur()。大尺寸元素上
     blur 每帧都要重新栅格化，radial-gradient 只需栅格化一次，之后
     缩放交给合成层，代价低一个数量级。
   - 只动 transform / opacity，配合 will-change 提升为合成层，不掉帧。
   - 位置由 --x / --y 控制，各 .page-* 覆盖，于是首页在右上角、
     文章页散开、列表页沿顶部铺开 —— 切页时产生对应变化。
   - z-index:-1 且 body 透明，保证它永远在内容之下，其它元素无需加层级。
   ============================================================ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  --o-scale: 1;
  /* 全局浓度增益：想整体调亮/调暗光晕，只改这一个数。
     1 = 最初的保守版；1.6 = 现在明显可见但仍柔和的档位；
     超过 ~1.9 开始抢戏，会盖过强调色。 */
  --o-gain: 1.6;
}
/* 深色底本身会让光晕更跳，所以降档，避免糊住浅色文字 */
html[data-theme="dark"] .aurora { --o-scale: .78; }

/* 极细噪点：一是消除大面积渐变的色带，二是让背景有纸张/胶片质感。
   静态图层，只栅格化一次。 */
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .022;
  pointer-events: none;
}
html[data-theme="dark"] .aurora::after { opacity: .03; }

.aurora-blob {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: var(--size);
  height: var(--size);
  /* 用独立的 translate 属性做居中，把 transform 留给动画 */
  translate: -50% -50%;
  border-radius: 50%;
  opacity: calc(var(--o, .3) * var(--o-scale, 1) * var(--o-gain, 1));
  /* 多段衰减：中段收紧保证有「核」，尾段拉长避免出现实心圆的硬边。
     核心段（0~48%）是「明显不明显」的关键；尾段（70~100%）负责不要有硬边。 */
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--c) 82%, transparent) 0%,
    color-mix(in srgb, var(--c) 62%, transparent) 22%,
    color-mix(in srgb, var(--c) 40%, transparent) 44%,
    color-mix(in srgb, var(--c) 19%, transparent) 66%,
    color-mix(in srgb, var(--c) 6%, transparent) 85%,
    transparent 100%);
  will-change: transform, opacity;
  backface-visibility: hidden;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

/* 每个光团跑两条独立动画：
   drift 走位置与缩放，pulse 管明暗。
   两条周期互质，三个光团之间也互质，所以整体图案几乎不会重复。 */
.aurora-blob--1 {
  --c: #818cf8;                       /* 靛蓝 */
  --size: min(64vmax, 840px);
  animation-name: auroraDrift1, auroraPulse1;
  animation-duration: 41s, 19s;
  animation-delay: 0s, -3s;
}
.aurora-blob--2 {
  --c: #22d3ee;                       /* 青 */
  --size: min(52vmax, 680px);
  animation-name: auroraDrift2, auroraPulse2;
  animation-duration: 53s, 23s;
  animation-delay: -8s, -11s;
}
.aurora-blob--3 {
  --c: #f472b6;                       /* 玫红 */
  --size: min(42vmax, 540px);
  animation-name: auroraDrift3, auroraPulse3;
  animation-duration: 37s, 17s;
  animation-delay: -14s, -6s;
}

/* 多点闭合路径：不是简单的来回，而是缓慢游走 */
@keyframes auroraDrift1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  22%  { transform: translate3d(5vw, -4vh, 0) scale(1.08); }
  45%  { transform: translate3d(-3vw, 3vh, 0) scale(.95); }
  68%  { transform: translate3d(6vw, 5vh, 0) scale(1.12); }
  85%  { transform: translate3d(2vw, -2vh, 0) scale(1.02); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes auroraDrift2 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  18%  { transform: translate3d(-6vw, 3vh, 0) scale(1.1); }
  42%  { transform: translate3d(4vw, 6vh, 0) scale(.93); }
  64%  { transform: translate3d(-2vw, -5vh, 0) scale(1.14); }
  83%  { transform: translate3d(5vw, 1vh, 0) scale(1); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes auroraDrift3 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  26%  { transform: translate3d(4vw, 5vh, 0) scale(1.16); }
  52%  { transform: translate3d(-5vw, -3vh, 0) scale(.92); }
  76%  { transform: translate3d(3vw, -6vh, 0) scale(1.1); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* 明暗呼吸：和位移错开周期，避免「一起亮一起暗」的机械感 */
@keyframes auroraPulse1 {
  0%, 100% { opacity: calc(var(--o) * var(--o-scale) * var(--o-gain)); }
  50%      { opacity: calc(var(--o) * var(--o-scale) * var(--o-gain) * 1.28); }
}
@keyframes auroraPulse2 {
  0%, 100% { opacity: calc(var(--o) * var(--o-scale) * var(--o-gain)); }
  45%      { opacity: calc(var(--o) * var(--o-scale) * var(--o-gain) * 1.34); }
}
@keyframes auroraPulse3 {
  0%, 100% { opacity: calc(var(--o) * var(--o-scale) * var(--o-gain)); }
  55%      { opacity: calc(var(--o) * var(--o-scale) * var(--o-gain) * 1.22); }
}

/* ---------- 各页面的光晕布局 ---------- */

/* 首页：三个光团聚在右上角，亮度最高 */
.page-home .aurora-blob--1 { --x: 80%; --y: 2%;  --o: .44; }
.page-home .aurora-blob--2 { --x: 100%; --y: 24%; --o: .36; }
.page-home .aurora-blob--3 { --x: 66%; --y: 28%; --o: .34; }

/* 文章页：散到左上 / 右中 / 左下，整体压暗，适合长时间阅读 */
.page-post .aurora-blob--1 { --x: 8%;  --y: 2%;  --o: .32; --size: min(56vmax, 720px); }
.page-post .aurora-blob--2 { --x: 97%; --y: 46%; --o: .27; }
.page-post .aurora-blob--3 { --x: 17%; --y: 90%; --o: .24; --size: min(36vmax, 470px); }

/* 列表页（归档 / 分类 / 标签 / 搜索）：沿顶部横向铺开 */
.page-archive .aurora-blob--1,
.page-category .aurora-blob--1,
.page-tag .aurora-blob--1,
.page-search .aurora-blob--1 { --x: 12%; --y: -2%; --o: .34; }
.page-archive .aurora-blob--2,
.page-category .aurora-blob--2,
.page-tag .aurora-blob--2,
.page-search .aurora-blob--2 { --x: 92%; --y: 5%;  --o: .29; }
.page-archive .aurora-blob--3,
.page-category .aurora-blob--3,
.page-tag .aurora-blob--3,
.page-search .aurora-blob--3 { --x: 52%; --y: 30%; --o: .24; }

/* 独立页面 / 友链：重心压到下半部 */
.page-page .aurora-blob--1,
.page-links .aurora-blob--1 { --x: 90%; --y: 74%; --o: .32; }
.page-page .aurora-blob--2,
.page-links .aurora-blob--2 { --x: 8%;  --y: 38%; --o: .26; }
.page-page .aurora-blob--3,
.page-links .aurora-blob--3 { --x: 46%; --y: 100%; --o: .22; }

/* 404 等兜底页面：居中铺开 */
.page-default .aurora-blob--1 { --x: 50%; --y: 14%; --o: .38; }
.page-default .aurora-blob--2 { --x: 18%; --y: 70%; --o: .30; }
.page-default .aurora-blob--3 { --x: 82%; --y: 64%; --o: .26; }

/* ============================================================
   3. 顶部导航
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  /* 只过渡边框：background 一旦参与过渡，切换主题时头部颜色会滞后一帧 */
  transition: border-color .25s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

/* 品牌 */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--text);
  min-width: 0;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 32px; height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  object-fit: cover;
  flex: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.brand-text strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-info { display: flex; flex-direction: column; min-width: 0; }

/* 主导航 */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
  flex: 1;
  min-width: 0;
  /* 必须是 visible：分类下拉菜单要溢出到 header 之外。
     一旦这里是 hidden / auto，下拉会被整个裁掉（菜单「点了没反应」就是这么来的）。
     因此导航项数量由 PHP 侧限制（超出的一级分类收进「更多」下拉），保证不会撑破一行。 */
  overflow: visible;
}
.nav-link {
  position: relative;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--bg-alt); }
.nav-link.active { color: var(--accent); font-weight: 600; }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px;
  bottom: 1px;
  height: 2px;
  border-radius: var(--pill);
  background: var(--accent);
}

/* 有子分类的导航项 + 下拉 */
.nav-item { position: relative; display: flex; align-items: center; }
.nav-link-parent { display: inline-flex; align-items: center; gap: 3px; }
.nav-caret {
  width: 11px; height: 11px;
  opacity: .5;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav-item:hover .nav-caret,
.nav-item:focus-within .nav-caret { transform: rotate(180deg); opacity: .9; }

.nav-drop {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  min-width: 172px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s var(--ease), transform .16s var(--ease-out), visibility .16s;
  z-index: 90;
}
.nav-item:hover > .nav-drop,
.nav-item:focus-within > .nav-drop { opacity: 1; visibility: visible; transform: none; }

.nav-drop a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-drop a:hover { background: var(--bg-alt); color: var(--accent); }
.nav-drop-count {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 0 7px;
  border-radius: var(--pill);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-drop a:hover .nav-drop-count { background: var(--accent-soft); color: var(--accent); }

/* 「更多」是个 button，得手动对齐 .nav-link 的观感 */
.nav-more-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-2);
}
.nav-more-btn:hover { color: var(--text); background: var(--bg-alt); }

/* 「更多」里再嵌一级子分类 */
.nav-drop-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 3px 8px;
  padding-left: 8px;
  border-left: 1px solid var(--line-2);
}
.nav-drop-sub a { font-weight: 400; font-size: 13px; color: var(--muted); }
.nav-drop-sub a:hover { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  margin-left: auto;
}

.icon-btn {
  width: 36px; height: 36px;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--bg-alt); }

.nav-toggle { display: none; }

/* 主题图标切换：浅色显示太阳，深色显示月亮 */
.icon-sun { display: inline-flex; align-items: center; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: inline-flex; align-items: center; }

/* ============================================================
   4. 搜索面板
   ============================================================ */
.search-panel {
  position: relative;
  z-index: 88;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: panelDrop .24s var(--ease-out);
}
@keyframes panelDrop {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  color: var(--muted);
}
.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  padding: 6px 0;
  outline: none;
  color: var(--text);
}
.search-form input[type="search"]::placeholder { color: var(--muted); }
.search-form-icon { color: var(--muted); }

.search-form.inline {
  max-width: 460px;
  margin: 22px auto 0;
  padding: 6px 6px 6px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.search-form.inline input[type="search"] { font-size: 15px; }

.search-hints { padding-bottom: 16px; display: grid; gap: 2px; }
.search-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  transition: background .16s var(--ease);
}
.search-hint:hover, .search-hint.is-active { background: var(--bg-alt); color: var(--text); }
.search-hint strong { font-weight: 600; color: var(--text); }
.search-hint-meta { margin-left: auto; font-size: 12px; color: var(--muted); flex: none; }
.search-hint mark { background: transparent; color: var(--accent); font-weight: 700; }
.search-empty { padding: 14px 12px; color: var(--muted); font-size: 14px; }

/* ============================================================
   5. 提示条
   ============================================================ */
.flash-wrap { margin-top: 18px; display: grid; gap: 8px; }
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 14px;
  animation: flashIn .3s var(--ease-out);
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.flash span { flex: 1; }
.flash-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  padding: 0 4px;
  border-radius: 5px;
}
.flash-close:hover { color: var(--text); }
.flash-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash-error   { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.flash-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.flash-info    { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }

/* ============================================================
   6. 首屏
   ============================================================ */
/* 首屏保持透明，让背景光晕透上来（光晕位置见 .page-home 规则） */
.hero {
  position: relative;
  padding: 76px 0 62px;
  background: transparent;
  border-bottom: 1px solid var(--line-2);
}

.hero-inner {
  position: relative;
  display: block;
}
.hero-text { max-width: 700px; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 4px 12px;
  border-radius: var(--pill);
  margin: 0 0 20px;
  letter-spacing: .01em;
}
.hero-title {
  font-size: clamp(32px, 5vw, 50px);
  line-height: 1.14;
  letter-spacing: -.035em;
  margin: 0 0 16px;
  font-weight: 800;
}
.hero-tagline {
  font-size: 17.5px;
  color: var(--text-2);
  margin: 0 0 30px;
  line-height: 1.75;
  max-width: 34em;
}
.hero-stats {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  padding-right: 32px;
  margin-right: 32px;
  border-right: 1px solid var(--line);
}
.hero-stat:last-child { padding-right: 0; margin-right: 0; border-right: 0; }
.hero-stat b {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.hero-stat span { font-size: 12.5px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* 旧版装饰元素：不再使用 */
.hero-deco, .blob { display: none; }

/* ============================================================
   7. 主布局
   ============================================================ */
.site-main { padding: 40px 0 72px; min-height: 60vh; }

.layout-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: start;
}
.content-area { min-width: 0; }

/* 列表头 */
.list-header { margin-bottom: 28px; }
.list-title {
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -.03em;
  margin: 8px 0 6px;
}
.list-sub { color: var(--muted); font-size: 13.5px; margin: 0; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 18px;
  color: var(--text);
}
.section-title svg { color: var(--accent); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb svg { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.breadcrumb-current { color: var(--text-2); }

/* ============================================================
   8. 按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease), transform .18s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }

.btn-ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text-2);
}
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 5px;
}
.link-btn:hover { text-decoration: underline; }

/* ============================================================
   9. 徽章与标签
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--pill);
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-category {
  background: var(--accent-soft);
  color: var(--accent);
  transition: background .16s var(--ease);
}
.badge-category:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.badge-pin { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: var(--bg-alt); color: var(--muted); }
.badge-status { background: var(--warn-bg); color: var(--warn); }

.tag-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 3px 10px;
  border-radius: var(--pill);
  transition: background .16s var(--ease), color .16s var(--ease);
  white-space: nowrap;
}
.tag-chip:hover { background: var(--accent-soft); color: var(--accent); }

/* ============================================================
   10. 文章卡片
   ============================================================ */
.post-list { display: grid; gap: 0; }

.post-card {
  position: relative;
  display: flex;
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity .2s var(--ease);
}
.post-card:first-child { padding-top: 4px; }
.post-card:last-child { border-bottom: 0; }

.post-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.post-card-cover {
  order: 2;
  flex: none;
  width: 200px;
  height: 132px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--line-2);
}
.post-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .55s var(--ease-out);
}
.post-card:hover .post-card-cover img { transform: scale(1.05); }

.post-card-top {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 11px;
}
.post-card.is-sticky .badge-pin { background: var(--warn-bg); }

.post-card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -.025em;
  margin: 0 0 9px;
}
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 2px;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.meta-item svg { opacity: .75; }
.meta-more {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: gap .18s var(--ease);
}
.meta-more:hover { gap: 7px; }

/* ============================================================
   11. 侧边栏
   ============================================================ */
.sidebar {
  display: grid;
  gap: 34px;
  min-width: 0;
}

.widget { min-width: 0; }

.widget-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.widget-title svg { color: var(--accent); opacity: .85; }

/* 搜索小部件 */
.widget-search { padding: 0; }
.widget-search-form {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.widget-search-form:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-softer);
}
.widget-search-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
}
.widget-search-form input::placeholder { color: var(--muted); }

/* 作者卡片 */
.widget-profile {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.profile-head { display: flex; align-items: center; gap: 12px; }
.profile-avatar {
  width: 48px; height: 48px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.profile-avatar-text {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 700;
  border: 0;
}
.profile-info { display: flex; flex-direction: column; min-width: 0; }
.profile-info strong { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.profile-role { font-size: 12px; color: var(--muted); }

.profile-bio {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-2);
  margin: 14px 0 0;
}
.profile-stats {
  display: flex;
  gap: 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  font-size: 12px;
  color: var(--muted);
}
.profile-stats span { display: inline-flex; align-items: baseline; gap: 4px; }
.profile-stats b {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 列表型小部件 */
.widget-list, .widget-posts, .widget-rank, .widget-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.widget-list > li { border-bottom: 1px solid var(--line-2); }
.widget-list > li:last-child { border-bottom: 0; }
.widget-list > li > a,
.widget-list > li.archive-year > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  color: var(--text-2);
  font-size: 14px;
  transition: color .16s var(--ease), padding-left .16s var(--ease);
}
.widget-list > li > a:hover { color: var(--accent); padding-left: 5px; }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count {
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-alt);
  padding: 1px 8px;
  border-radius: var(--pill);
  min-width: 26px;
  text-align: center;
}

.widget-sublist {
  list-style: none;
  margin: 0 0 6px;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--line);
}
.widget-sublist > li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 13px;
  transition: color .16s var(--ease);
}
.widget-sublist > li > a:hover { color: var(--accent); }

.widget-archives > li.archive-year > a { font-weight: 600; color: var(--text); }

/* 标签云 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: var(--text-2);
  background: var(--bg-alt);
  padding: 5px 11px;
  border-radius: var(--pill);
  line-height: 1.4;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.tag-cloud-item:hover { background: var(--accent); color: var(--accent-ink); }
.tag-cloud-item sup {
  font-size: .68em;
  opacity: .6;
  font-variant-numeric: tabular-nums;
}
.tag-sm { font-size: 12.5px; }
.tag-md { font-size: 13.5px; }
.tag-lg { font-size: 14.5px; font-weight: 500; }
.tag-xl { font-size: 15.5px; font-weight: 700; }

/* 最新文章 */
.widget-posts { display: grid; gap: 0; }
.widget-posts > li { border-bottom: 1px solid var(--line-2); }
.widget-posts > li:last-child { border-bottom: 0; }
.widget-posts a {
  display: block;
  padding: 9px 0;
  color: var(--text-2);
  transition: color .16s var(--ease);
}
.widget-posts a:hover { color: var(--accent); }
.wp-title {
  display: block;
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 3px;
}
.wp-date { display: block; font-size: 11.5px; color: var(--muted); }

/* 热门排行 */
.widget-rank { counter-reset: rank; display: grid; gap: 2px; }
.widget-rank > li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
}
.rank-num {
  flex: none;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.rank-1 { background: #ef4444; color: #fff; }
.rank-2 { background: #f97316; color: #fff; }
.rank-3 { background: #eab308; color: #fff; }
.widget-rank a {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  line-height: 1.55;
}
.widget-rank a:hover { color: var(--accent); }
.rank-views {
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

/* 友链小部件 */
.widget-links { display: flex; flex-wrap: wrap; gap: 6px; }
.widget-links a {
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg-alt);
  padding: 5px 11px;
  border-radius: var(--pill);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.widget-links a:hover { background: var(--accent-soft); color: var(--accent); }

/* ============================================================
   12. 分页
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.page-link:hover { border-color: var(--accent-line); color: var(--accent); }
.page-link.is-disabled {
  opacity: .45;
  pointer-events: none;
}
.page-arrow { transition: transform .2s var(--ease); }
.page-link:hover .page-arrow { transform: translateX(2px); }
.page-info {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pagination--numbers { justify-content: center; gap: 5px; }
.page-num {
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.page-num:hover { border-color: var(--accent-line); color: var(--accent); }
.page-num.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.page-ellipsis { color: var(--muted); padding: 0 4px; }

/* ============================================================
   13. 文章详情
   ============================================================ */
.post-single {
  max-width: 1000px;
  margin: 0 auto;
}

.post-header { margin-bottom: 34px; }
.post-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.26;
  letter-spacing: -.035em;
  margin: 14px 0 18px;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
/* 自定义头像图片：按容器尺寸裁切，避免变形 */
img.author-avatar, img.author-box-avatar { object-fit: cover; }
.author-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  flex: none;
}
.meta-edit { color: var(--accent); font-weight: 600; }
.meta-edit:hover { text-decoration: underline; }

.preview-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin: 18px 0 0;
}
.preview-banner a { margin-left: auto; font-weight: 600; text-decoration: underline; }

.post-cover {
  margin: 0 0 34px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-2);
}
.post-cover img { width: 100%; }

/* 正文 + 目录 */
.post-body-wrap {
  display: grid;
  gap: 44px;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 40px;
}
.post-toc-desktop { display: none; }

.toc { font-size: 13.5px; }
.toc-title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .06em;
  margin-bottom: 10px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.toc-list, .toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul { padding-left: 12px; border-left: 1px solid var(--line-2); }
.toc li { margin: 1px 0; }
.toc a {
  display: block;
  padding: 4px 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.55;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.toc a:hover { color: var(--text); background: var(--bg-alt); }
.toc a.is-active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

.toc-mobile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
}
.toc-mobile summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  color: var(--text-2);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile[open] summary { margin-bottom: 12px; }
/* summary 已经写了「目录」，隐藏目录组件自带的标题避免重复 */
.toc-mobile .toc-title { display: none; }

/* 文章底部 */
.post-footer { display: grid; gap: 26px; }

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

.post-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.like-btn, .action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .18s var(--ease), color .18s var(--ease),
              background .18s var(--ease), transform .18s var(--ease);
}
.like-btn:hover, .action-btn:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  transform: translateY(-1px);
}
.like-btn.is-liked {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}
html[data-theme="dark"] .like-btn.is-liked {
  background: #2a1113;
  border-color: #7f1d1d;
  color: #fca5a5;
}
.like-btn:disabled { cursor: default; }
.like-btn.is-liked:hover { transform: none; }
.like-btn.is-bump svg { animation: heartBump .4s var(--ease-out); }
@keyframes heartBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.32); }
  70%  { transform: scale(.94); }
  100% { transform: scale(1); }
}
.like-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.like-text { font-size: 13px; }

.author-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.author-box-avatar {
  width: 48px; height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 700;
}
.author-box-info { min-width: 0; }
.author-box-info strong { display: block; font-size: 15px; margin-bottom: 3px; }
.author-box-info p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }

/* 上下篇 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 34px;
}
.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
  min-width: 0;
}
a.post-nav-item:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.post-nav-next { text-align: right; align-items: flex-end; }
.post-nav-item.is-empty { opacity: .55; }
.pn-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
}
.post-nav-prev .pn-label svg { transform: rotate(180deg); }
.pn-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
a.post-nav-item:hover .pn-title { color: var(--accent); }

/* 相关文章 */
.related-posts { margin-top: 44px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.related-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
  min-width: 0;
}
.related-item:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.related-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.related-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-item:hover .related-title { color: var(--accent); }

/* 独立页面 */
.page-single { max-width: 100%; }

/* ============================================================
   14. Markdown 正文
   ============================================================ */
.markdown-body {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: -.025em;
  margin: 2em 0 .75em;
  scroll-margin-top: calc(var(--header-h) + 24px);
  position: relative;
}
.markdown-body h1 { font-size: 1.7em; }
.markdown-body h2 {
  font-size: 1.4em;
  padding-bottom: .35em;
  border-bottom: 1px solid var(--line);
}
.markdown-body h3 { font-size: 1.2em; }
.markdown-body h4 { font-size: 1.06em; }
.markdown-body h5, .markdown-body h6 { font-size: 1em; color: var(--text-2); }

.heading-anchor {
  position: absolute;
  left: -1.1em;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: var(--muted);
  font-weight: 400;
  transition: opacity .16s var(--ease);
}
.markdown-body h1:hover .heading-anchor,
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor,
.markdown-body h4:hover .heading-anchor { opacity: 1; }

.markdown-body p { margin: 0 0 1.3em; }

.markdown-body ul, .markdown-body ol { margin: 0 0 1.3em; padding-left: 1.5em; }
.markdown-body li { margin: .35em 0; }
.markdown-body li > ul, .markdown-body li > ol { margin: .35em 0; }

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

.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }
.markdown-body del { color: var(--muted); }

.markdown-body mark {
  background: color-mix(in srgb, #fbbf24 35%, transparent);
  color: inherit;
  padding: .1em .3em;
  border-radius: 4px;
}

.markdown-body blockquote {
  margin: 1.6em 0;
  padding: .2em 0 .2em 1.3em;
  border-left: 3px solid var(--accent-line);
  color: var(--text-2);
}
.markdown-body blockquote > *:last-child { margin-bottom: 0; }

.markdown-body hr { margin: 2.6em 0; }

/* 行内代码 */
.inline-code, .markdown-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--code-bg);
  border: 1px solid var(--line-2);
  padding: .12em .42em;
  border-radius: 5px;
  color: #b91c1c;
  word-break: break-word;
}
html[data-theme="dark"] .inline-code,
html[data-theme="dark"] .markdown-body :not(pre) > code { color: #fca5a5; }

/* 代码块 */
.code-block {
  margin: 1.7em 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
}
.code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .code-head { background: #1b1f27; }
.code-lang {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted);
  text-transform: uppercase;
}
.code-copy {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 5px;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.code-copy:hover { color: var(--accent); background: var(--accent-soft); }
.code-copy.is-done { color: var(--ok); }
.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.2px;
  line-height: 1.72;
  tab-size: 4;
  background: transparent;
}
.code-block pre code {
  font-family: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
}

/* 表格 */
.table-wrap {
  margin: 1.7em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.markdown-body th, .markdown-body td {
  padding: 10px 15px;
  text-align: left;
  border-bottom: 1px solid var(--line-2);
}
.markdown-body thead th {
  background: var(--panel-2);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.markdown-body tbody tr:last-child td { border-bottom: 0; }
.markdown-body tbody tr:hover { background: var(--panel-2); }

/* 任务列表 */
.task-list { list-style: none; padding-left: 0; }
.task-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.task-list input[type="checkbox"] {
  margin-top: .45em;
  flex: none;
  accent-color: var(--accent);
  width: 15px; height: 15px;
}

/* 图片 */
.md-image, .markdown-body img {
  margin: 1.8em auto;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  cursor: zoom-in;
}
.markdown-body figure { margin: 1.8em 0; }

/* ============================================================
   15. 评论区
   ============================================================ */
.comments-section { margin-top: 52px; }

.comment-total {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--pill);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.comment-form {
  display: grid;
  gap: 15px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 34px;
}
.comment-form-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.comment-form-head strong { font-size: 15px; }
.comment-form-head .link-btn { margin-left: auto; }

.comment-as { margin: 0; font-size: 13.5px; color: var(--muted); }
.comment-as strong { color: var(--text); }

.comment-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-label i { color: var(--danger); font-style: normal; }

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 14.5px;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.comment-form textarea { resize: vertical; min-height: 118px; line-height: 1.7; }
.comment-form input:focus, .comment-form textarea:focus {
  border-color: var(--accent-line);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-softer);
}

.comment-form-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.comment-tip { font-size: 12.5px; color: var(--muted); }
.comment-form-foot .btn { margin-left: auto; }

.comment-feedback { font-size: 13.5px; }
.comment-feedback.is-ok { color: var(--ok); }
.comment-feedback.is-error { color: var(--danger); }

.comment-closed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px 18px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 30px;
}

.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.comment-list { display: grid; gap: 0; }

.comment-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 46px 20px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.comment-empty p { margin: 0; font-size: 14px; }

.comment-item {
  display: flex;
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-2);
}
.comment-item:last-child { border-bottom: 0; }

.comment-avatar {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-avatar-text {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.comment-main { flex: 1; min-width: 0; }

.comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.comment-name { font-size: 14px; font-weight: 600; color: var(--text); }
.comment-name a { color: var(--text); }
.comment-name a:hover { color: var(--accent); }
.comment-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 1px;
}
.comment-client {
  font-size: 11.5px;
  color: var(--muted);
  padding: 1px 8px;
  border-radius: var(--pill, 999px);
  background: var(--bg-alt);
  white-space: nowrap;
}
.comment-time { font-size: 12px; color: var(--muted); margin-left: auto; }

.comment-content {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.comment-content > *:last-child { margin-bottom: 0; }
.comment-content p { margin: 0 0 .7em; }
.comment-content code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--code-bg);
  padding: .1em .38em;
  border-radius: 4px;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
}
.reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.reply-btn:hover { color: var(--accent); background: var(--accent-soft); }
.comment-floor { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.comment-children {
  margin-top: 6px;
  padding-left: 18px;
  border-left: 2px solid var(--line-2);
}
.comment-children .comment-item:last-child { padding-bottom: 0; }

/* ============================================================
   16. 归档页
   ============================================================ */
.archive-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.archive-nav-item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.archive-nav-item:hover { border-color: var(--accent-line); color: var(--accent); }
.archive-nav-item span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.archive-year-block { margin-bottom: 40px; }
.archive-year-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  font-size: 15px;
}
.archive-year-num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.archive-year-line { flex: 1; height: 1px; background: var(--line); }

.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.archive-item:last-child { border-bottom: 0; }
.archive-date {
  flex: none;
  width: 46px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.archive-link {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}
.archive-link:hover { color: var(--accent); }
.archive-meta { flex: none; }
.archive-cat {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 2px 9px;
  border-radius: var(--pill);
}
.archive-cat:hover { background: var(--accent-soft); color: var(--accent); }

.archive-months { margin-top: 46px; }
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 9px;
}
.month-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.month-chip:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.month-chip b {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.month-chip span { font-size: 11.5px; color: var(--muted); }

/* ============================================================
   17. 友链页
   ============================================================ */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 12px;
}
.link-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
  min-width: 0;
}
.link-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.link-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.link-card-head strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-external { margin-left: auto; color: var(--muted); flex: none; }
.link-logo {
  width: 36px; height: 36px;
  flex: none;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--line-2);
}
.link-logo-text {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  border: 0;
}
.link-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.link-host { font-size: 11.5px; color: var(--muted); }

.friend-apply {
  margin-top: 44px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.friend-apply p { margin: 0; font-size: 14.5px; line-height: 1.75; color: var(--text-2); }

/* ============================================================
   18. 空状态与错误页
   ============================================================ */
.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 68px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--muted);
  margin-bottom: 8px;
}
.empty-state h3 { font-size: 17px; margin: 0; }
.empty-state p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

.error-page {
  max-width: 620px;
  margin: 0 auto;
  padding: 60px 0 40px;
  text-align: center;
}
.error-code {
  font-size: clamp(72px, 16vw, 132px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.06em;
  color: transparent;
  -webkit-text-stroke: 2px var(--line);
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.error-title { font-size: 24px; margin: 0 0 10px; letter-spacing: -.03em; }
.error-desc { color: var(--muted); font-size: 15px; margin: 0 0 26px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.error-recent {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.error-recent h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 12px;
}
.error-recent ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}
.error-recent a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.error-recent a:hover { background: var(--bg-alt); color: var(--accent); }

/* 杂项 */
.note {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.is-empty { opacity: .55; }

/* ============================================================
   19. 页脚
   ============================================================ */
.site-footer {
  /* 半透明，让底部光晕透一点出来，和整页更连贯 */
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-top: 1px solid var(--line);
  margin-top: 40px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 52px 0 40px;
}
.footer-about { min-width: 0; }
.footer-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}
.footer-about p {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.75;
  max-width: 320px;
}
.footer-social { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-social a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--bg-alt);
  padding: 6px 12px;
  border-radius: var(--pill);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.footer-social a:hover { background: var(--accent-soft); color: var(--accent); }

.footer-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.footer-col h4 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 4px;
}
.footer-col a {
  font-size: 13.5px;
  color: var(--text-2);
  transition: color .16s var(--ease);
  width: fit-content;
}
.footer-col a:hover { color: var(--accent); }

/* 页脚分类：父分类 + 子分类（缩进） */
.footer-cats,
.footer-cats-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.footer-cats > li { min-width: 0; }
.footer-cats-sub {
  margin: 7px 0 2px 3px;
  padding-left: 11px;
  border-left: 1px solid var(--line);
  gap: 6px;
}
.footer-cat-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
}
.footer-cat-link > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.footer-cat-count {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 0 6px;
  border-radius: var(--pill);
  flex: none;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.footer-cat-link:hover .footer-cat-count { background: var(--accent-soft); color: var(--accent); }

/* 页脚标签：换行的小标签块（标签数量不设上限，靠换行消化） */
.footer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.footer-tags a {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  width: auto;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-2);
  background: var(--bg-alt);
  padding: 4px 10px;
  border-radius: var(--pill);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.footer-tags a:hover { background: var(--accent); color: var(--accent-ink); }
.footer-tags sup {
  font-size: .68em;
  opacity: .6;
  font-variant-numeric: tabular-nums;
}

.footer-bottom {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px;
  color: var(--muted);
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--accent); }
.footer-meta { margin-left: auto; }

/* ============================================================
   20. 回到顶部
   ============================================================ */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
  animation: popIn .28s var(--ease-out);
}
.back-to-top:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-3px); }
@keyframes popIn {
  from { opacity: 0; transform: scale(.8) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   21. 滚动入场动画
   ============================================================ */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ============================================================
   22. 图片灯箱
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 10, 14, .93);
  display: grid;
  place-items: center;
  padding: 40px;
  cursor: zoom-out;
  animation: fadeIn .22s var(--ease);
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  animation: zoomIn .28s var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   23. 跨页过渡（View Transitions）
   ------------------------------------------------------------
   关键：三个光团必须**各自**命名。
   如果只给整层 .aurora 命名，新旧两页的容器都是全屏、几何完全一致，
   浏览器只能做交叉淡入 —— 看起来就是「两张图片在换」。
   分别命名后，每个光团的位移 / 尺寸 / 透明度会被独立插值，
   光才是真的从上一页的位置滑到这一页的位置。
   ============================================================ */
@view-transition { navigation: auto; }

.aurora-blob--1 { view-transition-name: aurora-1; }
.aurora-blob--2 { view-transition-name: aurora-2; }
.aurora-blob--3 { view-transition-name: aurora-3; }

/* 光团：时长拉长、缓动放缓，让「移动」这个动作被看清楚。
   注意：具名 group 默认排在 root group 之后，也就是**盖在正文上面**。
   试过给它们 z-index:-1，结果是被不透明的页面快照完全遮住（更糟），
   所以这里改用「让光团自身在过渡期间保持低透明度」来避免糊住文字，
   见下面的 old/new 规则。 */
::view-transition-group(aurora-1),
::view-transition-group(aurora-2),
::view-transition-group(aurora-3) {
  animation-duration: .9s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}
::view-transition-old(aurora-1), ::view-transition-new(aurora-1),
::view-transition-old(aurora-2), ::view-transition-new(aurora-2),
::view-transition-old(aurora-3), ::view-transition-new(aurora-3) {
  animation-duration: .9s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}

/* 内容：旧页轻微上移淡出，新页从下方淡入，比光团快，先落位 */
::view-transition-old(root) { animation: vtOut .26s var(--ease) both; }
::view-transition-new(root) { animation: vtIn .4s var(--ease-out) both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vtIn  { from { opacity: 0; transform: translateY(14px); } }

/* 顶栏在两页里位置一致，单独命名让它原地不动，不跟着内容一起滑 */
.site-header { view-transition-name: site-header; }
::view-transition-group(site-header) { animation-duration: .3s; }

/* ============================================================
   24. 响应式
   ============================================================ */

/* 正文 + 粘性目录 */
@media (min-width: 1120px) {
  .post-body-wrap {
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: 48px;
  }
  .post-toc-desktop {
    display: block;
    order: 2;
    position: sticky;
    top: calc(var(--header-h) + 26px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 52px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .toc-mobile { display: none; }
}

/* 独立页面：正文区本身已被侧边栏压缩，不再并排目录，
   改回折叠式目录，避免正文被挤到 500px 以下 */
@media (min-width: 1120px) {
  .page-single .post-body-wrap { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .page-single .post-toc-desktop { display: none; }
  .page-single .toc-mobile { display: block; }
}

/* 侧边栏收起 */
@media (max-width: 1080px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
    gap: 44px;
  }
  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 34px;
  }
  .widget-search, .widget-profile { grid-column: span 1; }
  .post-toc-desktop { display: none; }
}

/* 中等宽度：导航还是单行、还要显示下拉，靠收紧间距把它塞进去，避免撑出横向滚动条 */
@media (min-width: 861px) and (max-width: 1120px) {
  .main-nav { margin-left: 6px; gap: 0; }
  .nav-link { padding: 7px 8px; font-size: 13px; }
  .nav-link.active::after { left: 8px; right: 8px; }
  .nav-more-btn { font-size: 13px; }
  .header-inner { gap: 12px; }
  /* 这一档一行放不下：把「独立页面」和「友链」从导航里收起（页脚都有），
     保证分类不会挤到右侧按钮上去 */
  .main-nav .nav-page,
  .main-nav .nav-links { display: none; }
}

/* 移动端导航 */
@media (max-width: 860px) {
  .main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 12px 16px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s var(--ease), transform .24s var(--ease-out);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    z-index: 89;
  }
  .main-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-link { padding: 11px 14px; font-size: 15px; border-radius: var(--radius-sm); }
  .nav-link.active::after { display: none; }
  .nav-link.active { background: var(--accent-soft); }

  /* 抽屉里不做悬浮下拉，子分类直接平铺展开（手指点不到 hover） */
  .nav-item { display: block; }
  .nav-item:hover .nav-caret { transform: none; }
  .nav-caret { display: none; }
  .nav-drop {
    position: static;
    min-width: 0;
    padding: 0 0 4px 14px;
    margin: 0 0 2px 12px;
    gap: 0;
    background: transparent;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav-drop a { padding: 9px 12px; font-size: 14.5px; }
  .nav-toggle { display: grid; }

  .hero { padding: 46px 0 40px; }
  .hero-stats { gap: 0; }
  .hero-stat { padding-right: 24px; margin-right: 24px; }
  .hero-stat b { font-size: 24px; }

  .post-card { gap: 18px; }
  .post-card-cover { width: 156px; height: 108px; }
  .post-card-title { font-size: 18px; }

  .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px; padding: 42px 0 32px; }
  .footer-about { grid-column: span 2; }

  .comment-fields { grid-template-columns: 1fr 1fr; }
  .comment-fields .field:last-child { grid-column: span 2; }

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

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .container { padding: 0 18px; }
  .brand-text em { display: none; }
  .header-inner { gap: 10px; }
  .main-nav { margin-left: 0; }

  .hero { padding: 38px 0 34px; }
  .hero-title { letter-spacing: -.03em; }
  .hero-tagline { font-size: 15.5px; }
  .hero-stat { padding-right: 18px; margin-right: 18px; }
  .hero-stat b { font-size: 21px; }

  .site-main { padding: 28px 0 56px; }
  .list-title { font-size: 23px; }

  .post-card { flex-direction: column; gap: 14px; padding: 22px 0; }
  .post-card-cover { order: -1; width: 100%; height: 168px; }
  .post-card-title { font-size: 17.5px; }
  .post-card-meta { gap: 12px; font-size: 12px; }
  .meta-more { margin-left: 0; width: 100%; }

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

  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; align-items: flex-start; }

  .comment-form { padding: 16px; }
  .comment-fields { grid-template-columns: 1fr; }
  .comment-fields .field:last-child { grid-column: span 1; }
  .comment-form-foot .btn { margin-left: 0; width: 100%; }
  .comment-children { padding-left: 10px; }
  .comment-avatar { width: 34px; height: 34px; }

  .markdown-body { font-size: 15.8px; }
  .markdown-body h2 { font-size: 1.28em; }
  .code-block pre { font-size: 12.4px; padding: 13px 14px; }

  .archive-item { flex-wrap: wrap; gap: 8px; }
  .archive-date { width: auto; }
  .archive-link { flex: 1 1 100%; order: -1; }
  .month-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }

  .footer-inner { grid-template-columns: 1fr; padding: 36px 0 26px; }
  .footer-about { grid-column: span 1; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer-meta { margin-left: 0; }

  .back-to-top { right: 16px; bottom: 16px; width: 40px; height: 40px; }
  .pagination { gap: 8px; }
  .page-link { padding: 8px 13px; font-size: 13px; }

  /* 小屏：光团缩小，并把位置往外推，避免糊在正文上 */
  .aurora-blob--1 { --size: min(76vmax, 440px); }
  .aurora-blob--2 { --size: min(62vmax, 350px); }
  .aurora-blob--3 { --size: min(50vmax, 290px); }
  .page-home .aurora-blob--1 { --x: 86%; --y: 1%; }
  .page-home .aurora-blob--2 { --x: 100%; --y: 15%; }
  .page-home .aurora-blob--3 { --x: 66%; --y: 23%; }
  .page-post .aurora-blob--1 { --x: 0%;  --y: 1%; }
  .page-post .aurora-blob--2 { --x: 100%; --y: 42%; }
  .page-post .aurora-blob--3 { --x: 12%; --y: 86%; }
  .page-archive .aurora-blob--1,
  .page-category .aurora-blob--1,
  .page-tag .aurora-blob--1,
  .page-search .aurora-blob--1 { --x: 0%; --y: 0%; }
  .page-archive .aurora-blob--2,
  .page-category .aurora-blob--2,
  .page-tag .aurora-blob--2,
  .page-search .aurora-blob--2 { --x: 100%; --y: 6%; }
  .page-archive .aurora-blob--3,
  .page-category .aurora-blob--3,
  .page-tag .aurora-blob--3,
  .page-search .aurora-blob--3 { --x: 54%; --y: 30%; }
  .page-page .aurora-blob--1,
  .page-links .aurora-blob--1 { --x: 96%; --y: 74%; }
  .page-page .aurora-blob--2,
  .page-links .aurora-blob--2 { --x: 4%; --y: 38%; }
  .page-page .aurora-blob--3,
  .page-links .aurora-blob--3 { --x: 48%; --y: 99%; }
}

/* ============================================================
   25. 无障碍：减少动画
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  /* 光晕保留静态存在，但不再波动 */
  .aurora-blob { animation: none !important; transform: none; }
}

/* ============================================================
   26. 打印
   ============================================================ */
@media print {
  .site-header, .site-footer, .sidebar, .comments-section,
  .post-actions, .post-nav, .related-posts, .back-to-top,
  .reading-progress, .search-panel, .toc-mobile, .toc,
  .post-toc-desktop, .aurora { display: none !important; }
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .post-body-wrap { grid-template-columns: 1fr; }
  .post-single { max-width: 100%; }
  body { background: #fff; color: #000; }
  .markdown-body { font-size: 12pt; }
  .post-title { font-size: 20pt; }
  a { text-decoration: none; color: #000; }
}
