/* ================================================================
   htmx 之「墨纸·朱砂」 — 设计系统
   明暗共用 CSS 变量，.dark 类整体覆盖；实心按钮用 *-solid token
   ================================================================ */

@font-face {
  font-family: "Fraunces Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fraunces/files/fraunces-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fraunces/files/fraunces-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font-display: "Fraunces Variable", "Fraunces", ui-serif, "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", STSong, SimSun, serif;
  --font-body: var(--font-display);
  --font-mono: "Cascadia Mono", ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;

  /* —— 明：纸墨 —— */
  --paper: #f6f1e6;
  --paper-2: #efe6d5;
  --paper-3: #e7dbc4;
  --card: #fbf8f0;
  --ink: #29231b;
  --ink-soft: #6d6153;
  --ink-faint: #a2937d;
  --line: #d9cbb0;
  --line-strong: #b9a887;

  /* —— 朱砂 —— */
  --cinnabar: #b23a24;
  --cinnabar-deep: #8f2d1b;
  --cinnabar-solid: #a43420;     /* 承载浅色实字的实心底 */
  --on-cinnabar: #f9efe2;
  --cinnabar-wash: rgba(178, 58, 36, 0.08);
  --cinnabar-line: rgba(178, 58, 36, 0.38);

  --gold: #8a6d2f;

  /* —— 墨版（代码）明暗同深 —— */
  --code-bg: #211b13;
  --code-line: #3a3022;
  --code-fg: #e8dfcd;
  --code-attr: #e8a166;
  --code-tag: #d96b4a;
  --code-str: #b8c98a;
  --code-com: #857a63;
  --code-kw: #cf9bc4;

  --shadow: 0 1px 0 rgba(41, 35, 27, 0.06), 0 8px 24px -12px rgba(41, 35, 27, 0.25);
  --shadow-lift: 0 1px 0 rgba(41, 35, 27, 0.05), 0 16px 36px -16px rgba(41, 35, 27, 0.32);
  --radius: 6px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.25, 1);
}

.dark {
  --paper: #17130d;
  --paper-2: #201a12;
  --paper-3: #2a2318;
  --card: #1c1710;
  --ink: #ece2cd;
  --ink-soft: #b5a68c;
  --ink-faint: #7d7059;
  --line: #352c1e;
  --line-strong: #4d412c;

  --cinnabar: #e2704a;
  --cinnabar-deep: #f0855e;
  --cinnabar-solid: #7e2a17;     /* 暗色下实心底仍须深，托住浅色字 */
  --on-cinnabar: #fbeee2;
  --cinnabar-wash: rgba(226, 112, 74, 0.10);
  --cinnabar-line: rgba(226, 112, 74, 0.42);

  --gold: #c9a45c;

  --code-bg: #100c07;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 1px 0 rgba(0, 0, 0, 0.4), 0 18px 40px -18px rgba(0, 0, 0, 0.8);
}

/* ================ 底纹 ================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 82px; }
body {
  margin: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(122, 100, 62, 0.045) 31px 32px),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
  text-rendering: optimizeLegibility;
}
.dark body { background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(230, 200, 140, 0.028) 31px 32px),
    var(--paper); }

::selection { background: var(--cinnabar); color: var(--on-cinnabar); }

a {
  color: var(--cinnabar); text-decoration-color: var(--cinnabar-line);
  text-decoration-thickness: 1px; text-underline-offset: 3px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: var(--cinnabar-deep); text-decoration-color: currentColor; }

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

/* ================ 阅读进度（CSS scroll-driven animation，无 JS；不支持的浏览器静默无条） ================ */
#progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  height: 2px; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--cinnabar-deep), var(--cinnabar));
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  #progress {
    animation: progress-grow linear both;
    animation-timeline: scroll(root);
  }
  @keyframes progress-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
}
/* 报头投影的哨兵（配合 IntersectionObserver） */
#topsentinel { position: absolute; top: 0; left: 0; width: 1px; height: 1px; pointer-events: none; }

/* ================ 骨架 ================ */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
main { max-width: 820px; margin: 0 auto; padding: 40px 0 96px; min-height: 60vh; }

/* boost 换页的正文入场 */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
main.enter { animation: page-enter .42s var(--ease-out) both; }

