/* ==========================================================================
   blog · wym — 极简纸感博客
   风格参考：yohaku-blog-template（留白 × 蓝色强调 × 弹簧动效）
   配色：白纸底 · 墨字 · 一抹蓝
   ========================================================================== */

:root {
  --paper:       #fefdfa;   /* 底色 */
  --paper-2:     #f5f4f1;   /* 纸·深（代码块、卡片） */
  --ink:         #1c1c1e;   /* 主文字 */
  --ink-2:       #4a4a4f;   /* 次级文字 */
  --muted:       #8e8e93;   /* 弱文字 */
  --faint:       #b5b5ba;   /* 更弱 */
  --line:        #e5e5e7;   /* 界线 */
  --line-2:      #efefef;   /* 界线·更浅 */
  --accent:      oklch(0.55 0.15 250);   /* 强调蓝 */
  --accent-2:    #3b82f6;   /* 强调·亮（图标、行内代码） */
  --selection:   rgba(59, 130, 246, 0.14);

  --serif: "Fraunces", "Noto Serif SC", "Songti SC", "Source Han Serif SC",
           "STSong", "SimSun", serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --col:   56rem;                    /* 正文栏宽（较宽，阅读不拥挤） */
  --gutter: clamp(20px, 5vw, 48px);
  --ease:  cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  --paper:       #121214;
  --paper-2:     #1c1c1f;
  --ink:         #ececf0;
  --ink-2:       #b6b6bc;
  --muted:       #8e8e93;
  --faint:       #5b5b60;
  --line:        #2a2a2e;
  --line-2:      #242427;
  --accent:      oklch(0.72 0.14 250);
  --accent-2:    #60a5fa;
  --selection:   rgba(96, 165, 250, 0.22);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16.5px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

::selection { background: var(--selection); color: var(--ink); }

img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; }

/* 纸面颗粒感（固定于背景，不遮挡交互） */
.paper-noise {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none; opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.shell { position: relative; z-index: 1; max-width: var(--col); margin: 0 auto; padding: 0 var(--gutter); }

/* 详情页更宽：正文 + 右侧目录都要有位置 */
.page-post .shell { max-width: 68rem; }

/* ==========================================================================
   顶栏
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom-color: var(--line-2);
}
.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 0;
}
.brand .wordmark {
  font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); transition: color 0.25s var(--ease);
}
.brand:hover .wordmark { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em;
  color: var(--muted); padding: 7px 12px; border-radius: 8px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::before { content: "·"; font-weight: 700; margin-right: 5px; }

.theme-btn {
  width: 32px; height: 32px; margin-left: 6px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--muted);
  transition: all 0.3s var(--ease);
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); transform: rotate(8deg); }
.theme-btn .sun { display: none; }
.theme-btn .moon { display: block; }
[data-theme="dark"] .theme-btn .sun { display: block; }
[data-theme="dark"] .theme-btn .moon { display: none; }

/* ==========================================================================
   首页 Hero
   ========================================================================== */
.hero { padding: clamp(64px, 10vw, 110px) 0 clamp(40px, 6vw, 56px); }
.hero .kicker {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.15;
  margin-bottom: 20px;
}
.hero h1 .cn { display: block; }
.hero h1 .en {
  display: block; margin-top: 8px;
  font-family: var(--mono); font-size: 0.4em; font-weight: 400;
  letter-spacing: 0.4em; color: var(--muted); text-transform: uppercase;
}
.hero .lede {
  font-size: 1.02rem; color: var(--ink-2);
  max-width: 44ch; line-height: 1.9; margin-bottom: 30px;
}
.hero .lede b { font-weight: 600; color: var(--accent); }
.hero-stats {
  display: flex; gap: clamp(24px, 5vw, 48px);
  font-family: var(--mono); font-size: 0.74rem; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 22px;
}
.hero-stats > div { display: flex; align-items: baseline; gap: 5px; }
.hero-stats b { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--ink); }

/* ==========================================================================
   区块标题
   ========================================================================== */
.section { padding: clamp(30px, 5vw, 44px) 0; border-top: 1px solid var(--line); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: clamp(18px, 3vw, 26px);
}
.section-head h2 {
  font-family: var(--mono); font-size: 0.76rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2);
}
.section-head h2 .zh {
  font-family: var(--serif); font-size: 1.05rem; letter-spacing: 0.06em;
  text-transform: none; font-weight: 600; color: var(--ink); margin-right: 10px;
}
.section-head .more {
  font-family: var(--mono); font-size: 0.74rem; color: var(--muted);
  transition: color 0.25s var(--ease);
}
.section-head .more:hover { color: var(--accent); }
.section-head .more::after { content: " →"; }

