/* ==========================================================================
   IM钱包 · 共享站点样式 /assets/site.css
   安全终端 + 编辑部文档 双模：暖纸文档层 · 深靛终端层
   ========================================================================== */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
ul, ol { list-style: none; padding: 0; }
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

/* ---------- 2. Tokens ---------- */
:root {
  --night: #0B1024;
  --black: #04070F;
  --paper: #F5F0E6;
  --paper-2: #E8E0D0;
  --ink: #1A1F2E;
  --ink-muted: #4C5566;
  --ice: #7FD3F7;
  --ice-ink: #0E6E8C;
  --pulse: #35D6A4;
  --pulse-ink: #0F7A5F;
  --gold: #E5B15C;
  --gold-ink: #8A5B12;
  --ridge: #5A6478;
  --alert: #C4553B;
  --hair: #C6BCA8;
  --night-text: rgba(245, 240, 230, .86);
  --night-muted: #96A1B6;
  --night-line: rgba(127, 211, 247, .18);

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-pill: 999px;

  --header-h: 76px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow-night: 0 26px 60px -32px rgba(4, 7, 15, .95);

  --font-display: "Helvetica Neue Condensed", "Arial Narrow", -apple-system, BlinkMacSystemFont, "HarmonyOS Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "HarmonyOS Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

/* ---------- 3. Base ---------- */
body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  padding-top: calc(var(--header-h) + 4px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
[id] { scroll-margin-top: calc(var(--header-h) + 28px); }

/* ---------- 4. Skip link ---------- */
.skip-link {
  position: fixed;
  top: 10px; left: 50%;
  z-index: 200;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  background: var(--pulse);
  color: #04140F;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  transform: translate(-50%, -180%);
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ---------- 5. Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  padding: 12px clamp(12px, 2.4vw, 26px) 0;
  pointer-events: none;
}
.header-shell {
  pointer-events: auto;
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.5vw, 20px);
  padding: 9px clamp(12px, 1.6vw, 20px) 11px;
  border-radius: var(--radius-pill);
  color: var(--paper);
  background: rgba(4, 7, 15, .82);
  border: 1px solid var(--night-line);
  box-shadow: 0 22px 50px -30px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(127, 211, 247, .10);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  backdrop-filter: blur(16px) saturate(130%);
  transition: padding .28s var(--ease), background-color .28s var(--ease), border-color .28s var(--ease);
}
.site-header[data-scrolled] .header-shell {
  padding-top: 6px;
  padding-bottom: 8px;
  background: rgba(4, 7, 15, .94);
  border-color: rgba(127, 211, 247, .28);
}

.brand { display: inline-flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  position: relative;
  flex: none;
  width: 36px; height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(127, 211, 247, .34);
  background:
    radial-gradient(circle at 72% 26%, rgba(53, 214, 164, .42), transparent 62%),
    linear-gradient(155deg, #111B3A 0%, #04070F 100%);
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 9px;
  border-radius: 3px;
  opacity: .72;
  background-image:
    linear-gradient(rgba(127, 211, 247, .55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 211, 247, .55) 1px, transparent 1px);
  background-size: 7px 7px;
}
.brand-pulse {
  position: absolute; top: -3px; right: -3px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--pulse);
  box-shadow: 0 0 0 3px rgba(4, 7, 15, .95);
  animation: signal 2.6s ease-in-out infinite;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-line { font-family: var(--font-display); font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; }
.brand-desc { margin-top: 3px; font-size: 11.5px; letter-spacing: .06em; color: var(--night-muted); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(229, 177, 92, .28);
  background: rgba(229, 177, 92, .09);
  color: var(--gold);
  white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: signal 2.6s ease-in-out infinite; }
.status-text { font-family: var(--font-mono); font-size: 12px; letter-spacing: .01em; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  background: rgba(127, 211, 247, .10);
  border: 1px solid rgba(127, 211, 247, .24);
  color: var(--paper);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.nav-toggle:hover { background: rgba(127, 211, 247, .18); }
.nav-toggle-label { font-size: 13.5px; letter-spacing: .04em; }
.nav-toggle-bars {
  position: relative;
  display: block;
  width: 16px; height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute; left: 0;
  width: 16px; height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .22s var(--ease), opacity .22s var(--ease);
}
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-5px) rotate(-45deg); }

.site-nav {
  position: absolute;
  top: calc(100% + 10px);
  left: 0; right: 0;
  padding: 10px;
  border-radius: 24px;
  background: rgba(4, 7, 15, .97);
  border: 1px solid rgba(127, 211, 247, .20);
  box-shadow: var(--shadow-night);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  max-height: min(72vh, 520px);
  overflow: auto;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s var(--ease);
}
.site-nav[data-open] { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item { width: 100%; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  font-size: 16px;
  letter-spacing: -.01em;
  color: rgba(245, 240, 230, .78);
  transition: color .18s ease, background-color .18s ease;
}
.nav-link:hover { color: var(--paper); background: rgba(127, 211, 247, .10); }
.nav-link[aria-current="page"] { color: var(--pulse); background: rgba(53, 214, 164, .12); }
.nav-link[aria-current="page"]::before {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pulse);
  box-shadow: 0 0 0 4px rgba(53, 214, 164, .16);
  animation: signal 2.6s ease-in-out infinite;
}

.scroll-progress {
  position: absolute;
  left: clamp(14px, 2vw, 24px);
  right: clamp(14px, 2vw, 24px);
  bottom: 5px;
  height: 2px;
  border-radius: 2px;
  background: rgba(127, 211, 247, .14);
  overflow: hidden;
}
.scroll-progress-bar {
  display: block;
  width: 100%; height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--ice), var(--pulse));
  transition: transform .12s linear;
}

