/* ═══════════════════════════════════════════════════════════
   工程师成长手账 · 站点样式
   设计方向：技术手册 × 工程手账
   —— 牛皮纸底色、深墨绿主色、氧化橙点缀、衬线标题配等宽元信息
   ═══════════════════════════════════════════════════════════ */

/* ── 设计令牌 ──────────────────────────────────────────── */
:root {
  /* 亮色：纸感底 + 墨绿字 */
  --paper:        #F7F4ED;
  --paper-2:      #FFFDF8;
  --paper-3:      #EFEADC;
  --ink:          #1C241F;
  --ink-2:        #3A4740;
  --ink-3:        #6B7A71;
  --ink-4:        #97A49C;
  --line:         #DCD5C4;
  --line-2:       #C9C0AB;

  --accent:       #2F6F4E;   /* 深墨绿 */
  --accent-2:     #B5651D;   /* 氧化橙 */
  --accent-3:     #3A5A8C;   /* 靛蓝 */
  --accent-soft:  rgba(47, 111, 78, 0.09);
  --accent-2-soft:rgba(181, 101, 29, 0.10);

  --code-bg:      #1E2622;
  --code-fg:      #D8E2DA;

  --shadow-sm: 0 1px 2px rgba(28, 36, 31, 0.05);
  --shadow-md: 0 4px 16px -4px rgba(28, 36, 31, 0.10);
  --shadow-lg: 0 18px 44px -18px rgba(28, 36, 31, 0.22);

  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", Georgia, "Times New Roman", serif;
  --sans:  "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --mono:  "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --maxw: 1180px;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --radius: 3px;

  --ease: cubic-bezier(0.22, 0.68, 0.32, 1);
}

[data-theme="dark"] {
  --paper:        #141A17;
  --paper-2:      #1B231F;
  --paper-3:      #222B26;
  --ink:          #E8EDE9;
  --ink-2:        #C2CDC6;
  --ink-3:        #8E9C94;
  --ink-4:        #6B7970;
  --line:         #2C3832;
  --line-2:       #3A4840;

  --accent:       #6FBF94;
  --accent-2:     #E0A264;
  --accent-3:     #8FAEDD;
  --accent-soft:  rgba(111, 191, 148, 0.12);
  --accent-2-soft:rgba(224, 162, 100, 0.12);

  --code-bg:      #0D120F;
  --code-fg:      #D2DED6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 44px -18px rgba(0, 0, 0, 0.70);
}

/* ── 基础 ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;   /* 锚点定位时避开吸顶导航 */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 纸纹：极淡的噪点层，给纯色背景一点质感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.028;
  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='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { opacity: 0.05; }

main { position: relative; z-index: 1; }

.mono { font-family: var(--mono); font-size: 0.85em; letter-spacing: -0.01em; }

::selection { background: var(--accent-2-soft); color: var(--ink); }

a { color: var(--accent); text-decoration: none; transition: color 0.18s var(--ease); }
a:hover { color: var(--accent-2); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 0.7rem 1.2rem;
  background: var(--accent);
  color: var(--paper-2);
  font-size: 0.9rem;
}
.skip-link:focus { left: 1rem; top: 1rem; color: var(--paper-2); }

/* ── 吸顶页头 ──────────────────────────────────────────── */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.masthead-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.9rem var(--gap);
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.25rem);
}

/* 双线分隔，呼应「工程手册」的装订感 */
.masthead-rule {
  height: 3px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  opacity: 0.9;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  color: var(--accent);
  display: grid;
  place-items: center;
  transition: transform 0.35s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong {
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-text em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--ink-3);
  letter-spacing: 0.03em;
}
@media (max-width: 640px) { .brand-text em { display: none; } }