/* ==========================================================================
   文章列表行（日期在上，标题与摘要，Read more）
   ========================================================================== */
.post-list { display: flex; flex-direction: column; }
.post-row {
  position: relative;   /* 让标题上的覆盖层铺满整行，点击范围更大 */
  display: grid; grid-template-columns: 120px 1fr; gap: clamp(16px, 3vw, 28px);
  padding: clamp(18px, 3vw, 24px) 0;
  border-bottom: 1px solid var(--line-2);
  transition: padding-left 0.45s var(--spring);
}
.post-row:last-child { border-bottom: none; }
.post-row:hover { padding-left: 10px; }
.post-row .p-date {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--muted); padding-top: 6px;
}
.post-row .p-meta { margin-bottom: 8px; }
.post-row .p-cat {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
}

/* 所属文件夹小标签（首页 / 详情页） */
.p-folder {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px; margin-right: 8px;
  transition: all 0.25s var(--ease);
}
.p-folder::before { content: "▸"; font-size: 0.7em; color: var(--accent); }
.p-folder:hover { color: var(--accent); border-color: var(--accent); }
.post-head .p-folder { margin: 0 0 14px; }
.post-row h3 {
  font-size: clamp(1.12rem, 2.4vw, 1.32rem); font-weight: 600;
  line-height: 1.42; letter-spacing: 0.005em;
  transition: color 0.3s var(--ease);
}
.post-row:hover h3 { color: var(--accent); }
.post-row h3 a::after { content: ""; position: absolute; inset: 0; }
.post-row .p-excerpt {
  margin-top: 7px; color: var(--muted);
  font-size: 0.92rem; line-height: 1.78; max-width: 58ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-row .p-readmore {
  margin-top: 10px; font-family: var(--mono); font-size: 0.72rem;
  color: var(--faint); letter-spacing: 0.06em;
  transition: color 0.3s var(--ease);
}
.post-row .p-readmore::after { content: " →"; }
.post-row:hover .p-readmore { color: var(--accent); }

/* 随手记 */
.thoughts { list-style: none; }
.thoughts li {
  border-left: 2px solid var(--line);
  padding: 4px 0 4px 20px; margin-bottom: 26px;
  transition: border-color 0.4s var(--ease), padding-left 0.45s var(--spring);
}
.thoughts li:hover { border-color: var(--accent); padding-left: 26px; }
.thoughts p { font-size: 0.95rem; line-height: 1.85; color: var(--ink-2); }
.thoughts time { font-family: var(--mono); font-size: 0.68rem; color: var(--faint); display: block; margin-top: 7px; }

/* ==========================================================================
   页脚
   ========================================================================== */
.site-footer {
  margin-top: clamp(40px, 7vw, 72px);
  border-top: 1px solid var(--line);
  padding: clamp(28px, 4vw, 40px) 0;
}
.foot-row {
  display: flex; flex-direction: column; gap: 20px;
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
}
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); transition: color 0.25s var(--ease); }
.foot-links a:hover { color: var(--accent); }
.foot-note {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border-top: 1px dashed var(--line-2); padding-top: 18px;
}

/* ==========================================================================
   归档页
   ========================================================================== */
.page-head { padding: clamp(48px, 7vw, 76px) 0 clamp(26px, 4vw, 36px); }
.page-head h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.4rem); font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 14px;
}
.page-head h1 .zh-sub { font-family: var(--mono); font-size: 0.62em; font-weight: 400; color: var(--faint); letter-spacing: 0.28em; }
.page-head .sub { margin-top: 10px; color: var(--muted); font-size: 0.88rem; }
.page-head .sub b { color: var(--accent); font-weight: 600; }
.page-head .sub a { color: var(--accent); }

.layout-2col {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px;
  gap: clamp(30px, 6vw, 64px); align-items: start;
}
@media (max-width: 860px) { .layout-2col { grid-template-columns: 1fr; } }

.archive-main { min-width: 0; }

