/* ============================================================
   银河娱乐中心 / 共享站点样式  assets/site.css
   ============================================================ */

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

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

body,
h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }

ul, ol { list-style: none; padding: 0; }

img, svg, video { max-width: 100%; height: auto; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(53, 240, 224, 0.22);
}

::selection {
  background: var(--gold);
  color: var(--ink);
}

/* ---------- 2. 设计变量 ---------- */
:root {
  --ink: #070B1E;
  --ink-2: #101A3C;
  --violet: #3B2A6B;
  --gold: #FFC65C;
  --cyan: #35F0E0;
  --paper: #F4F1EA;
  --muted: #A8B2CC;
  --deep: #0A0A0F;
  --ok: #38D9A9;
  --alert: #FF8A5B;

  --text: rgba(244, 241, 234, 0.9);
  --line: rgba(168, 178, 204, 0.26);
  --line-strong: rgba(168, 178, 204, 0.48);
  --gold-soft: rgba(255, 198, 92, 0.12);
  --cyan-soft: rgba(53, 240, 224, 0.12);

  --font-sans: "HarmonyOS Sans SC", "Source Han Sans SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Han Serif SC", "Songti SC", "Noto Serif SC", Georgia,
    "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Roboto Mono", ui-monospace, "SFMono-Regular",
    Consolas, "Liberation Mono", monospace;

  --header-h: 76px;
  --header-h-sm: 60px;
  --gutter: 64px;
  --max-w: 1320px;
  --shadow: 0 18px 40px rgba(7, 11, 30, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 480ms;
}

/* ---------- 3. 基础排版 ---------- */
body {
  min-height: 100vh;
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 16% -6%, rgba(59, 42, 107, 0.62), transparent 44%),
    radial-gradient(circle at 88% 4%, rgba(53, 240, 224, 0.10), transparent 38%),
    radial-gradient(circle at 50% 118%, rgba(255, 198, 92, 0.08), transparent 46%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0.02em;
  color: var(--paper);
  text-wrap: balance;
}

h1 { font-size: clamp(30px, 4.4vw, 56px); }
h2 { font-size: clamp(24px, 3vw, 38px); color: rgba(244, 241, 234, 0.92); }
h3 { font-size: clamp(18px, 2vw, 22px); color: var(--gold); }
h4 { font-size: 16px; color: var(--paper); }

p { max-width: 38em; }
p + p { margin-top: 1.2em; }

strong { color: var(--paper); font-weight: 700; }

small { font-size: 13px; color: var(--muted); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.94em;
  color: var(--cyan);
}

/* ---------- 4. 通用工具 ---------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 400;
  padding: 12px 22px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--ink);
  transition: top 0.2s var(--ease);
}

.skip-link:focus-visible { top: 12px; }

#main-content {
  display: block;
  padding-top: var(--header-h);
}

.hero--overlap {
  margin-top: calc(var(--header-h) * -1);
  padding-top: var(--header-h);
}

/* ---------- 5. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background-color 0.2s, color 0.2s,
    border-color 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.98); }

.btn--gold {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
  box-shadow: 4px 4px 0 rgba(53, 240, 224, 0.32);
}

.btn--gold:hover {
  background: #FFD784;
  box-shadow: 4px 4px 0 rgba(255, 198, 92, 0.42), 0 0 26px rgba(255, 198, 92, 0.36);
}

.btn--ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

.btn--sm {
  min-height: 44px;
  padding: 8px 18px;
  font-size: 14px;
}

/* ---------- 6. 品牌标识 ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--paper);
  min-height: 44px;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid var(--gold);
  border-radius: 50%;
  transition: border-color 0.24s var(--ease), transform 0.24s var(--ease);
}

.brand-orbit {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(53, 240, 224, 0.6);
  border-radius: 50%;
  transform: rotate(-28deg) scaleY(0.42);
  transition: transform 0.5s var(--ease), border-color 0.24s;
}

.brand-core {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(255, 198, 92, 0.9);
}

.brand:hover .brand-orbit { transform: rotate(24deg) scaleY(0.42); border-color: var(--gold); }
.brand:hover .brand-mark { border-color: var(--cyan); }

.brand-text {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--paper);
}

.brand-short {
  display: none;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--paper);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- 7. 头部 ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.site-header[data-scrolled] {
  background: rgba(7, 11, 30, 0.95);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 32px rgba(7, 11, 30, 0.6);
}

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

.site-header[data-scrolled] .header-inner { height: var(--header-h-sm); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  margin-left: auto;
}

.header-mail {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.header-mail:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ---------- 8. 主导航 ---------- */
.primary-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: clamp(2px, 1vw, 16px);
}

.nav-item { position: relative; }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.24s var(--ease);
}