.site-nav {
  display: flex;
  gap: clamp(0.85rem, 2vw, 1.6rem);
  margin-left: auto;
  font-size: 0.9rem;
}
.site-nav a {
  position: relative;
  color: var(--ink-2);
  padding: 0.25rem 0;
  font-weight: 500;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -2px;
  height: 1.5px;
  background: var(--accent-2);
  transition: right 0.28s var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { right: 0; }
.site-nav a.is-active { color: var(--accent); font-weight: 600; }
.site-nav a.is-active::after { right: 0; background: var(--accent); }

.masthead-tools { display: flex; align-items: center; gap: 0.5rem; }

.search-mini {
  position: relative;
  display: flex;
  align-items: center;
}
.search-mini input {
  width: 8.5rem;
  padding: 0.34rem 2rem 0.34rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: width 0.28s var(--ease), border-color 0.2s;
}
.search-mini input:focus {
  width: 12rem;
  outline: none;
  border-color: var(--accent);
}
.search-mini kbd {
  position: absolute;
  right: 0.55rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--ink-4);
  pointer-events: none;
}
.mobile-search-link { display: none; }
@media (max-width: 860px) { .search-mini { display: none; } .mobile-search-link { display: inline-block; } }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  padding: 0;
  cursor: pointer;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: border-color 0.2s, color 0.2s, transform 0.3s var(--ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(18deg); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* 移动端菜单按钮。
   原来用三个 1.5px 的 <span> 画三条杠，在手机实际尺寸下细到看不见，
   看起来像个空方块。改为：内联 SVG（线宽 2.2，清晰可见）+「更多」文字，
   图标和文字双通道传达"这里能展开更多导航"。 */
.nav-toggle {
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  cursor: pointer;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: color 0.16s, border-color 0.16s;
}
.nav-toggle:hover { color: var(--ink); border-color: var(--line-2); }
.nav-toggle-icon { display: block; flex: none; }
.nav-toggle-text {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 展开态：文字切到「关闭」（由 site.js 切换），图标保持汉堡形态不旋转，
   避免旋转 90° 的横线看起来像三个竖杠、语义反而变模糊 */
.nav-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent-2); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { transform: rotate(90deg); }

/* 极窄屏（≤340px）：页头空间实在不够才去掉文字，只留加粗的三条杠图标。
   断点刻意设得很低——iPhone SE 375px、常见安卓 360px 都应保留「更多」文字。 */
@media (max-width: 340px) {
  .nav-toggle { padding: 0 0.45rem; min-width: 2rem; }
  .nav-toggle-text { display: none; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0.5rem var(--gap) 1rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 0.7rem 0; border-bottom: 1px solid var(--line-2); font-size: 0.95rem; }
  .site-nav a::after { display: none; }
}

/* ── 通用组件 ──────────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-2-soft);
  animation: pulse 2.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-2-soft); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.14rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--chip, var(--accent));
  background: color-mix(in srgb, var(--chip, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--chip, var(--accent)) 30%, transparent);
  border-radius: 100px;
}
.chip-sm { padding: 0.1rem 0.5rem; font-size: 0.68rem; }
.chip-xs { padding: 0.05rem 0.42rem; font-size: 0.65rem; }

.tag-sm {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.48rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-3);
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: all 0.18s var(--ease);
}
a.tag-sm:hover {
  color: var(--chip, var(--accent));
  border-color: var(--chip, var(--accent));
  background: color-mix(in srgb, var(--chip, var(--accent)) 10%, transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.3rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
}
.btn-primary {
  color: var(--paper-2);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .btn-primary { color: #10160F; }
.btn-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-ghost { color: var(--ink-2); background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.btn-sm { padding: 0.38rem 0.85rem; font-size: 0.82rem; }
.btn-lg { padding: 0.78rem 1.5rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

.empty-state {
  padding: clamp(2.5rem, 7vw, 4.5rem) 1.5rem;
  text-align: center;
  background: var(--paper-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}
.empty-title {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}
.empty-note { margin: 0 0 1rem; color: var(--ink-3); font-size: 0.9rem; }

/* ── 首页 Hero ─────────────────────────────────────────── */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gap) clamp(2rem, 4vw, 3.5rem);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.hero-title {
  margin: 0 0 1.15rem;
  font-family: var(--serif);
  font-size: clamp(1.95rem, 4.6vw, 3.35rem);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.015em;
}
.hero-emph {
  position: relative;
  color: var(--accent);
  white-space: nowrap;
}
.hero-emph::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.1em;
  height: 0.3em;
  background: var(--accent-2-soft);
  z-index: -1;
  border-radius: 1px;
}
.hero-desc {
  max-width: 34em;
  margin: 0 0 1.85rem;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.85;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* 精选大卡：带倾斜的纸片感 */
.hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.6rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transform: rotate(-0.7deg);
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease), border-color 0.25s;
}
.hero-card::before {
  /* 左上角装订孔，打破规整矩形 */
  content: "";
  position: absolute;
  top: 0.9rem; left: -3px;
  width: 6px; height: 22px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  opacity: 0.65;
}
.hero-card:hover {
  color: var(--ink);
  transform: rotate(0deg) translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}
.hero-card-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hero-card-date { color: var(--ink-4); }
.hero-card-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.008em;
}
.hero-card-excerpt {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.9rem;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.hero-card-read {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--accent-2);
}

/* ── 区块标题 ──────────────────────────────────────────── */
.feed-section, .tag-list-block {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gap) clamp(3rem, 7vw, 5rem);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--ink);
}
.section-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.section-title::before {
  content: "▍";
  color: var(--accent-2);
  margin-right: 0.3rem;
}
.section-title.sm { font-size: 1.2rem; margin-bottom: 1.25rem; border: 0; padding: 0; }
.section-tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-count { color: var(--ink-4); font-size: 0.75rem; }
.filter-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.filter-chip {
  padding: 0.22rem 0.7rem;
  font-size: 0.8rem;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: all 0.18s var(--ease);
}
.filter-chip:hover { color: var(--accent); border-color: var(--accent); }
.filter-chip.is-active {
  color: var(--paper-2);
  background: var(--ink);
  border-color: var(--ink);
}
[data-theme="dark"] .filter-chip.is-active { color: #10160F; }

/* ── 文章列表 ──────────────────────────────────────────── */
.feed-list { list-style: none; margin: 0; padding: 0; }

.feed-item { border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }

.feed-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.85rem 0;
  transition: transform 0.24s var(--ease);
}
.feed-card::before {
  /* 悬停时左侧生长的强调线 */
  content: "";
  position: absolute;
  left: calc(var(--gap) * -0.6);
  top: 1.85rem;
  width: 2px; height: 0;
  background: var(--accent-2);
  transition: height 0.32s var(--ease);
}
.feed-item:hover .feed-card::before { height: calc(100% - 3.7rem); }
.feed-item:hover .feed-card { transform: translateX(5px); }

.feed-card-main { flex: 1; min-width: 0; }
.feed-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.feed-date { color: var(--ink-4); font-size: 0.74rem; }
.badge-top {
  padding: 0.08rem 0.42rem;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--accent-2-soft);
  border-radius: 2px;
}
.feed-title {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.1vw, 1.4rem);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.008em;
}
.feed-title a {
  color: var(--ink);
  background-image: linear-gradient(var(--accent-2), var(--accent-2));
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.32s var(--ease), color 0.2s;
}
.feed-item:hover .feed-title a { color: var(--accent); background-size: 100% 1.5px; }