/* 搜索 + 标签筛选 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.search-box {
  flex: 1 1 200px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; background: var(--paper-2);
  transition: border-color 0.3s var(--ease);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box .s-icon { color: var(--faint); font-size: 0.8rem; }
.search-box input {
  flex: 1; border: none; outline: none; background: none;
  font-family: var(--mono); font-size: 0.84rem; color: var(--ink);
}
.search-box input::placeholder { color: var(--faint); }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; transition: all 0.3s var(--ease);
}
.tag-chip:hover { color: var(--accent); border-color: var(--accent); }
.tag-chip.on { background: var(--accent); border-color: var(--accent); color: var(--paper); }

/* 分类分组（文件夹） */
.folder-block { margin-bottom: clamp(30px, 5vw, 44px); }

/* 归档页视图切换过渡：渲染层切换时防内容瞬移（200ms 淡入 + 轻微上移，只动 transform/opacity） */
.arc-switch { animation: arc-in 0.2s var(--ease); }
@keyframes arc-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.folder-title {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600;
  color: var(--ink); display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.folder-title b { font-weight: 600; }
.folder-title .sep { color: var(--faint); margin: 0 2px; font-family: var(--mono); font-weight: 400; }
.folder-title .count {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 400;
  color: var(--accent); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 9px;
}
.folder-title .fpath { display: inline-flex; align-items: baseline; gap: 2px; min-width: 0; }
.folder-title .more {
  margin-left: auto;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 400;
  color: var(--muted); transition: color 0.25s var(--ease);
}
.folder-title .more:hover { color: var(--accent); }
.folder-toggle {
  flex-shrink: 0; width: 24px; height: 24px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px;
  color: var(--muted); font-size: 0.72rem; line-height: 1;
  transition: all 0.25s var(--ease), transform 0.3s var(--spring);
}
.folder-toggle:hover { color: var(--accent); border-color: var(--accent); }
.folder-block[data-collapsed] .folder-toggle { transform: rotate(-90deg); }
/* 展开/收起动画：grid-rows 1fr→0fr 平滑过渡高度 */
.folder-body {
  display: grid; grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.4s var(--ease), opacity 0.25s var(--ease);
}
.folder-body-inner { overflow: hidden; min-height: 0; }
.folder-block[data-collapsed] .folder-body { grid-template-rows: 0fr; opacity: 0; }
/* 嵌套分类区块（父目录下再放子目录，用左边线示意层级） */
.folder-body .folder-node { margin: 14px 0 4px; padding-left: 16px; border-left: 1px solid var(--line-2); }
.folder-body .folder-node .folder-title { font-size: 1.02rem; }

/* 展开 / 收起全部 */
.fold-actions { display: flex; gap: 8px; margin: 0 0 18px; }
.fold-btn {
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; transition: all 0.25s var(--ease);
}
.fold-btn:hover { color: var(--accent); border-color: var(--accent); }

/* 归档分页 */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; margin: 4px 0 14px;
  font-family: var(--mono); font-size: 0.74rem; color: var(--muted);
}
.pager .pg {
  color: var(--muted); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; transition: all 0.25s var(--ease);
}
.pager .pg:hover { color: var(--accent); border-color: var(--accent); }
.pager .pg[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.pager .pg-info { color: var(--faint); }

/* 年度分组 */
.year-block { margin-bottom: clamp(30px, 5vw, 44px); }
.year-title {
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.16em;
  color: var(--muted); display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px;
}
.year-title b { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); letter-spacing: 0; }
.year-title .count {
  font-size: 0.68rem; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px;
}
.arc-row {
  position: relative;   /* 标题覆盖层铺满整行 */
  display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px dashed var(--line-2);
  transition: padding-left 0.4s var(--spring);
}
.arc-row:hover { padding-left: 8px; }
.arc-row .d { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.arc-row .t { font-size: 0.98rem; line-height: 1.5; }
.arc-row .t a { transition: color 0.25s var(--ease); }
.arc-row .t a::after { content: ""; position: absolute; inset: 0; }
.arc-row .t a:hover { color: var(--accent); }

/* 侧栏 */
.archive-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 28px; }
.side-card { border: 1px solid var(--line-2); border-radius: 12px; background: var(--paper-2); padding: 20px; }
.side-card h3 {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 14px;
}
.side-card .who { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.side-card p { font-size: 0.84rem; color: var(--muted); line-height: 1.8; }
.side-card .side-link {
  display: block; font-family: var(--mono); font-size: 0.76rem;
  color: var(--ink-2); padding: 8px 0; border-bottom: 1px dashed var(--line-2);
  transition: color 0.25s var(--ease);
}
.side-card .side-link:last-child { border-bottom: none; }
.side-card .side-link:hover { color: var(--accent); }
.side-card .side-link.on { color: var(--accent); }
.side-card .side-link span { float: right; color: var(--faint); }

/* 侧栏分类树（可折叠子级） */
.folder-tree { list-style: none; margin-top: 2px; }
.folder-tree ul { list-style: none; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line-2); }
.folder-tree li { display: flex; flex-wrap: wrap; align-items: center; }
/* 子树折叠：grid-rows 1fr→0fr（inner 包裹层承载溢出裁剪），内容再多也不会被写死的高度截断 */
.folder-tree li > .tree-sub {
  flex-basis: 100%;
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.3s var(--ease), opacity 0.25s var(--ease);
}
.folder-tree li > .tree-sub > .tree-sub-inner { overflow: hidden; min-height: 0; }
.folder-tree li.folded > .tree-sub { grid-template-rows: 0fr; opacity: 0; }
.folder-tree li > a { flex: 1 1 auto; min-width: 0; }
.folder-tree a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 0.76rem;
  color: var(--ink-2); padding: 7px 0; border-bottom: 1px dashed var(--line-2);
  transition: color 0.25s var(--ease);
}
.folder-tree a:hover { color: var(--accent); }
.folder-tree a.on { color: var(--accent); }
.folder-tree a span { color: var(--faint); font-size: 0.68rem; }
.tree-fold {
  flex-shrink: 0; width: 20px; height: 20px; margin-right: 4px;
  display: inline-grid; place-items: center;
  color: var(--faint); font-size: 0.64rem; line-height: 1;
  border: 1px solid var(--line-2); border-radius: 5px;
  transition: all 0.25s var(--ease), transform 0.3s var(--spring);
}
.tree-fold:hover { color: var(--accent); border-color: var(--accent); }
.folder-tree li.folded > .tree-fold { transform: rotate(-90deg); }

