/* Hallmark · genre: atmospheric · macrostructure: Index-First · theme: Terminal
 * enrichment: none · nav: N8 (prompt + typed ls · cursor=inline-block · width≈80ch)
 * footer: Ft2 (separator=pipe · density=dense)
 * pre-emit critique: P5 H4 E5 S4 R5 V4 · contrast: pass (40-41) · slop: pass (42-45)
 * axes: paper=dark · display=mono · accent=terminal-green
 * 2026-08-10 CLI 化：真实终端会话——命令逐字输入、可交互提示符、
 *   ls -l 对齐、cwd 感知头部、选区反色。深色固定，无主题切换。
 */
:root {
  --color-paper: oklch(13% 0.012 160);
  --color-paper-2: oklch(17% 0.012 160);
  --color-rule: oklch(26% 0.012 160);
  --color-neutral: oklch(58% 0.01 160);
  --color-muted: oklch(72% 0.012 150);
  --color-ink: oklch(93% 0.02 150);
  --color-ink-body: oklch(85% 0.018 150);
  --color-accent: oklch(78% 0.14 145);
  --color-accent-ink: oklch(13% 0.012 160);
  --color-accent-soft: oklch(78% 0.14 145 / 0.12);
  --color-focus: oklch(72% 0.15 145);

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
    "Noto Sans Mono CJK SC", "PingFang SC", "Microsoft YaHei", Consolas, monospace;
  --font-display: var(--font-mono);
  --font-body: var(--font-mono);

  --text-xs: 0.72rem;
  --text-sm: 0.85rem;
  --text-base: 1rem;
  --text-md: 1.2rem;
  --text-lg: 1.5rem;
  --text-xl: 1.875rem;
  --text-2xl: 2.34rem;
  --text-display: clamp(1.8rem, 5vw, 3rem);

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-micro: 120ms;
  --dur-short: 220ms;
  --dur-long: 420ms;

  --rule-hair: 1px;
  --z-sticky: 200;
  --z-sticky-nav: 300;
  --z-dropdown: 400;
}