.feed-excerpt {
  margin: 0 0 0.9rem;
  max-width: 62ch;
  color: var(--ink-3);
  font-size: 0.93rem;
  line-height: 1.78;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.feed-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.feed-stat { color: var(--ink-4); font-size: 0.72rem; }

.feed-card-index {
  flex-shrink: 0;
  padding-top: 0.15rem;
  font-size: 1.5rem;
  color: var(--line-2);
  transition: color 0.24s var(--ease);
}
.feed-item:hover .feed-card-index { color: var(--accent-2); }
@media (max-width: 700px) { .feed-card-index { display: none; } }

/* ── 分页 ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}
.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.95rem;
  font-size: 0.86rem;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: all 0.18s var(--ease);
}
.page-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.page-btn.is-disabled { color: var(--ink-4); opacity: 0.45; pointer-events: none; }
.page-numbers { display: flex; gap: 0.3rem; }
.page-num {
  display: grid;
  place-items: center;
  min-width: 2rem; height: 2rem;
  padding: 0 0.35rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-2);
  border-radius: 2px;
}
.page-num:hover { background: var(--accent-soft); color: var(--accent); }
.page-num.is-active { color: var(--paper-2); background: var(--ink); }
[data-theme="dark"] .page-num.is-active { color: #10160F; }
.page-gap { color: var(--ink-4); padding: 0 0.2rem; }
.page-status { color: var(--ink-4); font-size: 0.78rem; }

/* ── 通用页头 ──────────────────────────────────────────── */
.page-head {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.25rem, 5vw, 3.75rem) var(--gap) clamp(1.75rem, 3.5vw, 2.5rem);
}
.page-title {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4.4vw, 2.85rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.015em;
}
.page-desc { max-width: 46em; margin: 0; color: var(--ink-2); font-size: 1.02rem; line-height: 1.8; }
.page-count { margin: 0.85rem 0 0; color: var(--ink-4); font-size: 0.78rem; }

/* ── 标签云 ────────────────────────────────────────────── */
.tag-cloud {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gap) 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.cloud-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: all 0.22s var(--ease);
}
.cloud-tag:hover {
  color: var(--paper-2);
  background: var(--chip, var(--accent));
  border-color: var(--chip, var(--accent));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
[data-theme="dark"] .cloud-tag:hover { color: #10160F; }
.cloud-name { font-weight: 600; }
.cloud-count { font-size: 0.68rem; color: var(--ink-4); }
.cloud-tag:hover .cloud-count { color: inherit; opacity: 0.75; }
.cloud-tag.w2 { font-size: 0.82rem; }
.cloud-tag.w3 { font-size: 0.94rem; padding: 0.48rem 1.05rem; }
.cloud-tag.w3 .cloud-name { font-weight: 700; }
.cloud-tag.w4 { font-size: 1.08rem; padding: 0.58rem 1.25rem; border-width: 2px; }
.cloud-tag.w4 .cloud-name { font-weight: 700; }

.tag-table { border-top: 1px solid var(--line); }
.tag-row {
  display: grid;
  grid-template-columns: minmax(9rem, 15rem) 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 0.5rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: background 0.18s, padding 0.22s var(--ease);
}
.tag-row:hover { color: var(--ink); background: var(--paper-2); padding-left: 0.9rem; padding-right: 0.9rem; }
.tag-row-name { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; font-size: 0.94rem; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tag-row-desc { color: var(--ink-3); font-size: 0.87rem; }
.tag-row-count { color: var(--ink-4); font-size: 0.74rem; white-space: nowrap; }
@media (max-width: 700px) {
  .tag-row { grid-template-columns: 1fr auto; gap: 0.35rem 1rem; }
  .tag-row-desc { grid-column: 1 / -1; }
}

/* ── 分类卡 ────────────────────────────────────────────── */
.cat-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gap) clamp(3rem, 7vw, 5rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.25rem;
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--chip, var(--accent));
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.26s var(--ease), box-shadow 0.26s var(--ease);
}
.cat-card::after {
  content: attr(data-n);
  position: absolute;
  right: -0.5rem; bottom: -1.2rem;
  font-family: var(--serif);
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--chip, var(--accent));
  opacity: 0.055;
  pointer-events: none;
}
.cat-card:hover {
  color: var(--ink);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.cat-card-top { display: flex; align-items: center; justify-content: space-between; }
.cat-index { color: var(--chip, var(--accent)); font-size: 0.82rem; font-weight: 600; }
.cat-count { color: var(--ink-4); font-size: 0.74rem; }
.cat-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 700;
}
.cat-desc { margin: 0; color: var(--ink-3); font-size: 0.89rem; line-height: 1.72; }
.cat-more {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--chip, var(--accent));
  transition: transform 0.2s var(--ease);
}
.cat-card:hover .cat-more { transform: translateX(4px); }

/* ── 文章列表卡（标签页/分类页共用）───────────────────── */
.post-list, .timeline, .search-results, .search-hero, .search-result-count, .archive-group {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
}
.post-list, .timeline, .search-results { padding: 0 var(--gap) 1rem; }
.search-result-count { padding: 0 var(--gap); margin-bottom: 1.25rem; color: var(--ink-4); font-size: 0.8rem; }

.list-card {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}
.list-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
  color: var(--ink-4);
  font-size: 0.76rem;
}
.list-card-title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  font-weight: 700;
  line-height: 1.45;
}
.list-card-title a { color: var(--ink); }
.list-card-title a:hover { color: var(--accent); }
.list-card-excerpt {
  margin: 0 0 0.8rem;
  max-width: 62ch;
  color: var(--ink-3);
  font-size: 0.91rem;
  line-height: 1.76;
}

