/* ==========================================================================
   摆脱娱乐 · 共享样式 /assets/site.css
   框架式导航 + 侧边品牌轨道 + 连续画布
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}

a { color: inherit; }

[hidden] { display: none !important; }

/* ---------- tokens ---------- */
:root {
  --c-lake: #0E6E8C;
  --c-deep: #084A60;
  --c-night: #0B1B2B;
  --c-salt: #F4F7F6;
  --c-paper: #EDE6D8;
  --c-flag: #E2762D;
  --c-flag-soft: #F2A46B;
  --c-ink: #16202A;
  --c-rock: #6B7A85;
  --c-line: #BFD9DE;

  --font-display: "Helvetica Neue", "Arial Narrow", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --rail-w: 88px;
  --topbar-h: 64px;
  --shell-max: 1240px;
  --gutter: clamp(18px, 4vw, 56px);
  --gap: 24px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t: 220ms;
}

@media (min-width: 1024px) {
  :root { --topbar-h: 76px; }
}

/* 表格表头 / 章节标题衍生色 */
[data-theme="dark"] {
  --c-salt: #0B1B2B;
  --c-ink: #E4EDEF;
  --c-paper: #10263A;
  --c-line: #1E3A4E;
  --c-rock: #8FA3AC;
}

/* ---------- base ---------- */
html,
body {
  min-height: 100%;
}

body {
  background-color: var(--c-salt);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  padding-left: 0;
  padding-top: var(--topbar-h);
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 1024px) {
  body { padding-left: var(--rail-w); }
}

main { display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--c-deep);
}

h1 { font-size: clamp(40px, 6.4vw, 88px); }
h2 { font-size: clamp(26px, 3.2vw, 40px); }
h3 { font-size: clamp(20px, 2.1vw, 28px); }
h4 { font-size: 21px; letter-spacing: -0.01em; }

p + p { margin-top: 1.2em; }

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--c-rock);
}

:focus-visible {
  outline: 2px solid var(--c-flag);
  outline-offset: 3px;
}

/* ---------- header: skip link ---------- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 16px;
  z-index: 300;
  padding: 10px 18px;
  background: var(--c-night);
  color: var(--c-salt);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform var(--t) var(--ease);
}

@media (min-width: 1024px) {
  .skip-link { left: calc(var(--rail-w) + 16px); }
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--c-flag-soft);
  outline-offset: 2px;
}

/* ---------- header: shell ---------- */
.site-header {
  position: relative;
  z-index: 130;
}

/* ---------- header: brand rail ---------- */
.brand-rail {
  display: none;
}

@media (min-width: 1024px) {
  .brand-rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-w);
    z-index: 140;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 18px 0 20px;
    background-color: var(--c-night);
    border-right: 1px solid rgba(191, 217, 222, 0.22);
    overflow: hidden;
  }
}

.brand-rail__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  background: var(--c-flag);
  color: var(--c-night);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  line-height: 1;
}

.brand-rail__word {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.3em;
  line-height: 1;
  color: #E9F1F2;
}

.brand-rail__tick {
  display: block;
  width: 1px;
  flex: 1 1 auto;
  min-height: 24px;
  background: linear-gradient(180deg, rgba(191, 217, 222, 0.55), rgba(191, 217, 222, 0.06));
}

.brand-rail__anchor {
  writing-mode: vertical-rl;
  padding-right: 9px;
  border-right: 2px solid var(--c-flag);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--c-flag-soft);
  text-decoration: none;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.brand-rail__anchor:hover {
  color: #FFFFFF;
  border-right-color: var(--c-flag-soft);
}

.brand-rail__meta {
  writing-mode: vertical-rl;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--c-flag-soft);
}

.brand-rail__note {
  writing-mode: vertical-rl;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #6E8794;
}

/* ---------- header: topbar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 135;
  height: var(--topbar-h);
  background: rgba(244, 247, 246, 0.96);
  border-bottom: 1px solid var(--c-line);
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}

@media (min-width: 1024px) {
  .topbar { left: var(--rail-w); }
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

html[data-scrolled="true"] .topbar {
  background: rgba(244, 247, 246, 1);
  border-bottom-color: var(--c-lake);
}

/* ---------- header: brand ---------- */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  flex: none;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 21px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--c-deep);
}

.brand__version {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--c-flag);
  border: 1px solid var(--c-flag-soft);
  padding: 2px 6px;
  line-height: 1.2;
}