* { box-sizing: border-box; }
html { overflow-x: clip; }
body {
  overflow-x: clip;
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink-body);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; height: auto; }
a { color: var(--color-accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
::selection {
  background: var(--color-ink);
  color: var(--color-paper);
}

/* ---------- 块光标（打字中 / 提示符） ---------- */
.caret {
  display: inline-block;
  width: 0.62ch;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--color-accent);
  animation: term-blink 1.05s steps(2) infinite;
}
.t-line .caret { opacity: 0; }
.t-line.is-active .caret,
.term-prompt .caret { opacity: 1; }
.t-line.is-done .caret { opacity: 0; }
@keyframes term-blink { 50% { opacity: 0; } }

/* ---------- 动效：输出打印 / 滚动打印 ---------- */
.t-line.is-done + .t-out,
.t-line.is-done + .t-out + .t-out {
  animation: term-print 0.26s steps(3, end) both;
}
.t-line.is-done + .t-out + .t-more {
  animation: term-print 0.24s steps(3, end) 0.12s both;
}
.term-output__line {
  animation: term-print 0.2s steps(3, end) both;
}
@keyframes term-print {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 滚动显现：列表行像终端输出一样打印进来 */
.js-reveal { opacity: 0; }
.js-reveal.is-inview {
  animation: term-print-in 0.22s steps(3, end) both;
  animation-delay: var(--reveal-delay, 0ms);
}
@keyframes term-print-in {
  from { opacity: 0; transform: translateX(-0.6ch); }
  to { opacity: 1; transform: none; }
}

/* ---------- 顶部：命令提示符导航（N8） ---------- */
.term-header {
  border-bottom: 1px solid var(--color-rule);
  padding: var(--space-xs) var(--space-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-nav);
  background: var(--color-paper);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.term-nav-line {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: normal;
  overflow-wrap: anywhere;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 var(--space-xs);
}
.term-nav-line > .prompt { margin-right: var(--space-2xs); }
.term-nav-line .nav-verb { color: var(--color-ink); }
.term-nav-line .nav-link {
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}
.term-nav-line .nav-link::after { content: "/"; color: var(--color-muted); margin-left: 0.35em; }
.term-nav-line .nav-link:hover { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.term-nav-line .nav-link.active { color: var(--color-accent); }
.term-nav-line .nav-link.active::after { color: var(--color-accent); }
.term-nav-line .nav-link__num { display: none; }
.term-nav-line .caret { flex: 0 0 auto; align-self: center; }
.prompt { color: var(--color-accent); }

.term-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.term-actions__inline { display: flex; align-items: center; gap: var(--space-sm); }

.lang-switch-group { display: inline-flex; gap: var(--space-xs); }
.lang-switch { color: var(--color-muted); text-decoration: none; font-size: var(--text-xs); white-space: nowrap; }
.lang-switch:hover { color: var(--color-accent); }
.lang-switch--current { color: var(--color-ink); text-decoration: underline; text-underline-offset: 3px; }
.lang-drawer { position: relative; display: none; }
.lang-drawer__toggle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  color: var(--color-ink);
  padding: 4px 8px;
  cursor: pointer;
}
.lang-drawer__toggle:active { background: var(--color-paper-2); }
.lang-drawer__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  z-index: var(--z-dropdown);
  min-width: 9rem;
  display: none;
}
.lang-drawer.is-open .lang-drawer__panel { display: block; }
.lang-drawer.is-open .lang-drawer__arrow { transform: rotate(180deg); }
.lang-drawer__panel-inner { display: flex; flex-direction: column; }
.lang-drawer__btn { padding: 7px 12px; color: var(--color-ink); text-decoration: none; font-size: var(--text-sm); white-space: nowrap; }
.lang-drawer__btn:hover { background: var(--color-paper-2); }
.lang-drawer__btn--current { color: var(--color-accent); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-rule);
  width: 38px;
  height: 30px;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.nav-toggle span { display: block; width: 18px; height: 1px; background: var(--color-ink); }
.nav-toggle:active { background: var(--color-paper-2); }
.term-brand {
  display: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}
.bp-drawer-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-rule);
  width: 38px;
  height: 30px;
  cursor: pointer;
  padding: 6px;
  align-items: center;
  justify-content: center;
}
.bp-drawer-toggle__dots {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}
.bp-drawer-toggle__dots span {
  display: block;
  width: 18px;
  height: 1px;
  background: var(--color-ink);
}
.bp-drawer-toggle:active { background: var(--color-paper-2); }
.bp-drawer {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  width: min(19rem, calc(100vw - 2rem));
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
  padding: var(--space-sm);
  z-index: var(--z-dropdown);
}
.bp-drawer[hidden] { display: none; }
.bp-drawer__group + .bp-drawer__group {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-rule);
}
.bp-drawer__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 var(--space-2xs);
}