.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 1.5rem; bottom: 1.5rem;
  width: 1px;
  background: linear-gradient(var(--accent), var(--line), transparent);
}
.timeline-item { position: relative; padding-bottom: 2rem; }
.timeline-marker {
  position: absolute;
  left: -2rem; top: 1.7rem;
  width: 11px; height: 11px;
  background: var(--paper);
  border: 2px solid var(--accent);
  border-radius: 50%;
  transition: all 0.22s var(--ease);
}
.timeline-item:hover .timeline-marker {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ── 归档 ──────────────────────────────────────────────── */
.archive-group { padding: 0 var(--gap) 2.25rem; }
.archive-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.85rem; }
.archive-ym { font-size: 0.95rem; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.archive-line { flex: 1; height: 1px; background: var(--line); }
.archive-count { color: var(--ink-4); font-size: 0.74rem; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-item a {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.65rem;
  color: var(--ink);
  border-radius: var(--radius);
  transition: background 0.16s, padding 0.2s var(--ease);
}
.archive-item a:hover { color: var(--accent); background: var(--paper-2); padding-left: 1rem; }
.archive-date { color: var(--ink-4); font-size: 0.74rem; }
.archive-title { font-size: 0.95rem; font-weight: 500; }
@media (max-width: 620px) {
  .archive-item a { grid-template-columns: 3.6rem 1fr; }
  .archive-item .chip { display: none; }
}

/* ── 搜索 ──────────────────────────────────────────────── */
.search-hero {
  display: flex;
  gap: 0.65rem;
  padding: 0 var(--gap) 2rem;
}
.search-hero input {
  flex: 1;
  padding: 0.8rem 1.15rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
.search-hero input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-snip {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.9rem;
  line-height: 1.75;
}
.search-snip mark {
  padding: 0.05em 0.25em;
  color: var(--accent-2);
  background: var(--accent-2-soft);
  border-radius: 2px;
}
.form-hint.is-error { color: #C0392B; font-size: 0.86rem; padding: 0 var(--gap); }

/* ── 关于 ──────────────────────────────────────────────── */
.about-stats {
  max-width: var(--maxw);
  margin: 0 auto 2.5rem;
  padding: 0 var(--gap);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.about-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 1.35rem 0.75rem;
  background: var(--paper-2);
}
.about-stat-num {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
}
.about-stat-label { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-4); letter-spacing: 0.06em; }

.about-layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gap) clamp(3rem, 7vw, 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 900px) { .about-layout { grid-template-columns: 1fr; } }

.about-cta {
  max-width: var(--maxw);
  margin: 0 auto clamp(3rem, 7vw, 5rem);
  padding: clamp(2rem, 4vw, 3rem);
  text-align: center;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius);
}
.about-cta h2 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
}
.about-cta p { margin: 0 0 1.5rem; color: var(--ink-3); }

/* ── 文章详情 ──────────────────────────────────────────── */
/* 文章容器 = 阅读列宽度（约 40 个中文字符/行，最舒适的阅读长度）。
   标题、正文、标签、上下篇、相关文章共用同一列并整体居中；
   目录在宽屏时移到右侧留白（见下方 .toc），不再挤占正文宽度。 */
.post { max-width: 46rem; margin: 0 auto; padding: 0 var(--gap) clamp(3rem, 7vw, 5rem); }

/* 相册是看图不是读字，容器放宽到 60rem，桌面端可排 3 列 */
.album-page { max-width: 60rem; }