/* ================ 头部 ================ */
.masthead {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
  transition: box-shadow .25s ease;
}
.masthead.scrolled { box-shadow: 0 12px 32px -22px rgba(0, 0, 0, 0.55); }
.masthead .shell {
  display: flex; align-items: center; gap: 28px;
  padding-top: 14px; padding-bottom: 0; flex-wrap: wrap;
}
.lockup { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.lockup img { width: 38px; height: 38px; display: block; }
.lockup .word {
  font-family: var(--font-display); font-weight: 620; font-size: 26px;
  letter-spacing: 0.01em; line-height: 1;
  font-variation-settings: "opsz" 40;
}
.lockup .word em { font-style: normal; color: var(--cinnabar); }

nav.top { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav.top a {
  position: relative;
  padding: 8px 13px 14px; text-decoration: none; color: var(--ink-soft);
  font-size: 15px; white-space: nowrap;
  transition: color .15s ease;
}
nav.top a::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 9px;
  height: 2px; border-radius: 1px; background: var(--cinnabar);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .22s var(--ease-out);
}
nav.top a:hover { color: var(--ink); }
nav.top a:hover::after { transform: scaleX(0.45); }
nav.top a.active { color: var(--cinnabar); font-weight: 600; }
nav.top a.active::after { transform: scaleX(1); }

.mode-toggle {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-soft);
  border-radius: 99px; padding: 5px 14px; cursor: pointer; font-family: inherit; font-size: 13px;
  transition: color .15s ease, border-color .15s ease;
}
.mode-toggle:hover { color: var(--cinnabar); border-color: var(--cinnabar-line); }

/* ================ 本章路线（toc） ================ */
.chapter-map {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 42px; padding: 12px 16px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--card);
}
.chapter-map .cap {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .24em;
  color: var(--ink-faint); margin-right: 4px;
}
.chapter-map a {
  font-size: 13.5px; color: var(--ink-soft); text-decoration: none;
  background: var(--paper-2); border: 1px solid transparent; border-radius: 99px;
  padding: 3px 13px; white-space: nowrap;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.chapter-map a:hover { color: var(--cinnabar); border-color: var(--cinnabar-line); background: var(--cinnabar-wash); }

/* ================ 文章版式 ================ */
article { max-width: 100%; }
.page-head { position: relative; margin-bottom: 44px; }
h1 {
  position: relative; z-index: 1;
  font-size: clamp(34px, 5vw, 46px); font-weight: 650; line-height: 1.25;
  margin: 0 0 18px; letter-spacing: .01em;
  font-variation-settings: "opsz" 60;
}
/* htmx 变奏：标题下的「请求 → 响应」饰线 */
h1::after {
  content: ""; display: block; margin-top: 18px; height: 0;
  border-top: 1px dashed var(--cinnabar-line);
  background: linear-gradient(90deg, var(--cinnabar) 0 34px, transparent 34px);
}
.lead { font-size: 19.5px; color: var(--ink-soft); line-height: 2; max-width: 40em; }
.lead strong { color: var(--cinnabar); font-weight: 650; }

h2 {
  font-size: 27px; font-weight: 640; margin: 56px 0 14px;
  padding-left: 15px; border-left: 4px solid var(--cinnabar); line-height: 1.4;
  scroll-margin-top: 82px;
}
h3 { font-size: 20px; font-weight: 620; margin: 36px 0 10px; color: var(--ink); scroll-margin-top: 82px; }
h3::before { content: "◆ "; color: var(--cinnabar); font-size: 13px; vertical-align: 2px; }

p { margin: 14px 0; }
ul.prose, ol.prose { padding-left: 24px; }
ul.prose li, ol.prose li { margin: 8px 0; }

blockquote {
  position: relative;
  margin: 26px 0; padding: 18px 24px 18px 30px; background: var(--cinnabar-wash);
  border-left: 3px solid var(--cinnabar); border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink); font-size: 17.5px;
}
blockquote::before {
  content: "“"; position: absolute; top: -6px; left: 8px;
  font-family: var(--font-display); font-size: 54px; line-height: 1;
  color: var(--cinnabar); opacity: .15; pointer-events: none;
}
.note {
  margin: 26px 0; padding: 14px 20px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); background: var(--card); color: var(--ink-soft); font-size: 15.5px;
}
.note::before { content: "※ "; color: var(--cinnabar); font-weight: 700; }
.note b { color: var(--cinnabar); }
.note.caution { border-color: var(--cinnabar-line); background: var(--cinnabar-wash); }
.note.caution::before { color: var(--gold); }