/* ---------- 主体 ---------- */
main {
  padding: var(--space-xl) var(--space-sm) var(--space-2xl);
  max-width: 72rem;
  margin: 0 auto;
}
.term-session, .term-page {
  max-width: 58rem;
  margin: 0 auto;
}
.t-line {
  margin: 0 0 var(--space-xs);
  overflow-wrap: anywhere;
  min-width: 0;
}
.t-line .cmd { white-space: pre-wrap; }
.t-motd {
  margin: 0 0 var(--space-lg);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.t-out {
  margin: 0 0 var(--space-lg);
  padding-left: 2.5ch;
  color: var(--color-ink-body);
  overflow-wrap: anywhere;
  min-width: 0;
}
.t-out--name { color: var(--color-ink); font-size: var(--text-lg); font-weight: 500; }
.t-out--skills { color: var(--color-muted); }
.t-out--skills strong { color: var(--color-accent); font-weight: 500; }
.t-more { margin: 0 0 var(--space-xl); padding-left: 2.5ch; }
.t-list { display: grid; }
.t-contact { display: grid; }

/* ---------- 列表行：ls -l 对齐 ---------- */
.rows { border-top: 1px solid var(--color-rule); }
.row {
  display: grid;
  align-items: baseline;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--color-rule);
  padding: var(--space-xs) 0;
  text-decoration: none;
  color: var(--color-ink);
  transition: background-color var(--dur-micro) var(--ease-out);
}
.row:hover { background: var(--color-paper-2); }
.row--work { grid-template-columns: 12ch 7ch minmax(0, 1fr) auto; }
.row--post { grid-template-columns: 26ch minmax(0, 1fr) auto; }
.row__num {
  font-size: var(--text-sm);
  color: var(--color-muted);
  white-space: pre;
}
.row--work .row__num::before,
.row--post .row__num::before {
  content: "-rw-r--r--";
  color: var(--color-accent);
  margin-right: 0.8em;
  font-size: 0.92em;
}
.row__date { font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; }
.row__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row__title { color: var(--color-ink); font-size: var(--text-base); line-height: 1.4; }
.row:hover .row__title { color: var(--color-accent); }
.row__summary, .row__excerpt { color: var(--color-muted); font-size: var(--text-sm); }
.row__meta { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.row__role { color: var(--color-muted); font-size: var(--text-sm); }
.row__tags { font-size: var(--text-xs); color: var(--color-accent); }

/* ---------- 页面头 ---------- */
.term-head { border-bottom: 1px solid var(--color-rule); padding-bottom: var(--space-sm); margin-bottom: var(--space-lg); }
.term-title {
  font-size: var(--text-display);
  line-height: 1.15;
  margin: 0 0 var(--space-xs);
  color: var(--color-ink);
  overflow-wrap: anywhere;
  min-width: 0;
}
.term-intro { color: var(--color-muted); margin: 0; }
.term-meta { color: var(--color-muted); font-size: var(--text-sm); margin: var(--space-xs) 0 0; }
.term-links { margin: var(--space-xs) 0 0; }
.term-foot { border-top: 1px solid var(--color-rule); margin-top: var(--space-2xl); padding-top: var(--space-md); }
.term-essay-layout { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: var(--space-xl); }
.essay-toc-wrap { min-width: 0; }
.essay-toc { border-left: 1px solid var(--color-rule); padding-left: var(--space-sm); position: sticky; top: 64px; }
.essay-toc__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-xs); }
.essay-toc__label { font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); margin: 0; }
.essay-toc__toggle { font-size: var(--text-xs); background: none; border: 0; color: var(--color-accent); cursor: pointer; padding: 2px; }
.toc__list { list-style: none; margin: var(--space-xs) 0 0; padding: 0; }
.toc__list li { margin: 2px 0; }
.toc__list a { color: var(--color-ink-body); text-decoration: none; font-size: var(--text-sm); line-height: 1.4; }
.toc__list a:hover { color: var(--color-accent); }
.toc__list .num { color: var(--color-muted); margin-right: 0.4em; font-size: 0.8em; }
.toc-group-toggle { font-size: var(--text-xs); color: var(--color-accent); background: none; border: 0; cursor: pointer; padding: 0 0 0 0.4em; }
.toc-subs { list-style: none; padding-left: 1.4em; }
.toc-progress { margin-top: var(--space-sm); display: flex; align-items: center; gap: var(--space-2xs); }
.toc-progress__track { flex: 1; height: 2px; background: var(--color-rule); }
.toc-progress__bar { display: block; height: 2px; background: var(--color-accent); transform-origin: left; }
.toc-progress__num { font-size: var(--text-xs); color: var(--color-muted); }
.essay-cover { margin: 0 0 var(--space-lg); }
.essay-cover img { width: 100%; display: block; border: 1px solid var(--color-rule); }
.essay-end { color: var(--color-accent); }