/* ---------- 6. Footer ---------- */
.site-footer {
  position: relative;
  margin-top: clamp(56px, 8vw, 110px);
  background: var(--night);
  color: var(--paper);
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .85;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 30%, rgba(245, 240, 230, .50), transparent 60%),
    radial-gradient(1.2px 1.2px at 31% 14%, rgba(127, 211, 247, .55), transparent 60%),
    radial-gradient(1.6px 1.6px at 55% 34%, rgba(245, 240, 230, .34), transparent 60%),
    radial-gradient(1.2px 1.2px at 74% 18%, rgba(53, 214, 164, .50), transparent 60%),
    radial-gradient(1.4px 1.4px at 90% 38%, rgba(245, 240, 230, .40), transparent 60%),
    radial-gradient(1.2px 1.2px at 43% 56%, rgba(127, 211, 247, .30), transparent 60%);
}
.footer-ridge {
  height: clamp(64px, 11vw, 128px);
  background: linear-gradient(180deg, rgba(127, 211, 247, .16), rgba(11, 16, 36, 0) 86%);
  clip-path: polygon(0% 100%, 0% 76%, 8% 54%, 16% 70%, 25% 36%, 33% 62%, 42% 24%, 51% 56%, 60% 38%, 69% 64%, 78% 42%, 87% 66%, 95% 50%, 100% 72%, 100% 100%);
}
.footer-inner { position: relative; z-index: 1; padding-bottom: clamp(26px, 4vw, 44px); }

.footer-brand {
  max-width: 72ch;
  padding-bottom: clamp(24px, 4vw, 40px);
  border-bottom: 1px solid var(--night-line);
}
.footer-brand-line { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.1; }
.footer-brand-desc { margin-top: 10px; font-family: var(--font-mono); font-size: 13px; letter-spacing: .05em; color: var(--ice); }
.footer-closing { margin-top: 16px; max-width: 54ch; font-size: 15px; color: var(--night-text); }

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(26px, 4vw, 46px);
  padding: clamp(28px, 4vw, 44px) 0;
}
.footer-col-title {
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--night-muted);
}
.footer-links { display: flex; flex-direction: column; gap: 11px; }
.footer-link {
  display: inline-block;
  font-size: 15px;
  color: var(--night-text);
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.footer-link:hover { color: var(--ice); border-bottom-color: rgba(127, 211, 247, .55); }

.footer-lines { display: flex; flex-direction: column; gap: 12px; }
.footer-line { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14.5px; color: var(--night-text); }
.footer-key { flex: none; min-width: 62px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ridge); }
.footer-val { color: var(--night-text); word-break: break-word; }
.footer-col--contact .footer-lines { gap: 14px; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid rgba(127, 211, 247, .14);
  font-family: var(--font-mono);
  font-size: 13px;
}
.footer-legal { color: var(--night-muted); }
.footer-copy { color: var(--night-muted); }