/* 头部不再单独限宽，直接继承 .post 的 46rem，与正文严格对齐 */
.post-header { margin: 0 0 clamp(2rem, 4vw, 3rem); padding-top: clamp(1.75rem, 4vw, 3rem); }
.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.75rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-4);
}
.post-back:hover { color: var(--accent); }
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  color: var(--ink-4);
  font-size: 0.78rem;
}
.meta-dot { color: var(--line-2); }
.badge-warn {
  padding: 0.1rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #B5651D;
  background: var(--accent-2-soft);
  border-radius: 2px;
}
.post-title {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.018em;
}
.post-excerpt {
  margin: 0 0 1.75rem;
  padding-left: 1.1rem;
  color: var(--ink-2);
  font-size: 1.04rem;
  line-height: 1.8;
  border-left: 2px solid var(--accent-2);
}
.post-byline { display: flex; align-items: center; gap: 0.7rem; }
.avatar {
  display: grid;
  place-items: center;
  width: 2.4rem; height: 2.4rem;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--paper-2);
  background: var(--accent);
  border-radius: 50%;
}
[data-theme="dark"] .avatar { color: #10160F; }
.avatar-sm { width: 1.9rem; height: 1.9rem; font-size: 0.82rem; }
.byline-text { display: flex; flex-direction: column; line-height: 1.4; }
.byline-name { font-size: 0.88rem; font-weight: 600; }
.byline-role { font-size: 0.74rem; color: var(--ink-4); }

/* 单列流式布局。用 flex column 而不是 block，
   这样中屏及以下可以用 order 把目录提到正文前面 */
.post-layout {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.post-body-wrap { width: 100%; }

/* ── 目录 ──────────────────────────────────────────────── */
.toc { position: relative; }

/* 宽屏（≥1200px）：目录固定到阅读列右侧的留白里。
   阅读列宽 46rem 且居中，右边缘在 50% + 23rem，目录从 +24.5rem 起步 */
@media (min-width: 1200px) {
  .toc {
    position: fixed;
    top: 6.5rem;
    left: calc(50% + 24.5rem);
    width: 12rem;
    max-height: calc(100vh - 9rem);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

/* 中屏（640–1199px）：目录提到正文上方，收成紧凑卡片 */
@media (max-width: 1199px) {
  .toc { order: -1; margin-bottom: 1.75rem; }
  .toc-inner {
    padding: 0.9rem 1.1rem;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  .toc-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
  .toc-item a { padding: 0.15rem 0.5rem; border: 1px solid var(--line); border-radius: 2px; }
  .toc-progress, .toc-top { display: none; }
}

/* 小屏（≤640px）：目录收成一行可横滑的标签，不再占掉半屏高度 */
@media (max-width: 640px) {
  .toc { margin-bottom: 1.35rem; }
  .toc-inner { padding: 0.7rem 0.85rem; }
  .toc-title { margin: 0 0 0.55rem; }
  .toc-list {
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
  }
  .toc-list::-webkit-scrollbar { display: none; }
  .toc-item { flex: 0 0 auto; }
  .toc-item a { white-space: nowrap; font-size: 0.76rem; }
}
.toc-inner {
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}
.toc-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item a {
  display: block;
  padding: 0.3rem 0;
  color: var(--ink-3);
  font-size: 0.82rem;
  line-height: 1.55;
  border-left: 2px solid transparent;
  padding-left: 0.65rem;
  margin-left: -0.65rem;
  transition: color 0.16s, border-color 0.16s;
}
.toc-item a:hover { color: var(--ink); border-left-color: var(--line-2); }
.toc-item a.is-current { color: var(--accent); border-left-color: var(--accent-2); font-weight: 600; }
.toc-lv3 a { padding-left: 1.4rem; font-size: 0.79rem; }
.toc-lv4 a { padding-left: 2.1rem; font-size: 0.76rem; }
.toc-progress {
  margin-top: 1.25rem;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.toc-progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent-2);
  transition: width 0.1s linear;
}
.toc-top {
  margin-top: 0.85rem;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-4);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.16s;
}
.toc-top:hover { color: var(--accent); }

/* ── 正文排版 ──────────────────────────────────────────── */
.prose {
  font-size: 1.03rem;
  line-height: 1.88;
  color: var(--ink);
  overflow-wrap: break-word;
}
.prose > *:first-child { margin-top: 0; }

.prose h2, .prose h3, .prose h4 {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.42;
  scroll-margin-top: 6rem;
}
.prose h2 {
  margin: 2.75rem 0 1.1rem;
  padding-bottom: 0.5rem;
  font-size: 1.55rem;
  border-bottom: 1px solid var(--line);
}
.prose h2::before {
  content: "§";
  margin-right: 0.45rem;
  color: var(--accent-2);
  font-size: 0.85em;
  opacity: 0.8;
}
.prose h3 { margin: 2.1rem 0 0.85rem; font-size: 1.25rem; }
.prose h3::before {
  content: "▸";
  margin-right: 0.4rem;
  color: var(--accent);
  font-size: 0.8em;
}
.prose h4 { margin: 1.75rem 0 0.7rem; font-size: 1.08rem; color: var(--ink-2); }

/* 锚点悬停时在标题左侧浮出 # 链接 */
.prose h2:hover::before, .prose h3:hover::before { opacity: 1; }

.prose p { margin: 1.15rem 0; }
.prose strong { font-weight: 700; color: var(--ink); }
.prose em { font-style: italic; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}
.prose a:hover { color: var(--accent-2); text-decoration-color: currentColor; }

.prose ul, .prose ol { margin: 1.15rem 0; padding-left: 1.5rem; }
.prose li { margin: 0.45rem 0; }
.prose li::marker { color: var(--ink-4); }
.prose ul > li::marker { color: var(--accent-2); }

.prose blockquote {
  position: relative;
  margin: 1.75rem 0;
  padding: 1rem 1.35rem;
  color: var(--ink-2);
  background: var(--paper-2);
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose blockquote p { margin: 0.5rem 0; }
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2) 20%, var(--line-2) 80%, transparent);
}

/* 表格：横向可滚动，避免撑破移动端 */
.prose table {
  width: 100%;
  margin: 1.75rem 0;
  font-size: 0.9rem;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.prose thead { background: var(--paper-3); }
.prose th {
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.prose td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose tr:last-child td { border-bottom: 0; }

.prose img {
  display: block;
  max-width: 100%;
  max-height: 70vh;          /* 竖构图也收在一屏内，避免一张人像占满整页 */
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 1.85rem auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.prose kbd {
  padding: 0.12em 0.42em;
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--ink);
  background: var(--paper-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 3px;
}

.prose mark {
  padding: 0.05em 0.3em;
  background: var(--accent-2-soft);
  color: inherit;
  border-radius: 2px;
}

.prose sup a { text-decoration: none; }

/* 行内代码 */
.prose :not(pre) > code {
  padding: 0.14em 0.42em;
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--accent-2);
  background: var(--accent-2-soft);
  border: 1px solid color-mix(in srgb, var(--accent-2) 22%, transparent);
  border-radius: 3px;
  white-space: nowrap;
}

/* 代码块 */
.code-block {
  position: relative;
  margin: 1.85rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-md);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  background: color-mix(in srgb, var(--code-bg) 84%, #fff 16%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.code-lang {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8FA898;
}
.code-copy {
  padding: 0.16rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #A8B8AC;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.code-copy:hover { color: #E8F0E9; border-color: rgba(255, 255, 255, 0.4); background: rgba(255,255,255,0.06); }
.code-copy.is-copied { color: #6FBF94; border-color: #6FBF94; }

.code-block pre {
  margin: 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.845rem;
  line-height: 1.72;
  tab-size: 2;
}
.code-block code { background: none; padding: 0; border: 0; font-size: inherit; color: var(--code-fg); white-space: pre; }

/* highlight.js 主题（贴合墨绿纸感，暗色亮色下都可读） */
.hljs-comment, .hljs-quote { color: #7C8F83; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag { color: #E9A178; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #A6CE8B; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #D9B77E; }
.hljs-title, .hljs-section, .hljs-name { color: #7EC4E8; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #D3A6DC; }
.hljs-built_in, .hljs-type, .hljs-class .hljs-title { color: #E5C07B; }
.hljs-meta { color: #8FA898; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.hljs-deletion { color: #E06C75; }

/* ── 文章尾部 ──────────────────────────────────────────── */
.post-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.post-tags-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.tag {
  padding: 0.2rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 100px;
}
.tag:hover {
  color: var(--chip, var(--accent));
  border-color: var(--chip, var(--accent));
  background: color-mix(in srgb, var(--chip, var(--accent)) 10%, transparent);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
}
@media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } }
.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.15rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
}
.post-nav-item:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.post-nav-item.is-next { text-align: right; }
.post-nav-dir { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-4); }
.post-nav-title {
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related { margin-top: 3rem; padding-top: 2rem; border-top: 2px solid var(--ink); }
.related-title {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
}
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.2rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
}
.related-card:hover { color: var(--ink); border-color: var(--accent-2); transform: translateY(-2px); }
.related-date { color: var(--ink-4); font-size: 0.7rem; }
.related-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
}

/* ── 登录页 ────────────────────────────────────────────── */
.login-shell {
  min-height: calc(100vh - 20rem);
  display: grid;
  place-items: center;
  padding: clamp(2rem, 6vw, 4rem) var(--gap);
}
.login-card {
  width: 100%;
  max-width: 24rem;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.75rem;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--accent);
}
.login-title { margin: 0 0 0.35rem; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.login-sub { margin: 0 0 1.75rem; color: var(--ink-3); font-size: 0.88rem; }
.login-error {
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.86rem;
  color: #A93226;
  background: rgba(181, 101, 29, 0.10);
  border: 1px solid rgba(181, 101, 29, 0.3);
  border-radius: var(--radius);
}
[data-theme="dark"] .login-error { color: #E8A08A; }
.login-form { display: flex; flex-direction: column; gap: 1.05rem; }
.login-back { margin: 1.5rem 0 0; text-align: center; font-size: 0.84rem; }
.login-back a { color: var(--ink-4); }
.login-back a:hover { color: var(--accent); }

/* ── 表单字段 ──────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field-hint { font-style: normal; font-size: 0.68rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-4); }
.field input, .field textarea, .field select {
  padding: 0.62rem 0.85rem;
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-lg input { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; padding: 0.75rem 0.9rem; }
.field-sm input, .field-sm select { padding: 0.45rem 0.6rem; font-size: 0.87rem; }

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.6rem;
  font-size: 0.87rem;
  color: var(--ink-2);
  cursor: pointer;
}
.check-row input { width: auto; accent-color: var(--accent); }

/* ── 错误页 ────────────────────────────────────────────── */
.error-shell {
  min-height: calc(100vh - 20rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(3rem, 8vw, 6rem) var(--gap);
}
.error-code {
  margin: 0 0 0.75rem;
  font-size: clamp(3.5rem, 12vw, 6.5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent-2);
  opacity: 0.28;
}
.error-title { margin: 0 0 0.6rem; font-family: var(--serif); font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 700; }
.error-msg { margin: 0 0 2rem; color: var(--ink-3); max-width: 30em; }
.error-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* ── 页脚 ──────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-title { margin: 0 0 0.2rem; font-family: var(--serif); font-size: 1rem; font-weight: 700; }
.footer-note { margin: 0; color: var(--ink-2); font-size: 0.82rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.15rem; font-size: 0.86rem; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--accent); }
.footer-meta { margin: 0; width: 100%; padding-top: 1.25rem; color: var(--ink-2); font-size: 0.78rem; border-top: 1px solid var(--line); }
.footer-filings {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.footer-filings a {
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}
.footer-filings a:hover { color: var(--accent); }
.footer-icp-link { display: grid; gap: 0.2rem; }
.footer-police-filing { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.footer-police-filing img { flex: none; }
@media (max-width: 700px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ── 入场动画 ──────────────────────────────────────────── */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.hero-text, .hero-card, .page-head, .about-stats { animation: riseIn 0.55s var(--ease) both; }
.hero-card { animation-delay: 0.09s; }
.page-head { animation-delay: 0.04s; }
.about-stats { animation-delay: 0.1s; }

.feed-item, .list-card, .timeline-item, .cat-card, .cloud-tag {
  animation: riseIn 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 0.045s);
}

/* ── 打印 ──────────────────────────────────────────────── */
@media print {
  .masthead, .site-footer, .toc, .post-nav, .related, .code-copy { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { max-width: none; }
}
/* ── 登录入口 / 用户入口 ────────────────────────────────── */
.login-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 100px;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}
.login-link:hover {
  color: var(--paper-2);
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .login-link:hover { color: #10160F; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.7rem 0.2rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: all 0.2s var(--ease);
}
.user-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.user-chip-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar-sm { width: 1.55rem; height: 1.55rem; font-size: 0.72rem; }

@media (max-width: 520px) {
  .login-link span, .user-chip-name { display: none; }
  .login-link { padding: 0.4rem; }
  .user-chip { padding: 0.2rem; }
}

/* ═══════════════════════════════════════════════════════════
   文章页移动端细化（≤640px）
   目标：手机上读长文不费力——标题收敛、代码块不撑破、间距收紧
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* 标题与摘要：手机上一行放不了多少字，字号降一档、行距松一点 */
  .post { padding: 0 var(--gap) 2.5rem; }
  .post-header { padding-top: 1.5rem; margin-bottom: 1.75rem; }
  .post-title {
    font-size: clamp(1.5rem, 6.4vw, 1.9rem);
    line-height: 1.35;
    letter-spacing: -0.012em;
  }
  .post-excerpt {
    font-size: 0.95rem;
    line-height: 1.75;
    padding-left: 0.85rem;
    margin-bottom: 1.35rem;
  }
  .post-meta { gap: 0.45rem; font-size: 0.74rem; }
  .meta-dot { display: none; }          /* 手机上位次用换行表达，不需要圆点 */
  .post-byline { margin-top: 0.35rem; }

  /* 正文排版：段距收紧，标题上留白加大以保持分组感 */
  .prose p { margin: 1rem 0; }
  .prose h2 { margin: 1.9rem 0 0.7rem; font-size: 1.28rem; }
  .prose h3 { margin: 1.6rem 0 0.6rem; font-size: 1.1rem; }
  .prose h4 { margin: 1.4rem 0 0.55rem; font-size: 1rem; }
  .prose h2::before, .prose h3::before { margin-right: 0.45rem; }
  .prose ul, .prose ol { margin: 1rem 0; padding-left: 1.25rem; }
  .prose li { margin: 0.3rem 0; }
  .prose blockquote { margin: 1.4rem 0; padding: 0.2rem 0 0.2rem 0.9rem; }
  .prose blockquote p { font-size: 0.94rem; }

  /* 代码块：字号降一档、内边距收紧，横向滚动由 .code-block pre 自带 */
  .code-block { margin: 1.4rem 0; border-radius: 6px; }
  .code-head { padding: 0.42rem 0.7rem; }
  .code-copy { padding: 0.14rem 0.5rem; font-size: 0.64rem; }
  .code-block pre {
    padding: 0.85rem 0.95rem;
    font-size: 0.78rem;
    line-height: 1.68;
    -webkit-overflow-scrolling: touch;   /* 代码横滑更跟手 */
  }

  /* 表格：手机上左右滑动查看，加一点触感反馈 */
  .prose table { font-size: 0.82rem; -webkit-overflow-scrolling: touch; }
  .prose table th, .prose table td { padding: 0.5rem 0.7rem; white-space: nowrap; }

  /* 文章尾部：上下篇、相关文章在手机上更紧凑 */
  .post-tags { margin-top: 2.25rem; padding-top: 1.25rem; gap: 0.4rem; }
  .post-nav { margin-top: 2.25rem; padding-top: 1.5rem; gap: 0.7rem; }
  .post-nav-item { padding: 0.75rem 0.9rem; }
  .related { margin-top: 2.25rem; }
  .related-grid { gap: 0.6rem; }
  .related-card { padding: 0.8rem 0.9rem; }
  .related-card h3 { font-size: 0.92rem; }
}

/* 超小屏（≤380px）：再收一档，避免 iPhone SE 一类设备换行碎裂 */
@media (max-width: 380px) {
  .post-title { font-size: 1.42rem; }
  .prose h2 { font-size: 1.2rem; }
  .code-block pre { font-size: 0.74rem; padding: 0.75rem 0.85rem; }
  .toc-item a { font-size: 0.73rem; padding: 0.12rem 0.42rem; }
}

/* ═══════════════════════════════════════════════════════════
   相册
   ═══════════════════════════════════════════════════════════ */

/* ── 相册列表 ──────────────────────────────────────────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--gap) clamp(3rem, 7vw, 5rem);
}
.album-card {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.22s var(--ease), border-color 0.22s, box-shadow 0.22s;
}
.album-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-2);
  box-shadow: var(--shadow-md);
}
.album-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper-3);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.album-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease);
}
.album-card:hover .album-cover img { transform: scale(1.04); }
.album-cover-empty { color: var(--ink-4); font-size: 0.82rem; }
.album-count {
  position: absolute;
  right: 0.6rem; bottom: 0.6rem;
  padding: 0.16rem 0.5rem;
  font-size: 0.7rem;
  color: var(--paper-2);
  background: rgba(20, 28, 22, 0.62);
  border-radius: 100px;
  backdrop-filter: blur(4px);
}
[data-theme="dark"] .album-count { color: #10160F; background: rgba(232, 240, 233, 0.72); }
.album-info { padding: 0.85rem 1rem 1rem; }
.album-name {
  margin: 0 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
}
.album-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 相册详情：瀑布流照片网格 ────────────────────────────
   用 CSS columns 实现真正的 masonry：每张照片按自身宽高比占位，
   竖构图与横构图混排时不会出现网格对齐留下的空白。
   代价是阅读顺序为"先列后行"，对照片墙是可接受的。 */
.photo-grid {
  columns: 2;
  column-gap: clamp(0.6rem, 1.6vw, 1rem);
  margin-top: 0.5rem;
}
@media (min-width: 880px) {
  .photo-grid { columns: 3; }
}
.photo-item {
  margin: 0 0 clamp(0.6rem, 1.6vw, 1rem);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  break-inside: avoid;                 /* 关键：不允许照片被列切断 */
  transition: transform 0.22s var(--ease), border-color 0.22s, box-shadow 0.22s;
}
.photo-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
  box-shadow: var(--shadow-md);
}
.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--paper-3);
  cursor: zoom-in;
  line-height: 0;
}
.photo-open img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s var(--ease);
}
.photo-item:hover .photo-open img { transform: scale(1.03); }
.photo-caption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem 0.7rem;
}
.photo-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.photo-text {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-4);
}

/* ── 灯箱 ──────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 2vw, 1.5rem);
  padding: clamp(1rem, 4vw, 2.5rem);
  background: rgba(14, 20, 16, 0.92);
  animation: lbFade 0.2s var(--ease);
}
.lightbox[hidden] { display: none; }
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: min(100%, 62rem);
  max-height: 100%;
}
.lightbox-img {
  max-width: 100%;
  max-height: min(78vh, 60rem);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}
.lightbox-caption {
  text-align: center;
  color: #C9D6CC;
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 34rem;
}
.lightbox-caption:empty { display: none; }
.lightbox-caption strong { color: #E8F0E9; font-weight: 600; }
.lightbox-close, .lightbox-nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.6rem; height: 2.6rem;
  padding: 0;
  font: inherit;
  color: #D5E0D8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.lightbox-close:hover, .lightbox-nav:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}
.lightbox-close { top: 1rem; right: 1rem; font-size: 0.95rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); font-size: 1.6rem; line-height: 1; }
.lightbox-nav.is-prev { left: clamp(0.5rem, 2vw, 1.25rem); }
.lightbox-nav.is-next { right: clamp(0.5rem, 2vw, 1.25rem); }

/* 相册页移动端 */
@media (max-width: 640px) {
  .album-grid { gap: 0.85rem; padding-bottom: 2.5rem; }
  .photo-grid { columns: 2; column-gap: 0.5rem; }
  .photo-item { margin-bottom: 0.5rem; }
  .photo-caption { padding: 0.5rem 0.6rem 0.55rem; }
  .photo-title { font-size: 0.8rem; }
  .photo-text { font-size: 0.74rem; }
  .lightbox { padding: 0.75rem; }
  .lightbox-img { max-height: 72vh; }
  .lightbox-close, .lightbox-nav { width: 2.3rem; height: 2.3rem; }
  .lightbox-caption { font-size: 0.8rem; }
}

/* ── 手记：列表（书目录式）────────────────────────────────
   设计意图：像翻一本书的目录。日期在左、标题与首句在右，
   靠留白和极细的分隔线分组，列表本身不抢戏。 */
.notes-page {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gap) clamp(3rem, 7vw, 5rem);
}
.notes-header { margin-bottom: clamp(1.8rem, 5vw, 2.8rem); }
.notes-title {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 4vw, 2.1rem);
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--ink);
}
.notes-sub {
  margin-top: 0.55rem;
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--ink-4);
  letter-spacing: 0.05em;
}
.notes-empty {
  padding: 3rem 0;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink-4);
  text-align: center;
}