/* ---------- header: nav ---------- */
.primary-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
}

.primary-nav__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(10px, 1.8vw, 28px);
}

.primary-nav a {
  display: inline-block;
  position: relative;
  padding: 6px 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--c-ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.primary-nav a:hover {
  color: var(--c-lake);
  border-bottom-color: var(--c-flag-soft);
}

.primary-nav a[aria-current="page"] {
  color: var(--c-deep);
  border-bottom-color: var(--c-flag);
}

/* ---------- header: toggle ---------- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--c-line);
  background: transparent;
  color: var(--c-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color var(--t) var(--ease), color var(--t) var(--ease);
}

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

.nav-toggle__bars {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 16px;
  height: 14px;
}

.nav-toggle__bars span {
  display: block;
  height: 2px;
  background: currentColor;
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
}

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

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

/* ---------- header: progress ---------- */
.read-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 2px;
  background: var(--c-flag);
  transition: width 120ms linear;
}

/* ---------- header: mobile ---------- */
@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }

  .primary-nav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    max-height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 6px var(--gutter) 28px;
    background: var(--c-night);
    border-bottom: 2px solid var(--c-flag);
    border-top: 1px solid rgba(191, 217, 222, 0.18);
  }

  .primary-nav[data-open] { display: flex; }

  .primary-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  .primary-nav a {
    display: block;
    padding: 15px 0 15px 12px;
    font-size: 17px;
    color: #E4EDEF;
    border-bottom: 1px solid rgba(191, 217, 222, 0.16);
    border-left: 3px solid transparent;
  }

  .primary-nav a:hover {
    color: var(--c-flag-soft);
    border-bottom-color: rgba(191, 217, 222, 0.16);
  }

  .primary-nav a[aria-current="page"] {
    color: var(--c-flag-soft);
    border-left-color: var(--c-flag);
    border-bottom-color: rgba(191, 217, 222, 0.16);
  }

  html.nav-open,
  html.nav-open body {
    overflow: hidden;
  }
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: clamp(48px, 8vw, 96px);
  background: var(--c-night);
  color: #DCE7E9;
  border-top: 3px solid var(--c-flag);
}

.footer__shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 64px) var(--gutter) 0;
}

.footer__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  padding-bottom: clamp(24px, 3vw, 36px);
  border-bottom: 1px solid rgba(191, 217, 222, 0.18);
}

@media (min-width: 768px) {
  .footer__top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  }
}

.footer__stamp {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--c-flag-soft);
  margin-bottom: 14px;
}

.footer__line {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #EAF3F4;
  max-width: 26ch;
}

.footer__note {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #8FA3AC;
  max-width: 34ch;
}

.footer__nav-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 24px;
}

@media (min-width: 520px) {
  .footer__nav-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.footer__nav-list a {
  display: inline-block;
  padding: 8px 0;
  font-size: 15px;
  font-weight: 600;
  color: #DCE7E9;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.footer__nav-list a:hover {
  color: var(--c-flag-soft);
  border-bottom-color: var(--c-flag);
}

.footer__mid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  padding-block: clamp(24px, 3vw, 36px);
  border-bottom: 1px solid rgba(191, 217, 222, 0.18);
}

@media (min-width: 768px) {
  .footer__mid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

.footer__title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #8FA3AC;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(191, 217, 222, 0.22);
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
  font-size: 15px;
  line-height: 1.6;
}

.contact-list__key {
  min-width: 3em;
  font-size: 12px;
  color: #8FA3AC;
}

.contact-list__val {
  color: #DCE7E9;
  word-break: break-all;
}

.copy-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border: 1px solid rgba(191, 217, 222, 0.35);
  background: transparent;
  color: var(--c-line);
  cursor: pointer;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.copy-btn:hover {
  background: var(--c-flag-soft);
  border-color: var(--c-flag-soft);
  color: var(--c-night);
}

.footer__legal-list {
  display: grid;
  gap: 2px;
}

.footer__legal-list a {
  display: inline-block;
  padding: 7px 0;
  font-size: 15px;
  color: #DCE7E9;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.footer__legal-list a:hover {
  color: var(--c-flag-soft);
  border-bottom-color: var(--c-flag);
}

.footer__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  padding-block: 20px 26px;
  font-size: 13px;
  color: #8FA3AC;
}

.footer__copy,
.footer__icp {
  margin: 0;
}

.footer__icp {
  color: #B9C9CF;
}