.nav-link:hover,
.nav-link:focus-visible { color: var(--cyan); }

.nav-link:hover::after,
.nav-link:focus-visible::after { transform: scaleX(1); }

.nav-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
    background-color 0.2s, box-shadow 0.2s;
}

.nav-link[aria-current="page"] { color: var(--gold); }

.nav-link[aria-current="page"] .nav-dot {
  opacity: 1;
  transform: scale(1);
  background: var(--gold);
  box-shadow: 0 0 10px rgba(255, 198, 92, 0.9);
}

.nav-link[aria-current="page"]::after {
  background: var(--gold);
  transform: scaleX(1);
}

.nav-foot { display: none; }

.nav-foot-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(168, 178, 204, 0.72);
}

.nav-foot a {
  display: block;
  color: var(--circle, var(--cyan));
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  word-break: break-all;
}

.nav-foot a:hover { color: var(--gold); }

/* 抽屉开关 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  background: transparent;
  border: 2px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.nav-toggle:hover { border-color: var(--cyan); color: var(--cyan); }

.nav-toggle-glyph {
  display: grid;
  gap: 5px;
  width: 16px;
}

.nav-toggle-glyph span {
  display: block;
  height: 2px;
  background: currentColor;
  transition: transform 0.24s var(--ease);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-glyph span:first-child {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-glyph span:last-child {
  transform: translateY(-7px) rotate(-45deg);
}

/* 抽屉遮罩 */
.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(7, 11, 30, 0.68);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

body.nav-open .nav-scrim { opacity: 1; visibility: visible; }

/* ---------- 9. 移动端星图抽屉 ---------- */
@media (max-width: 1080px) {
  body.nav-open { overflow: hidden; }

  .nav-toggle { display: inline-flex; }

  .primary-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    width: min(88vw, 360px);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    padding: calc(var(--header-h) + 24px) 24px 32px;
    background: linear-gradient(180deg, var(--ink-2) 0%, var(--ink) 68%);
    border-left: 2px solid var(--violet);
    box-shadow: var(--shadow);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(102%);
    transition: transform 0.36s var(--ease);
  }

  .primary-nav[data-open] { transform: translateX(0); }

  .nav-list {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-left: 28px;
  }

  .nav-list::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: linear-gradient(180deg, var(--cyan), var(--violet) 70%, transparent);
  }

  .nav-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 50%;
    width: 11px;
    height: 11px;
    margin-top: -5.5px;
    border-radius: 50%;
    background: var(--ink);
    border: 2px solid rgba(53, 240, 224, 0.6);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  }

  .nav-item:has(.nav-link[aria-current="page"])::before {
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(255, 198, 92, 0.85);
  }

  .nav-link {
    width: 100%;
    min-height: 52px;
    padding: 12px 6px;
    font-size: 16px;
    border-bottom: 1px solid rgba(168, 178, 204, 0.14);
  }

  .nav-link::after { display: none; }

  .nav-list .nav-item:first-child .nav-link {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.06em;
  }

  .nav-list .nav-item:first-child { margin-bottom: 6px; }

  .nav-link[aria-current="page"] { color: var(--gold); }

  .nav-foot {
    display: grid;
    gap: 6px;
    margin-top: auto;
    padding-top: 28px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 1200px) {
  .header-mail { display: none; }
}

@media (max-width: 520px) {
  .brand-name { display: none; }
  .brand-short { display: block; }
  .brand-sub { font-size: 8px; letter-spacing: 0.2em; }
  .header-inner { gap: 12px; }
  .btn--sm { padding: 8px 12px; font-size: 13px; }
}

/* ---------- 10. 页脚 ---------- */
.site-footer {
  position: relative;
  margin-top: clamp(48px, 8vw, 96px);
  background: var(--deep);
  color: var(--muted);
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--violet) 46%, var(--gold) 100%);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 0.9fr 1.2fr;
  gap: clamp(24px, 4vw, 56px);
  padding-block: clamp(40px, 6vw, 72px);
}

.brand--footer { margin-bottom: 4px; }

.footer-tagline {
  margin: 16px 0 20px;
  max-width: 24em;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(244, 241, 234, 0.78);
}

.footer-cta { margin-top: 2px; }

.footer-col { min-width: 0; }

.footer-title {
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.82);
}

.footer-links {
  display: grid;
  gap: 10px;
}

.footer-links a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  text-underline-offset: 4px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--cyan);
  text-decoration: underline;
}

.footer-contact-list { gap: 14px; }

.footer-contact-list li { display: grid; gap: 2px; }

.footer-contact-list li > span:last-child {
  font-size: 14px;
  color: rgba(244, 241, 234, 0.82);
}

.footer-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(168, 178, 204, 0.7);
}