.note-list { list-style: none; margin: 0; padding: 0; }
.note-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.05rem, 3vw, 1.5rem) 0;
  border-bottom: 1px solid var(--line);
}
.note-entry:last-child { border-bottom: 0; }

.note-link {
  /* grid 而非 flex：minmax(0, 1fr) 允许内容列收缩，
     否则 nowrap 的首句会把整页撑宽（移动端会撑到 1700px+） */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: clamp(0.75rem, 2.4vw, 1.5rem);
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  color: inherit;
  text-decoration: none;
}
.note-date {
  flex: none;
  font-size: 0.74rem;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}
.note-main {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  overflow: hidden;
}
.note-name {
  font-family: var(--serif);
  font-size: 1.12rem;
  color: var(--ink);
  letter-spacing: 0.04em;
  transition: color 0.18s var(--ease);
  overflow-wrap: anywhere;          /* 超长标题也不撑破容器 */
}
.note-link:hover .note-name { color: var(--accent); }
.note-line {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-4);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-scene {
  flex: none;
  font-size: 0.72rem;
  color: var(--ink-4);
  letter-spacing: 0.05em;
}

/* ── 手记：详情（散文排版）────────────────────────────────
   关键差异：整篇衬线、首行缩进 2 字、行高 2.05、标题居中；
   没有目录、没有阅读时长、没有代码块那套工程感。 */