/* ================ 代码 · 墨版 ================ */
figure.code {
  margin: 26px 0; background: var(--code-bg); border: 1px solid var(--code-line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
figure.code figcaption {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-bottom: 1px solid var(--code-line);
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em;
  color: var(--code-com); text-transform: uppercase;
}
figure.code figcaption::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--cinnabar); flex: none; }
figure.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; tab-size: 2; }
figure.code code {
  font-family: var(--font-mono); font-size: 13.8px; line-height: 1.75; color: var(--code-fg);
}
.hl-tag { color: var(--code-tag); }
.hl-attr { color: var(--code-attr); font-weight: 600; }
.hl-str { color: var(--code-str); }
.hl-com { color: var(--code-com); font-style: italic; }
.hl-kw { color: var(--code-kw); }
.hl-num { color: #8fbf8f; }

.code-copy {
  margin-left: auto; flex: none;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: none;
  color: var(--code-com); background: transparent;
  border: 1px solid var(--code-line); border-radius: 4px;
  padding: 2px 10px; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.code-copy:hover { color: var(--code-fg); border-color: var(--code-com); }
.code-copy.done { color: var(--code-str); border-color: var(--code-str); }

code.inline, tt {
  font-family: var(--font-mono); font-size: .86em;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: .1em .4em; border-radius: 4px; color: var(--cinnabar-deep);
  white-space: nowrap;
}
.dark code.inline, .dark tt { color: var(--cinnabar); }

/* hx- 属性角标 */
.attr {
  display: inline-block; font-family: var(--font-mono); font-size: .82em; font-weight: 700;
  color: var(--cinnabar); background: var(--cinnabar-wash);
  border: 1px solid var(--cinnabar-line); border-radius: 4px;
  padding: .05em .5em; margin: 0 .1em; white-space: nowrap;
  letter-spacing: .01em;
}
.attr::before { content: "‹"; opacity: .5; margin-right: .15em; }
.attr::after { content: "›"; opacity: .5; margin-left: .15em; }

/* ================ 表格 ================ */
table { border-collapse: collapse; width: 100%; margin: 24px 0; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 9px 14px; text-align: left; vertical-align: top; }
th:first-child, td:first-child { white-space: nowrap; }
th { background: var(--paper-2); font-weight: 650; letter-spacing: .04em; }
tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-2) 40%, transparent); }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: var(--cinnabar-wash); }
td code.inline { white-space: nowrap; }

/* ================ 卡片 ================ */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 26px 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .18s var(--ease-out), border-color .18s ease, box-shadow .18s ease;
}
.card::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--cinnabar), transparent 70%);
}
.card:hover { transform: translateY(-2px); border-color: var(--cinnabar-line); box-shadow: var(--shadow-lift); }
.card h4 { margin: 0 0 6px; font-size: 17px; }
.card h4 .attr { margin-right: 6px; }
.card p { margin: 4px 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.7; }
a.card-link { text-decoration: none; color: inherit; display: block; }
a.card-link:hover .card { transform: translateY(-3px); border-color: var(--cinnabar-line); }

/* ================ 演示台 ================ */
.demo {
  margin: 30px 0; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.demo:hover { border-color: var(--cinnabar-line); box-shadow: var(--shadow-lift); }
.demo-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: var(--paper-2); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .14em; color: var(--ink-soft);
}
.demo-bar::before {
  content: "演示"; color: var(--on-cinnabar); background: var(--cinnabar-solid);
  padding: 2px 8px; border-radius: 3px; font-family: var(--font-body); letter-spacing: .3em; font-size: 11px;
  flex: none;
}
/* 右端「live」呼吸点：每一台都是与真实服务器的连线 */
.demo-bar::after {
  content: ""; margin-left: auto; flex: none;
  width: 7px; height: 7px; border-radius: 99px; background: var(--cinnabar);
  animation: livepulse 2.4s ease-in-out infinite;
}
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.demo-body { padding: 22px; }
.demo-note { padding: 0 22px 16px; font-size: 13.5px; color: var(--ink-faint); }

.btn {
  display: inline-block; font-family: inherit; font-size: 15px; cursor: pointer;
  background: var(--cinnabar-solid); color: var(--on-cinnabar);
  border: 1px solid var(--cinnabar-solid); border-radius: var(--radius);
  padding: 8px 20px; text-decoration: none;
  transition: filter .15s ease, transform .05s ease, box-shadow .15s ease;
}
.btn:hover { filter: brightness(1.12); color: var(--on-cinnabar); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent; color: var(--cinnabar); border-color: var(--cinnabar-line);
}
.btn.ghost:hover { background: var(--cinnabar-wash); color: var(--cinnabar-deep); }
.btn.sm { font-size: 13px; padding: 4px 12px; }