.footer__batch {
  margin-left: auto;
  font-size: 12px;
  color: #6E8794;
}

@media (max-width: 599px) {
  .footer__batch { margin-left: 0; }
}

/* ---------- layout: shell / grid ---------- */
.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}

.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

@media (max-width: 767px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-12 {
    grid-column: 1 / -1;
  }
}

/* ---------- layout: sections ---------- */
.section {
  padding-block: clamp(40px, 6vw, 88px);
}

.section--paper {
  background: var(--c-paper);
}

.section--night {
  background: var(--c-night);
  color: #DCE7E9;
}

.section--night h1,
.section--night h2,
.section--night h3 {
  color: #EAF3F4;
}

.rule {
  height: 1px;
  border: 0;
  margin-block: clamp(24px, 4vw, 44px);
  background: var(--c-line);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--c-lake);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  flex: none;
  background: var(--c-flag);
}

/* ---------- text ---------- */
.prose {
  max-width: 68ch;
  font-size: 17px;
  line-height: 1.75;
}

.prose > * + * { margin-top: 1.2em; }

.prose ul,
.prose ol {
  padding-left: 1.2em;
  list-style: disc;
}

.prose ol { list-style: decimal; }

.prose li + li { margin-top: 0.5em; }

/* ---------- breadcrumbs ---------- */
.breadcrumbs {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--c-rock);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0;
  list-style: none;
}

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

.breadcrumbs li + li::before {
  content: "/";
  color: var(--c-line);
}

.breadcrumbs a {
  color: var(--c-lake);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease);
}

.breadcrumbs a:hover { border-bottom-color: var(--c-flag); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.btn--primary {
  background: var(--c-lake);
  color: #FFFFFF;
}

.btn--primary:hover {
  background: var(--c-deep);
}

.btn--ghost {
  border-color: var(--c-lake);
  color: var(--c-deep);
}

.btn--ghost:hover {
  background: var(--c-lake);
  color: #FFFFFF;
}

.btn--flag {
  background: var(--c-flag);
  color: var(--c-night);
}

.btn--flag:hover {
  background: var(--c-flag-soft);
}

/* ---------- tags ---------- */
.tag {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--c-deep);
  border: 1px solid var(--c-line);
  background: transparent;
}

.tag--flag {
  color: var(--c-flag);
  border-color: var(--c-flag-soft);
  background: rgba(226, 118, 45, 0.08);
}

/* ---------- media ---------- */
.media {
  position: relative;
  overflow: hidden;
  background: var(--c-paper);
  border: 1px solid var(--c-line);
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--16x9 { aspect-ratio: 16 / 9; }
.media--4x3 { aspect-ratio: 4 / 3; }
.media--1x1 { aspect-ratio: 1 / 1; }
.media--wide { aspect-ratio: 21 / 9; }

.media__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-color: var(--c-paper);
  background-image:
    repeating-linear-gradient(135deg, rgba(14, 110, 140, 0.1) 0 1px, transparent 1px 14px),
    linear-gradient(180deg, rgba(191, 217, 222, 0.5) 0 1px, transparent 1px);
  background-size: auto, 100% 25%;
  color: var(--c-rock);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.media__caption {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--c-rock);
}

/* ---------- toc ---------- */
.toc {
  display: grid;
  gap: 2px;
}

.toc__link {
  display: block;
  padding: 8px 0 8px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-rock);
  text-decoration: none;
  border-left: 1px solid var(--c-line);
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease), padding-left var(--t) var(--ease);
}

.toc__link:hover {
  color: var(--c-deep);
  border-left-color: var(--c-lake);
}

.toc__link.is-active {
  padding-left: 13px;
  color: var(--c-deep);
  font-weight: 600;
  border-left: 2px solid var(--c-flag);
}

/* ---------- filter ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--c-line);
}

.filter-btn {
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--c-deep);
  border: 1px solid var(--c-line);
  border-bottom-width: 2px;
  background: transparent;
  cursor: pointer;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}

.filter-btn:hover {
  color: var(--c-lake);
  border-color: var(--c-lake);
}

.filter-btn[aria-pressed="true"] {
  color: var(--c-flag);
  border-color: var(--c-flag);
  background: rgba(226, 118, 45, 0.08);
}

[data-filter-item].is-entering {
  animation: item-in var(--t) var(--ease) both;
}

@keyframes item-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- reveal ---------- */
.has-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}

.has-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .has-reveal [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