.note-article {
  max-width: 38rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gap) clamp(3rem, 7vw, 5rem);
}
.note-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-4);
  text-decoration: none;
  transition: color 0.18s;
}
.note-back:hover { color: var(--accent); }

.note-head {
  margin: clamp(1.6rem, 4vw, 2.4rem) 0 clamp(1.8rem, 5vw, 2.8rem);
  text-align: center;
}
.note-title {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4.2vw, 2rem);
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.14em;
  color: var(--ink);
}
.note-meta {
  margin-top: 0.85rem;
  font-size: 0.75rem;
  color: var(--ink-4);
  letter-spacing: 0.05em;
}

.note-cover { margin: 0 0 clamp(1.8rem, 4vw, 2.6rem); }
.note-cover img {
  display: block;
  width: 100%;
  max-height: 60vh;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius);
}

.note-body {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 2.05;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.note-body p {
  margin: 0 0 1.05em;
  text-indent: 2em;                 /* 中文散文首行缩进 */
}
.note-body p:last-child { margin-bottom: 0; }
/* 图片、引用、列表不做首行缩进 */
.note-body p:has(> img) { text-indent: 0; }
.note-body blockquote p,
.note-body li p { text-indent: 0; }
.note-body img {
  display: block;
  max-width: 100%;
  max-height: 70vh;          /* 竖版大图不撑满整屏，横图仍可占满宽度 */
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 1.6em auto;
  border-radius: var(--radius);
}
.note-body h2, .note-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.note-body h2 { font-size: 1.12rem; margin: 2.2em 0 1em; }
.note-body h3 { font-size: 1rem; margin: 1.8em 0 0.9em; }
.note-body blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 1.1rem;
  border-left: 2px solid var(--line-2);
  color: var(--ink-3);
}