input.field, textarea.field, select.field {
  font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 8px 12px; width: 100%;
  transition: border-color .15s ease;
}
input.field:focus, textarea.field:focus { outline: 2px solid var(--cinnabar-line); border-color: var(--cinnabar); }
label.lbl { font-size: 13px; color: var(--ink-soft); display: block; margin-bottom: 4px; letter-spacing: .06em; }

/* htmx 请求中指示 */
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; display: inline-block; }
.brush {
  display: inline-block; width: 16px; height: 16px; border-radius: 99px;
  border: 2px solid var(--cinnabar); border-top-color: transparent;
  animation: spin .7s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.htmx-swapping { opacity: 0; transition: opacity .25s ease-out; }
.htmx-settling { background: var(--cinnabar-wash); transition: background 1s ease; }

/* 自动补全 */
.search-wrap { position: relative; max-width: 380px; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 2px 0 0; padding: 4px 0;
  list-style: none; background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-lift);
}
.suggest li { padding: 5px 14px; cursor: pointer; font-size: 14px; transition: background .12s ease; }
.suggest li:hover { background: var(--cinnabar-wash); }
.suggest li b { color: var(--cinnabar); font-family: var(--font-mono); }
.suggest li span { color: var(--ink-faint); font-size: 12.5px; margin-left: 8px; }

/* 回声卡片 */
.echo-card {
  border: 1px solid var(--line); border-left: 4px solid var(--cinnabar);
  border-radius: var(--radius); background: var(--paper); padding: 12px 16px; margin: 10px 0;
  animation: emerge .4s ease;
}
.echo-card h5 { margin: 0 0 4px; font-size: 16px; }
.echo-card p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }
.echo-card .meta { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
@keyframes emerge { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================ 首页 ================ */
.hero { padding: 56px 0 36px; position: relative; }
.hero .kicker {
  display: flex; align-items: center; gap: 16px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .42em;
  color: var(--cinnabar); text-transform: uppercase; margin-bottom: 18px;
}
.hero .kicker::before, .hero .kicker::after {
  content: ""; height: 1px; width: 44px; background: var(--cinnabar-line); flex: none;
}
.hero h1 {
  font-size: clamp(42px, 7vw, 72px); line-height: 1.18; margin: 0 0 8px;
  font-variation-settings: "opsz" 120;
}
.hero h1::after { display: none; }
.hero .sub { font-size: 21px; color: var(--ink-soft); max-width: 30em; margin: 18px 0 30px; }
.hero .sub em { font-style: normal; color: var(--cinnabar); font-weight: 600; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 0; }

/* hero 之下的元信息条（原 hero 内 pill 清单移出，遵守 hero 堆叠纪律） */
.pill-strip {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin: 8px 0 44px; padding: 13px 2px;
}
.pill-strip .pill-list { margin: 0; }

/* 超-纸 饰样：客户端 ⇄ 服务器 */
.hypertext-motif {
  display: flex; align-items: center; gap: 0; margin: 26px 0 4px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
}
.motif-box {
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 12px 22px; background: var(--card); color: var(--ink); text-align: center;
  box-shadow: var(--shadow);
}
.motif-box b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 650; }
.motif-wire { flex: 1; min-width: 90px; text-align: center; position: relative; }
.motif-wire::before {
  content: ""; position: absolute; left: 8%; right: 8%; top: 50%;
  border-top: 1.5px dashed var(--cinnabar-line);
}
.motif-wire i {
  position: relative; z-index: 1; font-style: normal; background: var(--paper);
  padding: 0 8px; color: var(--cinnabar); letter-spacing: .1em;
}

.haiku {
  margin: 70px auto 0; text-align: center; padding: 40px 20px;
  border-top: 1px solid var(--line); position: relative;
}
.haiku p { font-size: 21px; line-height: 2.3; margin: 0; color: var(--ink); letter-spacing: .12em; }
.haiku .src { margin-top: 14px; font-size: 13px; color: var(--ink-faint); letter-spacing: .2em; }

/* 四问 */
.whys { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 40px 0; counter-reset: why; }
.why {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px 16px; position: relative;
  transition: border-color .18s ease, transform .18s var(--ease-out);
}
.why:hover { border-color: var(--cinnabar-line); transform: translateY(-2px); }
.why::before {
  counter-increment: why; content: "0" counter(why);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; color: var(--cinnabar);
}
.why p { margin: 8px 0 0; font-size: 16.5px; line-height: 1.7; }
.why s, .why .old { color: var(--ink-faint); }
.why b { color: var(--ink); }

/* v4 头条 */
.v4-band {
  margin: 46px 0; padding: 26px 26px 22px;
  border: 1px solid var(--cinnabar-line); border-radius: var(--radius);
  background: var(--cinnabar-wash); position: relative;
}
.v4-band::before {
  content: "v4 · 从零重写"; position: absolute; top: -13px; left: 22px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .24em;
  background: var(--cinnabar-solid); color: var(--on-cinnabar);
  padding: 3px 12px; border-radius: 3px;
}
.v4-band h2 { margin: 6px 0 12px; }
.v4-band .cards { margin-bottom: 0; }
.v4-band .card { background: var(--card); }

/* ================ 页脚 ================ */
.colophon { border-top: 1px solid var(--line); margin-top: 40px; padding: 34px 0 44px; }
.colophon .shell { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.colophon .foot-lockup { display: flex; align-items: center; gap: 10px; }
.colophon img { width: 30px; height: 30px; }
.colophon .word { font-weight: 620; font-size: 20px; font-family: var(--font-display); }
.colophon .word em { font-style: normal; color: var(--cinnabar); }
.colophon small { color: var(--ink-faint); font-size: 13px; line-height: 1.8; display: block; }
.colophon a { color: var(--ink-soft); }

/* ================ 其它 ================ */
hr.seal-line {
  border: 0; height: 1px; margin: 64px auto; width: 120px;
  background: linear-gradient(90deg, transparent, var(--cinnabar), transparent);
}
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; padding: 0; list-style: none; }
.pill-list li {
  border: 1px solid var(--line-strong); border-radius: 99px; padding: 3px 14px;
  font-size: 13.5px; color: var(--ink-soft); background: var(--card);
  transition: border-color .15s ease, color .15s ease;
}
.pill-list li:hover { border-color: var(--cinnabar-line); color: var(--ink); }
.pill-list li code { color: var(--cinnabar); font-family: var(--font-mono); font-size: 12.5px; }

.next-hint {
  display: flex; justify-content: space-between; gap: 14px; margin-top: 72px;
  border-top: 1px dashed var(--line-strong); padding-top: 24px; font-size: 15px;
}
.next-hint a {
  text-decoration: none; flex: 1; padding: 12px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  transition: border-color .18s ease, transform .18s var(--ease-out), box-shadow .18s ease;
}
.next-hint a:hover { border-color: var(--cinnabar-line); transform: translateY(-2px); box-shadow: var(--shadow); }
.next-hint .cap { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; color: var(--ink-faint); display: block; }

/* ================ 滚动显影 ================ */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s var(--ease-out); }
.reveal.reveal-in { opacity: 1; transform: none; }