/* ---------- 正文（cat 输出） ---------- */
.prose { max-width: 72ch; }
.prose p { margin: 0 0 1em; }
.prose h2 {
  font-size: var(--text-lg);
  margin: 1.8em 0 0.6em;
  color: var(--color-ink);
  overflow-wrap: anywhere;
  min-width: 0;
}
.prose h2::before { content: "## "; color: var(--color-accent); }
.prose h3 { font-size: var(--text-md); margin: 1.5em 0 0.5em; color: var(--color-ink); }
.prose h3::before { content: "### "; color: var(--color-accent); }
.prose ul, .prose ol { padding-left: 1.6em; margin: 0 0 1em; }
.prose li { margin: 0.3em 0; }
.prose a { text-underline-offset: 3px; }
.prose blockquote {
  margin: 0 0 1em;
  padding: 0.2em 0 0.2em 1em;
  border-left: 3px solid var(--color-accent);
  color: var(--color-muted);
}
.prose hr { border: 0; border-top: 1px dashed var(--color-rule); margin: var(--space-xl) 0; }
.prose mark { background: var(--color-accent-soft); color: inherit; padding: 0 0.2em; }
.prose code { font-size: 0.9em; background: var(--color-paper-2); padding: 0.1em 0.35em; }
.prose pre { font-size: var(--text-sm); background: var(--color-paper-2); border: 1px solid var(--color-rule); padding: var(--space-sm); overflow-x: auto; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.prose table { border-collapse: collapse; font-size: var(--text-sm); width: 100%; }
.prose th, .prose td { border: 1px solid var(--color-rule); padding: 5px 9px; text-align: left; }
.prose th { background: var(--color-paper-2); font-weight: 500; }

/* Rich article blocks (Hallmark · component: article-prose · theme: Terminal) */
.prose .prose-figure { margin: var(--space-lg) 0; }
.prose .prose-figure img { display: block; width: 100%; border: 1px solid var(--color-rule); }
.prose .prose-figure figcaption {
  margin-top: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-muted);
  text-align: center;
}
.prose .callout {
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-rule);
  border-left: 3px solid var(--color-accent);
  background: var(--color-accent-soft);
}
.prose .callout--tip { border-left-width: 2px; }
.prose .callout--warning {
  border-left-width: 4px;
  background: var(--color-paper-2);
}
.prose .callout__label {
  margin: 0 0 var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.prose .callout--warning .callout__label { color: var(--color-ink); }
.prose .callout__body p { margin: 0 0 var(--space-2xs); }
.prose .callout__body p:last-child { margin-bottom: 0; }
.prose li.task-list-item {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.prose li.task-list-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--color-accent);
  transform: translateY(2px);
}
.prose pre[data-lang] { position: relative; padding-top: calc(var(--space-sm) + 1.1rem); }
.prose pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.prose h2, .prose h3 { position: relative; }
.prose .heading-anchor {
  display: inline-block;
  margin-left: 0.35em;
  font-family: var(--font-mono);
  font-size: 0.7em;
  font-weight: 500;
  color: var(--color-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--dur-micro) var(--ease-out);
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose .heading-anchor:focus-visible { opacity: 1; }

.text-link { color: var(--color-accent); text-decoration: underline double; text-underline-offset: 3px; white-space: nowrap; }
.text-link:hover { text-decoration-thickness: 2px; }

/* ---------- 联系 ---------- */
.contact-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  align-items: baseline;
  border-bottom: 1px solid var(--color-rule);
  padding: var(--space-xs) 0;
  text-decoration: none;
  color: var(--color-ink);
  max-width: 42rem;
}
.contact-row:hover .contact-row__value { color: var(--color-accent); }
.contact-row__label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
.contact-row__value { font-size: var(--text-base); }

/* ---------- 交互提示符 ---------- */
.term-prompt {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  margin: var(--space-2xl) 0 0;
  padding: var(--space-sm) var(--space-xs);
  border-top: 1px solid var(--color-rule);
  background: var(--color-paper-2);
}
.term-prompt .prompt { flex: 0 0 auto; }
.term-prompt__input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  padding: 0;
  caret-color: var(--color-accent);
}
.term-prompt__input::placeholder { color: var(--color-neutral); }
.term-output { margin: var(--space-sm) 0 0; padding-left: 2.5ch; }
.term-output__line { margin: 0 0 0.35em; overflow-wrap: anywhere; min-width: 0; }
.term-output__line--muted { color: var(--color-muted); }
.term-output__line--error { color: var(--color-accent); }
.term-output__line a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.term-output__line .dir { color: var(--color-ink); }
.term-output__line .dir::after { content: "/"; color: var(--color-accent); }