/* ==========================================================================
   文章页
   ========================================================================== */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  pointer-events: none;
}
.read-progress i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
}

.post-head {
  padding: clamp(40px, 6vw, 64px) 0 clamp(24px, 4vw, 34px);
  max-width: 47.75rem;   /* 与正文列对齐，标题下的分割线不再超长 */
}
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.76rem; color: var(--muted);
  margin-bottom: 26px; transition: color 0.25s var(--ease), gap 0.3s var(--ease);
}
.back-link:hover { color: var(--accent); gap: 12px; }
.post-head .p-cat {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px; display: block;
}
.post-head h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  font-weight: 600; line-height: 1.28; letter-spacing: -0.01em; margin-bottom: 18px;
}
.post-head .meta {
  display: flex; flex-wrap: wrap; gap: 18px;
  font-family: var(--mono); font-size: 0.74rem; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 20px;
}
.post-head .meta .d { color: var(--accent); }

.post-body-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 180px;
  gap: clamp(24px, 4vw, 48px); align-items: start;
}
.post-body-layout.no-toc { grid-template-columns: 1fr; }
@media (max-width: 900px) { .post-body-layout { grid-template-columns: 1fr; } }

.post-content { min-width: 0; padding-bottom: clamp(30px, 5vw, 48px); }

/* TOC（侧栏目录，让正文更宽） */
.toc { position: sticky; top: 92px; display: none; }
@media (min-width: 901px) { .toc { display: block; } }
.toc .toc-title {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 14px;
}
.toc nav { border-left: 1px solid var(--line); padding-left: 14px; }
.toc a {
  display: block; font-size: 0.8rem; line-height: 1.5; color: var(--muted);
  padding: 4px 0; transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.toc a.sub { padding-left: 12px; font-size: 0.76rem; }
.toc a.sub2 { padding-left: 24px; font-size: 0.72rem; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--accent); transform: translateX(3px); }
.toc a.sub.on, .toc a.sub2.on { transform: translateX(3px); }