/* ---------- 7. Layout ---------- */
.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-inline: clamp(18px, 4vw, 40px);
}
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section--tight { padding: clamp(34px, 5vw, 64px) 0; }
.section--paper { background: var(--paper); color: var(--ink); }
.section--paper-2 { background: var(--paper-2); color: var(--ink); }
.section--night { background: var(--night); color: var(--paper); }
.section--night-2 { background: var(--black); color: var(--paper); }

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 32px);
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-10 { grid-column: span 10; }
.span-12 { grid-column: span 12; }

.section-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 78ch;
  margin-bottom: clamp(26px, 4vw, 48px);
}

/* ---------- 8. Typography ---------- */
.h-display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 5.2vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -.02em;
}
.h-section {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.14;
  letter-spacing: -.02em;
}
.h-sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 1.7vw, 1.35rem);
  line-height: 1.3;
  letter-spacing: -.01em;
}
.chapter-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 9vw, 7rem);
  line-height: .86;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ice-ink);
}
.section--night .chapter-num,
.section--night-2 .chapter-num { color: var(--ice); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ice-ink);
}
.section--night .eyebrow,
.section--night-2 .eyebrow { color: var(--ice); }

.lede {
  max-width: 56ch;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.7;
  color: var(--ink-muted);
}
.section--night .lede,
.section--night-2 .lede { color: var(--night-text); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { font-size: 14.5px; color: var(--ink-muted); }
.section--night .muted,
.section--night-2 .muted { color: var(--night-muted); }

.prose { max-width: 68ch; font-size: 17px; line-height: 1.75; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.4rem, 2.4vw, 1.85rem); line-height: 1.2; letter-spacing: -.02em; }
.prose h3 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.1rem, 1.8vw, 1.3rem); line-height: 1.35; letter-spacing: -.01em; }
.prose strong { font-weight: 700; }
.prose ul { list-style: disc; padding-left: 1.4em; }
.prose ol { list-style: decimal; padding-left: 1.4em; }
.prose li + li { margin-top: .45em; }
.prose a {
  color: var(--ice-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover { color: var(--pulse-ink); }
.prose code, .code {
  font-family: var(--font-mono);
  font-size: .92em;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--paper-2);
  border: 1px solid var(--hair);
}
.section--night .prose,
.section--night-2 .prose { color: var(--night-text); }
.section--night .prose a,
.section--night-2 .prose a { color: var(--ice); }
.section--night .prose code,
.section--night .code,
.section--night-2 .prose code,
.section--night-2 .code {
  background: rgba(127, 211, 247, .10);
  border-color: rgba(127, 211, 247, .24);
  color: var(--ice);
}

/* ---------- 9. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pulse); color: #04140F; }
.btn-primary:hover { background: #2EC795; }
.btn-outline { border-color: rgba(127, 211, 247, .42); color: var(--paper); }
.btn-outline:hover { border-color: var(--ice); background: rgba(127, 211, 247, .10); }
.btn-outline--ink { border-color: rgba(26, 31, 46, .26); color: var(--ink); }
.btn-outline--ink:hover { border-color: var(--pulse-ink); color: var(--pulse-ink); background: rgba(53, 214, 164, .10); }
.btn-gold { border-color: rgba(229, 177, 92, .45); color: var(--gold); }
.btn-gold:hover { background: rgba(229, 177, 92, .12); border-color: var(--gold); }

/* ---------- 10. Breadcrumbs ---------- */
.breadcrumbs { padding-top: clamp(12px, 2vw, 20px); font-size: 13.5px; color: var(--ink-muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crumb { color: var(--ink-muted); transition: color .18s ease; }
.crumb:hover { color: var(--pulse-ink); }
.crumb[aria-current="page"] { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--hair); }
.section--night .breadcrumbs,
.section--night .crumb,
.section--night-2 .breadcrumbs,
.section--night-2 .crumb { color: var(--night-muted); }
.section--night .crumb[aria-current="page"],
.section--night-2 .crumb[aria-current="page"] { color: var(--paper); }

/* ---------- 11. Chips & tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(127, 211, 247, .28);
  background: rgba(127, 211, 247, .08);
  color: var(--ice-ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .02em;
}
.section--night .chip,
.section--night-2 .chip { color: var(--ice); }
.chip--pulse { border-color: rgba(53, 214, 164, .32); background: rgba(53, 214, 164, .10); color: var(--pulse-ink); }
.section--night .chip--pulse,
.section--night-2 .chip--pulse { color: var(--pulse); }
.chip--gold { border-color: rgba(229, 177, 92, .34); background: rgba(229, 177, 92, .10); color: var(--gold-ink); }
.section--night .chip--gold,
.section--night-2 .chip--gold { color: var(--gold); }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hair);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 13px;
}
.section--night .tag,
.section--night-2 .tag {
  background: rgba(127, 211, 247, .08);
  border-color: rgba(127, 211, 247, .20);
  color: var(--night-text);
}

/* ---------- 12. Cards ---------- */
.card {
  padding: clamp(20px, 2.6vw, 28px);
  border-radius: var(--radius-md);
  border: 1px solid var(--hair);
  background: var(--paper-2);
  color: var(--ink);
}
.card--night {
  background: var(--black);
  border-color: rgba(127, 211, 247, .16);
  color: var(--paper);
}
.card--flat { background: transparent; }
.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.06rem; line-height: 1.3; letter-spacing: -.01em; }
.card-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--gold-ink); }
.card--night .card-meta { color: var(--gold); }