.footer-note {
  max-width: 26em;
  margin-top: 16px;
  padding-left: 12px;
  border-left: 2px solid rgba(255, 198, 92, 0.5);
  font-size: 12px;
  line-height: 1.65;
  color: rgba(168, 178, 204, 0.78);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-block: 20px;
  border-top: 1px solid rgba(168, 178, 204, 0.16);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: rgba(168, 178, 204, 0.7);
}

.footer-icp { white-space: nowrap; }

@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: flex-start; }
}

/* ---------- 11. 章节与正文组件 ---------- */
.section {
  position: relative;
  padding-block: clamp(56px, 8vw, 112px);
}

.section--band {
  background: linear-gradient(180deg, rgba(16, 26, 60, 0.92), rgba(16, 26, 60, 0.52));
  border-block: 1px solid var(--line);
}

.section--violet {
  background: linear-gradient(135deg, rgba(59, 42, 107, 0.85), rgba(7, 11, 30, 0.92));
  border-block: 1px solid rgba(53, 240, 224, 0.2);
}

.section--paper {
  background: var(--paper);
  color: #1A1F33;
}

.section--paper h2,
.section--paper h3,
.section--paper h4 { color: #0A0A0F; }

.section--paper .eyebrow { color: #5B4B9E; }

.section-head {
  display: grid;
  gap: 14px;
  max-width: 62ch;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
}

.chapter-no {
  display: block;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(40px, 7vw, 88px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: rgba(255, 198, 92, 0.18);
  -webkit-text-stroke: 1px rgba(255, 198, 92, 0.6);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(24px, 4vw, 64px);
}

.grid {
  display: grid;
  gap: clamp(16px, 2.4vw, 28px);
}

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* 面板 */
.panel {
  position: relative;
  padding: clamp(20px, 3vw, 32px);
  background: rgba(16, 26, 60, 0.86);
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.panel--accent { border-color: rgba(53, 240, 224, 0.42); }
.panel--gold { border-color: rgba(255, 198, 92, 0.45); }

/* 胶囊标签 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(168, 178, 204, 0.06);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.pill--gold {
  color: var(--gold);
  border-color: rgba(255, 198, 92, 0.5);
  background: var(--gold-soft);
}

.pill--cyan {
  color: var(--cyan);
  border-color: rgba(53, 240, 224, 0.5);
  background: var(--cyan-soft);
}

.pill--violet {
  color: #C6B4FF;
  border-color: rgba(59, 42, 107, 0.9);
  background: rgba(59, 42, 107, 0.5);
}

/* 面包屑 */
.breadcrumbs {
  padding-block: 20px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.breadcrumbs li + li::before {
  content: "/";
  color: rgba(168, 178, 204, 0.55);
}

.breadcrumbs a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}

.breadcrumbs a:hover { color: var(--cyan); }

.breadcrumbs [aria-current="page"] { color: rgba(244, 241, 234, 0.86); }

/* 图片容器 */
.media-frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: linear-gradient(150deg, var(--ink-2), var(--violet));
  border: 2px solid var(--line-strong);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(53, 240, 224, 0.12), transparent 58%);
  pointer-events: none;
}

.media-frame:hover img { transform: scale(1.03); }

.media-frame--wide { aspect-ratio: 21 / 9; }
.media-frame--square { aspect-ratio: 1 / 1; }
.media-frame--portrait { aspect-ratio: 4 / 5; }

@media (max-width: 640px) {
  .media-frame--wide { aspect-ratio: 16 / 10; }
}

/* 章节目录跟随 */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.toc a:hover { color: var(--cyan); }

.toc a[aria-current="true"] {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: var(--cyan-soft);
}

@media (min-width: 1081px) {
  .toc {
    position: sticky;
    top: calc(var(--header-h-sm) + 24px);
    flex-direction: column;
    flex-wrap: nowrap;
  }
}

/* ---------- 12. 阅读进度与返回顶部 ---------- */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: var(--ink-2);
  border: 2px solid var(--line-strong);
  border-radius: 0;
  color: var(--paper);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease),
    visibility 0.3s, border-color 0.2s, color 0.2s;
}

.to-top[data-visible] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px var(--cyan-soft);
}

@media (max-width: 640px) {
  .to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; }
}

/* ---------- 13. 入场显现 ---------- */
[data-reveal] {
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

html[data-motion="ready"] [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
}

html[data-motion="ready"] [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* ---------- 14. 响应式留白 ---------- */
@media (max-width: 1024px) {
  :root { --gutter: 32px; --header-h: 68px; }
}

@media (max-width: 640px) {
  :root { --gutter: 20px; --header-h: 64px; }
  body { font-size: 15px; }
}

/* ---------- 15. 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal],
  html[data-motion="ready"] [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .media-frame:hover img { transform: none; }
}