/* ================ 响应式 ================ */
@media (max-width: 1024px) {
  .masthead .shell { flex-wrap: nowrap; gap: 16px; }
  nav.top {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -ms-overflow-style: none; padding-bottom: 2px;
  }
  nav.top::-webkit-scrollbar { display: none; }
  nav.top a { padding: 8px 10px 12px; font-size: 14.5px; }
  nav.top a::after { left: 10px; right: 10px; bottom: 7px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .shell { padding: 0 18px; }
  main { padding: 28px 0 72px; }
  .hero { padding: 48px 0 28px; }
  .hero .sub { font-size: 18px; }
  .hypertext-motif { flex-direction: column; gap: 10px; margin: 34px 0 8px; }
  .motif-wire { min-width: 0; }
  .motif-return { display: none; }
  .chapter-map { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chapter-map::-webkit-scrollbar { display: none; }
  table { font-size: 13.5px; }
  th, td { padding: 7px 10px; }
  th:first-child, td:first-child { white-space: normal; }
  td code.inline { white-space: normal; overflow-wrap: anywhere; }
  .next-hint { flex-direction: column; }
  .cards { grid-template-columns: 1fr; }
  .v4-band { padding: 20px 16px 18px; }
  figure.code code { font-size: 12.8px; }
  .lead { font-size: 17.5px; }
}

@media (max-width: 560px) {
  .lockup img { width: 30px; height: 30px; }
  .lockup .word { font-size: 21px; }
  .mode-toggle { padding: 4px 10px; font-size: 12px; }
}

/* 静态快照角标（仅 GitHub Pages 构建产物中出现） */
.static-note {
  position: fixed; right: 14px; bottom: 14px; z-index: 90;
  max-width: 70vw;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--ink-soft); background: var(--card);
  border: 1px dashed var(--line-strong); border-radius: 99px;
  padding: 4px 12px; opacity: .85; pointer-events: none;
}

/* ================ 动效降级 ================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  main.enter { animation: none; }
  #progress { display: none; }
}