/* ---------- 13. Notes ---------- */
.note {
  padding: 15px 20px;
  border-left: 3px solid var(--ice-ink);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: rgba(127, 211, 247, .10);
  font-size: 15.5px;
  line-height: 1.7;
}
.note--pulse { border-left-color: var(--pulse-ink); background: rgba(53, 214, 164, .12); }
.note--gold { border-left-color: var(--gold-ink); background: rgba(229, 177, 92, .13); }
.note--alert { border-left-color: var(--alert); background: rgba(196, 85, 59, .10); font-weight: 600; }
.section--night .note,
.section--night-2 .note {
  border-left-color: var(--ice);
  background: rgba(127, 211, 247, .08);
  color: var(--night-text);
}
.section--night .note--pulse,
.section--night-2 .note--pulse { border-left-color: var(--pulse); background: rgba(53, 214, 164, .10); }
.section--night .note--alert,
.section--night-2 .note--alert { border-left-color: var(--alert); background: rgba(196, 85, 59, .16); }

.aside-note {
  padding-top: 12px;
  border-top: 1px solid var(--hair);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-muted);
}
.section--night .aside-note,
.section--night-2 .aside-note {
  border-color: rgba(127, 211, 247, .18);
  color: var(--night-muted);
}

/* ---------- 14. Media frames ---------- */
.media-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(127, 211, 247, .16);
  background:
    radial-gradient(circle at 74% 22%, rgba(53, 214, 164, .18), transparent 58%),
    linear-gradient(160deg, #101A38 0%, #04070F 100%);
}
.media-frame::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(127, 211, 247, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 211, 247, .07) 1px, transparent 1px);
  background-size: 34px 34px;
}
.media-frame--paper {
  border-color: var(--hair);
  background: var(--paper-2);
}
.media-frame--paper::after { opacity: .5; }
.media-frame--16x9 { aspect-ratio: 16 / 9; }
.media-frame--4x3 { aspect-ratio: 4 / 3; }
.media-frame--1x1 { aspect-ratio: 1 / 1; }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-frame-caption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
}
.section--night .media-frame-caption,
.section--night-2 .media-frame-caption { color: var(--night-muted); }

/* ---------- 15. Timeline ---------- */
.timeline { position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 9px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(127, 211, 247, .38) 12%, rgba(127, 211, 247, .38) 88%, transparent);
}
.timeline-item { position: relative; padding: 0 0 28px 36px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-mark {
  position: absolute;
  left: 0; top: 6px;
  display: grid;
  place-items: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1px solid rgba(127, 211, 247, .42);
  background: var(--black);
}
.timeline-mark::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ice);
}
.timeline-mark--gold::after { background: var(--gold); }
.timeline-mark--pulse::after { background: var(--pulse); }
.timeline-body { font-size: 15.5px; line-height: 1.7; }

/* ---------- 16. Step track ---------- */
.step-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.step {
  position: relative;
  padding: 20px 22px 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hair);
  background: var(--paper-2);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.step-num {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--gold-ink);
}
.step-body { font-size: 15px; line-height: 1.68; }
.step.is-active { border-color: var(--pulse); background: rgba(53, 214, 164, .10); }
.section--night .step,
.section--night-2 .step {
  background: var(--black);
  border-color: rgba(127, 211, 247, .18);
  color: var(--night-text);
}
.section--night .step-num,
.section--night-2 .step-num { color: var(--gold); }
.section--night .step.is-active,
.section--night-2 .step.is-active { border-color: var(--pulse); background: rgba(53, 214, 164, .12); }

