/* =========================================================
   北纬笔记 — 站点样式
   设计基调：暖白纸张 / 衬线标题 / 陶土色点缀 / 克制的动效
   ========================================================= */

:root {
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Georgia, 'Songti SC', 'Noto Serif SC', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, 'Courier New', monospace;

  --bg: #faf8f4;
  --bg-elev: #ffffff;
  --bg-sunk: #f3efe7;
  --ink: #191714;
  --ink-soft: #4b463d;
  --muted: #8b8377;
  --line: #e6e0d4;
  --line-strong: #d5cdbe;
  --accent: #b8412a;
  --accent-hover: #97311e;
  --accent-soft: rgba(184, 65, 42, 0.08);
  --shadow-sm: 0 1px 2px rgba(35, 28, 18, 0.05);
  --shadow-md: 0 6px 20px -8px rgba(35, 28, 18, 0.18), 0 2px 6px rgba(35, 28, 18, 0.04);
  --shadow-lg: 0 24px 60px -20px rgba(35, 28, 18, 0.28);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  --wrap: 1180px;
  --wrap-narrow: 740px;
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme='dark'] {
  --bg: #121110;
  --bg-elev: #1a1917;
  --bg-sunk: #232120;
  --ink: #f3efe6;
  --ink-soft: #cec6b8;
  --muted: #8d8578;
  --line: #2d2a26;
  --line-strong: #3d3933;
  --accent: #e87848;
  --accent-hover: #f39164;
  --accent-soft: rgba(232, 120, 72, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -10px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.8);
}

/* ---------- reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
ol, ul { padding-left: 1.25em; }
::selection { background: var(--accent); color: #fff; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- 阅读进度 ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #d98442);
  z-index: 60;
  transition: width 0.1s linear;
}

/* ---------- 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  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 var(--line);
}

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

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1;
  transition: transform 0.3s var(--ease), background-color 0.2s;
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); background: var(--accent); }

.brand-text {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
}
.brand-text em {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  position: relative;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-soft);
  transition: color 0.2s, background-color 0.2s;
}
.site-nav a:hover { color: var(--ink); background: var(--bg-sunk); }
.site-nav a[aria-current='page'] { color: var(--ink); font-weight: 600; background: var(--accent-soft); }

.header-actions { display: flex; gap: 4px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--ink-soft);
  transition: background-color 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.nav-toggle { display: none; }

.only-light, .only-dark { display: none; }
[data-theme='light'] .only-light { display: grid; }
[data-theme='dark'] .only-dark { display: grid; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(56px, 9vw, 108px) 0 clamp(40px, 6vw, 64px);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -20% 40% 40% -10%;
  background: radial-gradient(circle at 30% 40%, var(--accent-soft), transparent 62%);
  pointer-events: none;
  z-index: -1;
}
.hero-inner { max-width: 760px; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--bg-elev);
}
.hero-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero-title {
  font-size: clamp(2.5rem, 6.4vw, 4.2rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0 0 22px;
}
.hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 0 32px;
  line-height: 1.75;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.18s var(--ease), background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn svg { width: 15px; height: 15px; transition: transform 0.25s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn:hover svg { transform: translateX(3px); }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--bg-elev); }

.hero-stats {
  display: flex;
  gap: 40px;
  margin: 46px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.hero-stats div { display: flex; flex-direction: column-reverse; gap: 2px; }
.hero-stats dt {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hero-stats dd { margin: 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0.03em; }

/* ---------- 区块 ---------- */
.section { padding: clamp(32px, 5vw, 56px) 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { font-size: 1.35rem; letter-spacing: -0.02em; }
.section-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.2s, gap 0.2s;
}
.section-more:hover { color: var(--accent); gap: 10px; }
.section-more svg { width: 14px; height: 14px; }