/* 正文排版 */
.prose { font-size: 1.0rem; line-height: 2.05; }
.prose > * + * { margin-top: 1.35rem; }
.prose h2 {
  font-size: 1.32rem; font-weight: 600; letter-spacing: 0.01em;
  margin-top: 2.6rem; margin-bottom: -0.4rem; scroll-margin-top: 90px;
}
.prose h3 {
  font-size: 1.12rem; font-weight: 600; margin-top: 2rem; scroll-margin-top: 90px;
}
.prose h4 { font-size: 1.0rem; font-weight: 600; margin-top: 1.6rem; color: var(--ink-2); scroll-margin-top: 90px; }
.prose h5 { font-size: 0.95rem; font-weight: 600; margin-top: 1.5rem; color: var(--ink-2); }
.prose h6 { font-size: 0.9rem; font-weight: 600; margin-top: 1.4rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.03em; }
.prose p { color: var(--ink); }
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s var(--ease);
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose mark { background: rgba(255, 208, 0, 0.4); color: inherit; padding: 0 0.15em; border-radius: 3px; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 20px; color: var(--ink-2);
  font-style: italic; font-size: 0.97em;
}
.prose blockquote p { color: inherit; }
.prose hr { border: none; border-top: 1px dashed var(--line); margin: 2.8rem 0; }
.prose img {
  display: block; margin: 1.6rem auto; cursor: zoom-in;
  max-width: min(100%, 520px); max-height: 70vh;
  border-radius: 10px; border: 1px solid var(--line);
  box-shadow: 0 2px 14px rgba(28, 28, 30, 0.06);
}
.prose figcaption, .prose img + em {
  display: block; text-align: center; font-size: 0.78rem; color: var(--muted);
  font-style: normal; margin-top: -8px;
}
.prose code {
  font-family: var(--mono); font-size: 0.82em;
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 5px;
  padding: 1px 6px; color: var(--accent-2);
}
[data-theme="dark"] .prose code { color: var(--accent); }
.prose pre {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.75;
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 18px 20px; overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; color: var(--ink); font-size: 1em; }