/* ---------- 17. Collapse ---------- */
.collapse { border-top: 1px solid var(--hair); }
.collapse summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  font-weight: 600;
  font-size: 15.5px;
  cursor: pointer;
  list-style: none;
}
.collapse summary::-webkit-details-marker { display: none; }
.collapse summary::after {
  content: "+";
  flex: none;
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--ice-ink);
}
.collapse[open] summary::after { content: "–"; color: var(--pulse-ink); }
.collapse-body { padding: 0 0 18px; font-size: 15.5px; line-height: 1.75; }
.section--night .collapse,
.section--night-2 .collapse { border-color: rgba(127, 211, 247, .18); }
.section--night .collapse summary::after,
.section--night-2 .collapse summary::after { color: var(--ice); }

/* ---------- 18. Chapter index ---------- */
.chapter-index {
  position: sticky;
  top: calc(var(--header-h) + 22px);
  align-self: start;
}
.chapter-index-title {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--ridge);
}
.chapter-index-list { display: flex; flex-direction: column; gap: 2px; }
.chapter-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14.5px;
  color: var(--ink-muted);
  transition: color .18s ease, background-color .18s ease;
}
.chapter-link:hover { color: var(--ink); background: rgba(127, 211, 247, .14); }
.chapter-link[aria-current="true"] { color: var(--pulse-ink); background: rgba(53, 214, 164, .13); }
.chapter-idx { font-family: var(--font-mono); font-size: 12px; color: var(--ridge); }
.section--night .chapter-index-title,
.section--night-2 .chapter-index-title { color: var(--night-muted); }
.section--night .chapter-link,
.section--night-2 .chapter-link { color: var(--night-muted); }
.section--night .chapter-link:hover,
.section--night-2 .chapter-link:hover { color: var(--paper); background: rgba(127, 211, 247, .12); }
.section--night .chapter-link[aria-current="true"],
.section--night-2 .chapter-link[aria-current="true"] { color: var(--pulse); background: rgba(53, 214, 164, .14); }

/* ---------- 19. Back to top ---------- */
.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: rgba(4, 7, 15, .92);
  border: 1px solid rgba(127, 211, 247, .28);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .06em;
  box-shadow: var(--shadow-night);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .24s var(--ease), transform .24s var(--ease), visibility .24s var(--ease), border-color .2s ease;
}
.to-top:hover { border-color: var(--ice); }
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top-icon { font-size: 14px; color: var(--pulse); line-height: 1; }

/* ---------- 20. Reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .32s var(--ease), transform .32s var(--ease);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- 21. Keyframes ---------- */
@keyframes signal {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .42; transform: scale(.76); }
}

/* ---------- 22. Responsive ---------- */
@media (max-width: 1140px) {
  .status-chip { display: none; }
}
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .brand-desc { font-size: 11px; }
}
@media (min-width: 961px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static;
    margin-left: auto;
    padding: 0;
    max-height: none;
    overflow: visible;
    background: none;
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .nav-list { flex-direction: row; gap: 3px; }
  .nav-item { width: auto; }
  .nav-link { width: auto; padding: 9px 14px; font-size: 15px; }
  .footer-grid { grid-template-columns: 1.15fr 1fr 1.45fr; }
  :root { --header-h: 82px; }
}
@media (max-width: 900px) {
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10 { grid-column: span 12; }
  .chapter-index { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .brand-desc { display: none; }
  .header-shell { padding: 8px 10px 10px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-mark::after { inset: 8px; background-size: 6px 6px; }
  .footer-base { justify-content: flex-start; }
  .step-track { grid-template-columns: 1fr; }
}

/* ---------- 23. Focus & motion ---------- */
:focus-visible {
  outline: 2px solid var(--ice-ink);
  outline-offset: 3px;
  border-radius: 8px;
}
.site-header :focus-visible,
.site-footer :focus-visible,
.section--night :focus-visible,
.section--night-2 :focus-visible,
.to-top:focus-visible,
.skip-link:focus-visible {
  outline-color: var(--ice);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .brand-pulse, .status-dot, .nav-link[aria-current="page"]::before { animation: none !important; opacity: 1 !important; }
  .scroll-progress-bar { transition: none !important; }
  .to-top { transition: none !important; }
}