.page-head { padding: clamp(44px, 7vw, 76px) 24px 8px; max-width: var(--wrap); }
.page-head h1 {
  font-size: clamp(2rem, 4.4vw, 2.85rem);
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.page-head > p { color: var(--muted); margin: 0; font-size: 15px; }

/* ---------- 卡片 ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.grid-list { margin-top: 0; }

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.cover {
  position: relative;
  overflow: hidden;
  background: var(--bg-sunk);
  aspect-ratio: 16 / 10;
}
.cover-lead { aspect-ratio: 16 / 8.2; }
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card:hover .cover img { transform: scale(1.04); }

.cover-tone-1 { background: linear-gradient(140deg, #f2e4d6, #e8cdb8 55%, #d9b294); }
.cover-tone-2 { background: linear-gradient(140deg, #e3e7e2, #cbd5cd 55%, #a9b8ac); }
.cover-tone-3 { background: linear-gradient(140deg, #e6e2ef, #cfc7e0 55%, #b0a5c8); }
.cover-tone-4 { background: linear-gradient(140deg, #f0e3e0, #dfc6c1 55%, #c4a29b); }
.cover-tone-5 { background: linear-gradient(140deg, #e8e6df, #d2cfc4 55%, #b3ad9d); }
[data-theme='dark'] .cover-tone-1 { background: linear-gradient(140deg, #3a2c22, #4a362a 55%, #5c4334); }
[data-theme='dark'] .cover-tone-2 { background: linear-gradient(140deg, #23302a, #2c3b33 55%, #37483e); }
[data-theme='dark'] .cover-tone-3 { background: linear-gradient(140deg, #2c2838, #373246 55%, #443d57); }
[data-theme='dark'] .cover-tone-4 { background: linear-gradient(140deg, #382726, #46312f 55%, #553b38); }
[data-theme='dark'] .cover-tone-5 { background: linear-gradient(140deg, #2e2c26, #393630 55%, #46423a); }

.cover-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 3.4rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: -0.02em;
  mix-blend-mode: soft-light;
}

.cover-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(20, 16, 12, 0.55);
  backdrop-filter: blur(6px);
}

.card-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 18px; flex: 1; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.card-meta .dot { opacity: 0.6; }

.card-title { font-size: 1.14rem; line-height: 1.4; letter-spacing: -0.01em; }
.card-lead .card-title { font-size: clamp(1.3rem, 2vw, 1.55rem); }
.card-title a { background-image: linear-gradient(var(--accent), var(--accent)); background-position: 0 100%; background-repeat: no-repeat; background-size: 0 1px; transition: background-size 0.35s var(--ease); }
.card-title a:hover { background-size: 100% 1px; }

.card-excerpt { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 6px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  transition: all 0.2s;
}
.chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.2s, gap 0.2s;
}
.more svg { width: 13px; height: 13px; }
.card:hover .more { color: var(--accent); gap: 8px; }

/* ---------- 标签云 ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  background: var(--bg-elev);
  transition: all 0.22s var(--ease);
}
.tag-pill span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag-pill:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.tag-list { display: flex; flex-direction: column; gap: 2px; }
.tag-row {
  display: grid;
  grid-template-columns: 160px 1fr 48px;
  align-items: center;
  gap: 18px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.2s;
}
.tag-row:hover { background: var(--bg-sunk); }
.tag-name { font-size: 15px; font-weight: 500; }
.tag-bar { height: 4px; border-radius: 999px; background: var(--bg-sunk); overflow: hidden; }
.tag-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #d98a4e); }
.tag-count { text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 文章页 ---------- */
/* 标题、封面、正文、目录、页脚共用同一套网格，保证左边缘严格对齐 */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 216px;
  column-gap: 56px;
  max-width: 1012px;
  padding-top: clamp(34px, 5vw, 58px);
  padding-bottom: clamp(40px, 6vw, 64px);
}

.post-head { grid-column: 1 / -1; grid-row: 1; max-width: 820px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.post-head h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.post-lead { font-size: 1.0625rem; color: var(--ink-soft); line-height: 1.8; margin: 0 0 26px; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.post-avatar { border-radius: 50%; border: 1px solid var(--line); background: var(--bg-sunk); }
.post-meta strong { font-size: 14px; font-weight: 600; }
.post-meta p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }

.post-cover { grid-column: 1 / -1; grid-row: 2; max-width: 880px; margin: 30px 0 0; }
.post-cover img { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--line); }

.post-body { grid-column: 1; grid-row: 3; padding-top: 38px; }

.post-foot { grid-column: 1 / -1; grid-row: 4; padding-top: 10px; }
.post-end {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.18em;
  padding: 30px 0;
}

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 44px; }
.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: all 0.25s var(--ease);
}
.post-nav-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.post-nav-item span { font-size: 11.5px; color: var(--muted); letter-spacing: 0.05em; }
.post-nav-item strong { font-family: var(--font-serif); font-size: 15px; font-weight: 600; line-height: 1.4; }
.post-nav-item.is-next { text-align: right; align-items: flex-end; }