.note-foot {
  margin-top: clamp(2.4rem, 6vw, 3.6rem);
  text-align: center;
}
.note-end {
  margin: clamp(2.2rem, 6vw, 3.2rem) 0 0;
  font-size: 0.9rem;
  color: var(--ink-4);
  letter-spacing: 0.4em;
  text-align: center;
}

@media (max-width: 560px) {
  .note-entry { flex-wrap: wrap; gap: 0.4rem; }
  .note-link { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .note-main { width: 100%; }
  .note-scene { padding-left: 0; }
  .note-name { font-size: 1.05rem; }
  .note-body { font-size: 1rem; line-height: 1.95; }
}

/* ── 手记：上下篇导航 ─────────────────────────────────────
   刻意做轻：不描边、不加底色，只靠一条极细的上分隔线和留白，
   避免在散文页面里塞进"组件感"。 */
.note-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.2rem;
  margin-top: clamp(1.6rem, 4vw, 2.2rem);
  padding-top: clamp(1.4rem, 4vw, 2rem);
  border-top: 1px solid var(--line);
}
.note-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.note-nav-item.is-next { text-align: right; align-items: flex-end; }
.note-nav-dir {
  font-size: 0.72rem;
  color: var(--ink-4);
  letter-spacing: 0.06em;
}
.note-nav-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-2);
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
  transition: color 0.18s var(--ease);
}
.note-nav-item:hover .note-nav-title { color: var(--accent); }

@media (max-width: 560px) {
  .note-nav { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .note-nav-item.is-next { text-align: left; align-items: flex-start; }
}

/* ── 正文配图：尺寸与图说 ─────────────────────────────────
   语法：![图说|50%](url)。宽度挂在 figure 的 class 上，
   不用内联 style（被 sanitize 剥掉，也更安全）。 */
.fig {
  margin: clamp(1.6rem, 4vw, 2.2rem) 0;
  text-align: center;
}
.fig img {
  display: inline-block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border-radius: var(--radius);
}
.fig figcaption {
  margin-top: 0.7rem;
  font-size: 0.76rem;
  line-height: 1.65;
  color: var(--ink-4);
  letter-spacing: 0.03em;
}
.fig.w25 img { width: 25%; }
.fig.w50 img { width: 50%; }
.fig.w75 img { width: 75%; }
.fig.w100 img { width: 100%; }

/* 通栏：比正文宽出两侧，但不突破视口，避免横向滚动 */
.fig.is-full {
  width: calc(100% + clamp(0rem, 8vw, 7rem));
  margin-left: calc(-1 * clamp(0rem, 4vw, 3.5rem));
}
.fig.is-full img { width: 100%; max-height: 78vh; }

/* 手记：图说用衬线，与正文气质一致 */
.note-body .fig figcaption {
  font-family: var(--serif);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

@media (max-width: 760px) {
  .fig.is-full { width: 100%; margin-left: 0; }
  .fig.w25 img { width: 35%; }   /* 手机上 25% 太小，适度提一点 */
  .fig.w50 img { width: 60%; }
}

/* ── 正文图片点击放大 ───────────────────────────────────── */
.img-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(18, 20, 18, 0.92);
  cursor: zoom-out;
}
.img-viewer[hidden] { display: none; }
.img-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
}
.img-viewer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);   /* 图片亮时也能看清 */
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
.img-viewer-close:hover { background: rgba(0, 0, 0, 0.75); }