/* ---------- 分页 ---------- */
.pager { display: flex; flex-wrap: wrap; gap: var(--space-md); }
.pager__item { text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.pager__item--next { text-align: right; }
.pager__label { font-size: var(--text-xs); color: var(--color-muted); }
.pager__title { color: var(--color-ink); }
.pager__item:hover .pager__title { color: var(--color-accent); }

/* ---------- 风格档案卡片 ---------- */
.t-archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--space-lg); }
.style-card { position: relative; border: 1px solid var(--color-rule); padding: var(--space-xs); display: flex; flex-direction: column; gap: var(--space-xs); }
.style-card::before { content: "drwxr-xr-x"; position: absolute; top: -0.7em; left: var(--space-xs); background: var(--color-paper); color: var(--color-accent); font-size: var(--text-xs); padding: 0 4px; }
.style-card__preview { display: block; line-height: 0; border: 1px solid var(--color-rule); }
.style-card__preview img { width: 100%; display: block; }
.style-card__meta { display: flex; flex-direction: column; gap: var(--space-2xs); }
.style-card__week { font-size: var(--text-xs); color: var(--color-muted); margin: 0; }
.style-card__name { font-size: var(--text-md); margin: 0; color: var(--color-ink); }
.style-card__summary { color: var(--color-muted); font-size: var(--text-sm); margin: 0; }
.style-card__link { margin-top: var(--space-2xs); }
.style-card__badge {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-size: var(--text-xs);
  padding: 2px 7px;
}

/* ---------- 页脚（Ft2） ---------- */
.term-footer {
  border-top: 1px solid var(--color-rule);
  padding: var(--space-sm) var(--space-sm) var(--space-lg);
  text-align: center;
}
.term-footer p { font-size: var(--text-xs); color: var(--color-muted); margin: 0; line-height: 1.9; }
.term-footer a { color: var(--color-accent); }
.term-footer .colophon__admin, .term-footer .colophon__icp { margin-left: 0.6em; }

.to-top {
  position: fixed;
  right: var(--space-sm);
  bottom: var(--space-sm);
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-rule);
  background: var(--color-paper);
  color: var(--color-accent);
  font-size: var(--text-md);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-short) var(--ease-out);
  z-index: var(--z-sticky);
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:active { opacity: 0.85; }

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  transform-origin: left;
  z-index: 500;
}