.related { margin-top: 12px; }
.related h2 { font-size: 1.1rem; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* ---------- 目录 ---------- */
.toc {
  grid-column: 2;
  grid-row: 3;
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-size: 13px;
}
.toc-title { margin: 0 0 10px; font-size: 11.5px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  line-height: 1.5;
  border-left: 2px solid transparent;
  margin-left: -19px;
  padding-left: 17px;
  transition: color 0.2s, border-color 0.2s;
}
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc .toc-l3 a { padding-left: 30px; font-size: 12.5px; }

/* ---------- 正文排版 ---------- */
.prose { font-size: 1.0625rem; line-height: 1.92; color: var(--ink-soft); }
.prose > * + * { margin-top: 1.35em; }
.prose p { margin: 0; }
.prose h2, .prose h3, .prose h4 { color: var(--ink); margin-top: 2.2em; margin-bottom: 0.6em; scroll-margin-top: 88px; }
.prose h2 { font-size: 1.5rem; padding-bottom: 0.4em; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 1.2rem; }
.prose h4 { font-size: 1.03rem; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.9em; }

.prose .anchor {
  margin-left: 8px;
  color: var(--line-strong);
  font-family: var(--font-sans);
  font-size: 0.8em;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose .anchor:hover { color: var(--accent); }

.prose a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); transition: border-color 0.2s, color 0.2s; }
.prose a:hover { border-bottom-color: var(--accent); color: var(--accent-hover); }

.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; }
.prose del { color: var(--muted); }

.prose ul, .prose ol { margin-top: 1.1em; margin-bottom: 1.1em; padding-left: 1.4em; }
.prose li { margin: 0.5em 0; }
.prose li::marker { color: var(--muted); }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin: 0.4em 0; }

.prose blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.08em;
  font-style: italic;
}
.prose blockquote p + p { margin-top: 0.8em; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  color: var(--accent);
  word-break: break-word;
}

.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.6em 0; }

.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin: 1.8em auto; }