/* 代码块复制按钮 */
.prose .code-block { position: relative; }
.prose .code-block .copy-btn {
  position: absolute; top: 10px; right: 12px;
  font-family: var(--mono); font-size: 0.7rem; line-height: 1;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 10px; cursor: pointer;
  opacity: 0; transition: opacity 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.prose .code-block:hover .copy-btn,
.prose .code-block .copy-btn:focus-visible,
.prose .code-block .copy-btn.done { opacity: 1; }
.prose .code-block .copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.prose .code-block .copy-btn.done { color: #16a34a; border-color: #16a34a; }
@media (hover: none) { .prose .code-block .copy-btn { opacity: 1; } }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.82rem; margin: 1.8rem 0; cursor: zoom-in; }
@media (max-width: 900px) { .prose table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.prose th { color: var(--ink-2); font-weight: 500; border-bottom-width: 2px; }
.prose tr:last-child td { border-bottom: none; }

/* KaTeX 居中与配色微调 */
.prose .katex-display { margin: 1.8rem 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.prose .katex { font-size: 1.06em; }

/* Obsidian callout */
.callout {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--paper-2);
  padding: 14px 18px;
  margin: 1.4rem 0;
}
.callout > * + * { margin-top: 0.55rem; }
.callout .callout-title {
  font-weight: 600; font-size: 0.95rem;
  display: flex; align-items: center; gap: 8px;
}
.callout .callout-title::before { content: ""; }
.callout.is-collapsible .callout-title { cursor: pointer; user-select: none; }
.callout.is-collapsible .callout-title::after { content: "▾"; margin-left: auto; opacity: 0.55; }
.callout.is-collapsible.is-collapsed .callout-title::after { content: "▸"; }
.callout.is-collapsible.is-collapsed > *:not(.callout-title) { display: none; }

/* 技术附录 detail：虚线弱化样式，默认折叠，与正文明显区分 */
.callout-detail {
  border: 1px dashed var(--line-2);
  border-left: 3px dashed var(--muted);
  background: transparent;
  font-size: 0.92rem;
}
.callout-detail .callout-title { color: var(--muted); }
.callout p { color: var(--ink-2); }
.callout-note, .callout-info, .callout-tldr { border-left-color: #3b82f6; }
.callout-note .callout-title, .callout-info .callout-title, .callout-tldr .callout-title { color: #3b82f6; }
.callout-tip, .callout-success, .callout-check { border-left-color: #22c55e; }
.callout-tip .callout-title, .callout-success .callout-title, .callout-check .callout-title { color: #16a34a; }
.callout-warning, .callout-caution, .callout-important { border-left-color: #f59e0b; }
.callout-warning .callout-title, .callout-caution .callout-title, .callout-important .callout-title { color: #d97706; }
.callout-danger, .callout-error, .callout-fail { border-left-color: #ef4444; }
.callout-danger .callout-title, .callout-error .callout-title, .callout-fail .callout-title { color: #dc2626; }
.callout-question, .callout-help, .callout-faq { border-left-color: #0ea5e9; }
.callout-question .callout-title, .callout-help .callout-title, .callout-faq .callout-title { color: #0284c7; }
.callout-quote, .callout-example { border-left-color: var(--muted); }
.callout-quote .callout-title, .callout-example .callout-title { color: var(--muted); }
.callout-bug, .callout-abstract, .callout-summary { border-left-color: #a855f7; }
.callout-bug .callout-title, .callout-abstract .callout-title, .callout-summary .callout-title { color: #9333ea; }

/* Mermaid 图表 */
.prose .mermaid { margin: 1.6rem 0; text-align: center; position: relative; cursor: zoom-in; }
.prose .mermaid svg { max-width: min(100%, 520px); max-height: 70vh; margin: 0 auto; background: transparent; }
[data-theme="dark"] .prose .mermaid svg { filter: brightness(0.9); }
.mmd-hint {
  position: absolute; right: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 0.66rem; color: var(--muted);
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px; opacity: 0; transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.mermaid:hover .mmd-hint { opacity: 1; }
@media (hover: none) { .mmd-hint { opacity: 1; } }

/* Mermaid 放大灯箱 */
body.mmd-locked { overflow: hidden; }
.mmd-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 15, 17, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: mmdIn 0.22s var(--ease);
}
@keyframes mmdIn { from { opacity: 0; } to { opacity: 1; } }
.mmd-stage {
  width: 92vw; height: 88vh; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.mmd-zoom {
  transform-origin: 50% 50%;
  cursor: grab; touch-action: none;
  background: var(--paper); border-radius: 10px; padding: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.mmd-zoom.grabbing { cursor: grabbing; }
.mmd-zoom svg { display: block; max-width: 84vw; max-height: 76vh; }
.mmd-zoom img { display: block; max-width: 84vw; max-height: 80vh; border-radius: 8px; }
.mmd-zoom table {
  border-collapse: collapse; font-family: var(--mono); font-size: 0.85rem;
  max-width: 84vw; max-height: 80vh; display: block; overflow: auto;
}
.mmd-zoom th, .mmd-zoom td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.mmd-zoom th { color: var(--ink-2); font-weight: 500; border-bottom-width: 2px; }
.mmd-zoom tr:last-child td { border-bottom: none; }
.mmd-close {
  position: fixed; top: 18px; right: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08);
  color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
  transition: background 0.25s var(--ease);
}
.mmd-close:hover { background: rgba(255, 255, 255, 0.2); }

/* 代码高亮（自定义低饱和配色） */
.hljs-comment, .hljs-quote { color: var(--faint); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag { color: var(--accent); }
.hljs-string, .hljs-regexp { color: #5a7d4d; }
[data-theme="dark"] .hljs-string, [data-theme="dark"] .hljs-regexp { color: #9cc08b; }
.hljs-number, .hljs-literal { color: #9a6b21; }
[data-theme="dark"] .hljs-number, [data-theme="dark"] .hljs-literal { color: #d9a950; }
.hljs-title, .hljs-function .hljs-title, .hljs-section { color: #41658c; }
[data-theme="dark"] .hljs-title { color: #8fb3d9; }
.hljs-built_in, .hljs-type { color: #8c6a2f; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--ink-2); }
.hljs-meta { color: var(--faint); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* 文章尾部 */
.post-foot {
  border-top: 1px solid var(--line);
  padding-top: 22px; margin-top: clamp(36px, 5vw, 56px);
}
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.post-tags a {
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px;
  transition: all 0.3s var(--ease);
}
.post-tags a:hover { color: var(--accent); border-color: var(--accent); }
.post-tags a::before { content: "#"; color: var(--faint); margin-right: 2px; }
.pn-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pn-nav a { display: block; border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 18px; transition: all 0.35s var(--ease); }
.pn-nav a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(28, 28, 30, 0.08); }
.pn-nav .next { text-align: right; }
.pn-nav small { display: block; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.16em; color: var(--faint); margin-bottom: 6px; }
.pn-nav span { font-size: 0.94rem; font-weight: 500; line-height: 1.5; color: var(--ink-2); transition: color 0.25s var(--ease); }
.pn-nav a:hover span { color: var(--accent); }
.pn-nav .end { border-style: dashed; opacity: 0.55; pointer-events: none; }

/* ==========================================================================
   关于页
   ========================================================================== */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: clamp(30px, 6vw, 64px); align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }
.about-card { display: flex; flex-direction: column; gap: 16px; padding: clamp(30px, 5vw, 48px) 0; }
.about-card h2 {
  font-size: 1.2rem; font-weight: 600; margin-top: 1.4rem;
}
.about-card p { color: var(--ink-2); line-height: 1.95; font-size: 0.98rem; }
.about-card p b { color: var(--accent); font-weight: 600; }
.about-card ul { list-style: none; }
.about-card ul li { padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: 0.9rem; color: var(--ink-2); }
.about-card ul li .t { color: var(--muted); font-family: var(--mono); font-size: 0.76rem; margin-right: 12px; }
.about-card ul li a { color: var(--accent); }
.about-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 860px) { .about-side { position: static; } }

/* 关于页小统计 */
.stats-card {
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--paper-2);
  padding: 22px 24px;
  margin: 10px 0 2px;
}
.stats-card h3 {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint);
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px;
}
.stats-card h3 .en { text-transform: none; letter-spacing: 0.02em; }
.stats-grid { display: flex; gap: clamp(20px, 4vw, 40px); flex-wrap: wrap; }
.stat b {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600;
  color: var(--ink); display: block; line-height: 1.1;
}
.stat span { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
@media (max-width: 640px) { .stats-grid { flex-direction: column; gap: 14px; } }

/* ==========================================================================
   404
   ========================================================================== */
.notfound { text-align: center; padding: clamp(80px, 14vw, 150px) 0; }
.notfound .code {
  font-family: var(--serif); font-size: clamp(3.4rem, 10vw, 5.5rem);
  font-weight: 600; letter-spacing: 0.04em; color: var(--accent);
  display: block; margin-bottom: 8px;
}
.notfound .zh { font-size: 1.15rem; color: var(--ink-2); margin-bottom: 10px; }
.notfound p { color: var(--muted); font-size: 0.88rem; margin-bottom: 28px; }

/* ==========================================================================
   状态 / 空态
   ========================================================================== */
.status { padding: 40px 0; color: var(--muted); font-family: var(--mono); font-size: 0.82rem; }
.status.err { color: var(--accent); }
.empty { padding: clamp(36px, 6vw, 56px) 0; text-align: center; color: var(--muted); font-size: 0.9rem; }
.empty code { font-family: var(--mono); background: var(--paper-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px; color: var(--accent); }

/* ==========================================================================
   动效（参考 yohaku-blog-template：fadeIn + 弹簧交互；stylekit：Blur In）
   ========================================================================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes blurIn { from { opacity: 0; filter: blur(6px); transform: translateY(6px); } to { opacity: 1; filter: blur(0); transform: none; } }
.rise { animation: fadeIn 0.6s ease-out both; }
.rise-slow { animation: fadeIn 0.85s ease-out both; }
/* 文章正文入场：墨色落纸，由虚到实 */
.prose { animation: blurIn 0.55s ease-out both; }

/* 滚动显现的元素在进入视口前先隐藏，避免「先显示→再闪一下」 */
.js-wait { opacity: 0; }

/* 文章图片微交互：轻轻浮起 */
.prose img { transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.prose img:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(28, 28, 30, 0.12); }

@media (max-width: 640px) {
  .post-row { grid-template-columns: 1fr; gap: 8px; }
  .arc-row { grid-template-columns: 1fr; gap: 4px; }
  .pn-nav { grid-template-columns: 1fr; }
  .nav-row { padding: 12px 0; }
  .hero-stats { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  /* 动画被禁用时，等待滚动显现的元素必须直接可见，否则内容永久空白 */
  .js-wait { opacity: 1 !important; }
}

/* 跨文档页面过渡（View Transitions API）：Chrome/Edge 126+、Safari 18.2+ 生效，
   页面间跳转自动交叉淡入；不支持（如 Firefox）时自动降级为普通跳转，不影响功能。
   系统开启"减少动态效果"时浏览器会自动跳过过渡。 */
@view-transition { navigation: auto; }