@media print {
  .term-header, .to-top, .reading-progress, .nav-toggle, .lang-drawer, .term-prompt, .term-output { display: none !important; }
  .js-reveal, .js-reveal.is-inview,
  .term-output__line {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  body { background: #fff !important; color: #000 !important; }
  .term-session, .term-page { max-width: none; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; }
}

/* ---------- 根目录 ---------- */
.root-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  border-bottom: 1px solid var(--color-rule);
  padding: var(--space-xs) 0;
  color: var(--color-ink);
  text-decoration: none;
}
.root-link:hover { color: var(--color-accent); }
.root-link .num { color: var(--color-muted); font-size: var(--text-xs); }
.root-link .arrow { color: var(--color-accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 40rem) {
  .term-bar {
    flex-wrap: nowrap;
    gap: var(--space-xs);
  }
  .term-brand {
    display: inline-flex;
    flex: 0 0 auto;
  }
  .term-nav-line {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0 var(--space-xs);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .term-nav-line::-webkit-scrollbar { display: none; }
  .term-nav-line .nav-link {
    display: inline-flex;
    flex: 0 0 auto;
  }
  .term-actions {
    position: relative;
    flex: 0 0 auto;
  }
  .term-actions__inline { display: none; }
  .bp-drawer-toggle { display: flex; }
  .bp-drawer { display: block; }
  .bp-drawer .lang-switch-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .bp-drawer .lang-switch,
  .bp-drawer .lang-switch--current {
    display: block;
    padding: var(--space-2xs) 0;
    border-bottom: 1px solid var(--color-rule);
    text-decoration: none;
  }
  .bp-drawer .lang-switch:last-child,
  .bp-drawer .lang-switch--current:last-child { border-bottom: 0; }
  main { padding: var(--space-lg) var(--space-sm) var(--space-xl); }
  .row--work { grid-template-columns: 6ch minmax(0, 1fr); row-gap: var(--space-3xs); }
  .row--work .row__num::before { content: ""; }
  .row--work .row__date { display: none; }
  .row--work .row__body { grid-column: 2; grid-row: 1; }
  .row--work .row__meta { grid-column: 2; grid-row: 2; justify-items: start; text-align: left; }
  .row--post { grid-template-columns: minmax(0, 1fr); }
  .row--post .row__num { display: none; }
  .row--post .row__tags { grid-column: 1; grid-row: 2; text-align: left; white-space: normal; }
  .row__meta { align-items: flex-start; }
  .term-essay-layout { grid-template-columns: minmax(0, 1fr); }
  .essay-toc-wrap { order: -1; }
  .essay-toc { position: static; }
  .t-out { padding-left: 0; }
  .t-more { padding-left: 0; }
  .term-output { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .caret { animation: none; opacity: 1; }
  .t-line .caret { opacity: 1; }
  .js-reveal, .js-reveal.is-inview,
  .t-line.is-done + .t-out, .t-line.is-done + .t-out + .t-out,
  .t-line.is-done + .t-out + .t-more,
  .term-output__line {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
 * 2026-09-02 优化：正文居中 · 分页规范 · 正文块显现 · 防呆加固
 * ========================================================================== */

/* 1. 博客正文页内居中（标题保持终端排版） */
.prose {
  margin-inline: auto;
}

/* 2. 分页条规范化：上一篇左、下一篇右，长标题格内折行 */
.pager {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md) var(--space-lg);
  margin: var(--space-sm) 0;
}
.pager__item {
  flex: 0 1 50%;
  min-width: 0;
}
.pager__item:only-child { flex: 0 1 auto; }
.pager__item:only-child.pager__item--next { margin-left: auto; }
.pager__item:only-child.pager__item--prev { margin-right: auto; }
.pager__item--prev { text-align: left; }
.pager__item--next { text-align: right; }
.pager__label,
.pager__title {
  display: block;
  min-width: 0;
}
.pager__title {
  overflow-wrap: anywhere;
}
.pager__item:hover .pager__title,
.pager__item:focus-visible .pager__title {
  color: var(--color-accent);
}
@media (max-width: 40rem) {
  .pager {
    flex-direction: column;
    align-items: stretch;
  }
  .pager__item {
    flex: 1 1 auto;
    max-width: 100%;
  }
  .pager__item--next { text-align: left; }
}

/* 3. 正文块柔和滚动显现（不套用列表行的打印步骤动效） */
.prose blockquote.js-reveal,
.prose pre.js-reveal,
.prose .callout.js-reveal,
.prose .prose-figure.js-reveal,
.table-wrap.js-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--ease-out),
    transform 0.5s var(--ease-out);
}
.prose blockquote.js-reveal.is-inview,
.prose pre.js-reveal.is-inview,
.prose .callout.js-reveal.is-inview,
.prose .prose-figure.js-reveal.is-inview,
.table-wrap.js-reveal.is-inview {
  opacity: 1;
  transform: none;
  animation: none;
}

/* 4. 显现防呆：is-inview 直接显形，不依赖动画填充 */
.js-reveal.is-inview {
  opacity: 1;
  transform: none;
}

/* 5. hover / 键盘等价态 */
.row:hover,
.row:focus-visible {
  background: var(--color-paper-2);
}
.row:hover .row__title,
.row:focus-visible .row__title {
  color: var(--color-accent);
}