.prose .table-wrap { overflow-x: auto; margin: 1.8em 0; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 11px 15px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { background: var(--bg-sunk); font-weight: 600; color: var(--ink); font-size: 13px; letter-spacing: 0.02em; white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: color-mix(in srgb, var(--bg-sunk) 60%, transparent); }

/* ---------- 代码块 ---------- */
.code-block {
  position: relative;
  margin: 1.8em 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunk);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink);
  tab-size: 2;
}
.code-block code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.code-lang {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 var(--radius) 0 8px;
  pointer-events: none;
}
.code-copy {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}
.code-block:not(:has(.code-lang)) .code-copy { right: 8px; }
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-copy.is-done { color: #2f7a4f; border-color: #2f7a4f; opacity: 1; }

.tok-kw { color: #9b4d9c; font-weight: 500; }
.tok-str { color: #2f7a4f; }
.tok-num { color: #b06a12; }
.tok-com { color: var(--muted); font-style: italic; }
[data-theme='dark'] .tok-kw { color: #d59ae0; }
[data-theme='dark'] .tok-str { color: #8fc98f; }
[data-theme='dark'] .tok-num { color: #e0b070; }

/* ---------- 归档 ---------- */
.archive-year { margin-bottom: 44px; }
.archive-year h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 1.6rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.archive-year h2 span { font-family: var(--font-sans); font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0.04em; }
.archive ul { list-style: none; margin: 0; padding: 0; }
.archive li { display: flex; align-items: baseline; gap: 20px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.archive li time { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.archive li a { font-size: 15px; transition: color 0.2s, transform 0.2s; display: inline-block; }
.archive li a:hover { color: var(--accent); transform: translateX(3px); }

/* ---------- 关于 ---------- */
.about-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.about-avatar { border-radius: 50%; border: 1px solid var(--line); margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.about-role { color: var(--muted); margin: 0 0 22px !important; font-size: 14px; }
.about-prose { max-width: 680px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 44px; }
.page-btn {
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--ink); color: var(--ink); }
.page-btn.is-disabled { opacity: 0.4; pointer-events: none; }
.page-state { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: clamp(60px, 12vw, 140px) 24px; }
.nf-code {
  font-family: var(--font-serif);
  font-size: clamp(5rem, 18vw, 11rem);
  line-height: 1;
  letter-spacing: -0.06em;
  margin: 0 0 8px;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line-strong);
}
.notfound h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 14px; }
.notfound > p { color: var(--muted); margin: 0 0 30px; }
.notfound .hero-actions { justify-content: center; }

/* ---------- 搜索 ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  padding: 12vh 20px 20px;
  background: color-mix(in srgb, var(--ink) 32%, transparent);
  backdrop-filter: blur(6px);
  animation: fade 0.18s var(--ease);
}
.search-overlay[hidden] { display: none; }

.search-panel {
  width: 100%;
  max-width: 620px;
  height: fit-content;
  max-height: 74vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.22s var(--ease);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.search-bar > svg { width: 19px; height: 19px; color: var(--muted); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px;
}
.search-bar input::placeholder { color: var(--muted); }

.search-results { overflow-y: auto; padding: 8px; }
.search-hint { color: var(--muted); font-size: 13.5px; text-align: center; padding: 28px 10px; margin: 0; }

.sr-item {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}
.sr-item:hover, .sr-item.is-active { background: var(--bg-sunk); }
.sr-item.is-active { box-shadow: inset 2px 0 0 var(--accent); }
.sr-item h3 { font-size: 14.5px; font-family: var(--font-sans); font-weight: 600; margin: 0 0 3px; }
.sr-item p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-item mark { background: var(--accent-soft); color: var(--accent); padding: 0 1px; border-radius: 2px; }

.search-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg-sunk);
}
kbd {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-elev);
  color: var(--ink-soft);
}

.search-inline { margin-bottom: 32px; }
.search-inline input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-inline input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  background: var(--bg-sunk);
  padding: 46px 0 34px;
}
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 20px 40px; align-items: start; }
.footer-brand strong { font-family: var(--font-serif); font-size: 16px; }
.footer-brand p { margin: 8px 0 0; font-size: 13px; color: var(--muted); max-width: 420px; line-height: 1.7; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { font-size: 13.5px; color: var(--ink-soft); transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.copyright { grid-column: 1 / -1; margin: 18px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------- 动效 ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.page-home .hero-inner > * { animation: rise 0.6s var(--ease) backwards; }
.page-home .hero-inner > *:nth-child(1) { animation-delay: 0.02s; }
.page-home .hero-inner > *:nth-child(2) { animation-delay: 0.08s; }
.page-home .hero-inner > *:nth-child(3) { animation-delay: 0.14s; }
.page-home .hero-inner > *:nth-child(4) { animation-delay: 0.2s; }
.page-home .hero-inner > *:nth-child(5) { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .toc { display: none; }
  .post-head, .post-cover, .post-body, .post-foot { max-width: 100%; }
}

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats { gap: 28px; }
  .tag-row { grid-template-columns: 120px 1fr 40px; gap: 12px; }
}

@media (max-width: 760px) {
  :root { --header-h: 60px; }
  .wrap, .wrap-narrow { padding: 0 18px; }
  .page-head, .post-head { padding-left: 18px; padding-right: 18px; }

  .brand-text em { display: none; }
  .nav-toggle { display: grid; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 12px 18px 18px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  }
  .site-nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .site-nav a { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 15px; }

  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .grid-3 { margin-top: 20px; }
  .cover-lead { aspect-ratio: 16 / 9; }

  .hero-stats { gap: 22px; margin-top: 34px; }
  .hero-stats dt { font-size: 1.35rem; }
  .hero-stats dd { font-size: 11.5px; }

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

  .search-overlay { padding: 8vh 12px 12px; }
  .search-panel { max-height: 80vh; }

  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { gap: 16px; }
  .tag-row { grid-template-columns: 1fr 44px; gap: 10px; }
  .tag-bar { display: none; }
}

@media (max-width: 420px) {
  .hero-title { font-size: 2.15rem; }
  .card-body { padding: 16px 17px 15px; }
  .post-head h1 { font-size: 1.7rem; }
  .archive li { gap: 12px; }
}

@media print {
  .site-header, .site-footer, .toc, .progress, .search-overlay, .post-nav, .related, .code-copy { display: none !important; }
  body { background: #fff; color: #000; }
  .post-layout { display: block; padding: 0; }
  .prose { max-width: 100%; }
}
