:root {
  /* 色板 */
  --bg-dark: #141838;
  --bg-paper: #FCFCFD;
  --bg-paper-light: #F0F1F4;
  --text-main: #151723;
  --brand: #142CEB;
  --accent: #6EAFED;
  
  /* 结构 token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--text-main);
  --card-shadow: 4px 4px 0 var(--text-main);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  
  /* 排版 token */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-body: 1.55;
  --lh-title: 1.25;
  --fw-title: 600;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--text-main);
  background: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
.dark-surface a { color: var(--accent); }
.dark-surface a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.2em; margin: 0; }
li { margin-bottom: 0.5em; }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 区块节奏 */
.section {
  padding: var(--section-y) 0;
}
.section--dark {
  background: var(--bg-dark);
  color: var(--bg-paper);
}
.section--light {
  background: var(--bg-paper-light);
  color: var(--text-main);
}
/* 深色面内的浅色卡片恢复纸面取色 */
.card--paper {
  background: var(--bg-paper);
  color: var(--text-main);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* 眉标 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.8em;
}
.section--dark .eyebrow { color: var(--accent); }

/* 标题 */
h1, h2, h3, h4 {
  font-weight: var(--fw-title);
  line-height: var(--lh-title);
  letter-spacing: 0;
  margin-top: 0;
  margin-bottom: 0.8em;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.2em; }
h3 { font-size: 1.25rem; margin-bottom: 0.6em; }
.hl { color: var(--brand); }
.section--dark .hl { color: var(--accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  color: var(--bg-dark);
}
.btn--primary:hover { background: #5A9AD6; }
.btn--secondary {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--text-main);
}
.section--dark .btn--secondary {
  color: var(--bg-paper);
  border-color: var(--bg-paper);
}
.btn--secondary:hover { background: rgba(0,0,0,0.05); }
.section--dark .btn--secondary:hover { background: rgba(255,255,255,0.08); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 卡片 */
.card {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  background: var(--bg-paper);
  color: var(--text-main);
}

/* 网格 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid currentColor;
}
th { font-weight: 600; }
td { vertical-align: top; }

/* FAQ */
details {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--bg-paper);
}
summary {
  padding: 1em var(--gap);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 2em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute;
  left: 0.5em;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
}
.section--dark summary::before { background: var(--accent); }
details[open] summary { border-bottom: var(--card-border); }
details p { padding: 1em var(--gap); margin: 0; line-height: var(--lh-body); }

/* 导航与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.section--dark .site-header { background: rgba(20, 24, 56, 0.95); border-color: rgba(255,255,255,0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 0.6em; font-weight: 700; font-size: 1.1rem; color: inherit; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5em; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.section--dark .nav a[aria-current="page"] { color: var(--accent); }
.mobile-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: inherit; }

.footer {
  background: var(--bg-dark);
  color: rgba(252, 252, 253, 0.8);
  padding: 3rem 0;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer h4 { color: var(--bg-paper); margin: 0 0 0.8em; font-size: 1rem; }
.footer ul { list-style: none; padding: 0; }
.footer li { margin-bottom: 0.5em; }
.footer a { color: rgba(252, 252, 253, 0.7); }
.footer a:hover { color: var(--bg-paper); }
.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  color: rgba(252, 252, 253, 0.5);
}

/* 杂志排版深水区 */
.magazine-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--gap);
}
.toc-sidebar {
  position: sticky;
  top: calc(var(--section-y) + 20px);
  font-size: 0.9rem;
}
.toc-sidebar ul { list-style: none; padding: 0; }
.toc-sidebar li { margin-bottom: 0.6em; }
.toc-sidebar a { color: inherit; opacity: 0.7; display: block; padding: 0.3em 0; border-bottom: 1px dashed currentColor; }
.toc-sidebar a:hover { opacity: 1; border-bottom-style: solid; }

/* 图文交错行 */
.alternate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
  margin-bottom: var(--gap);
}
.alternate-row.reverse .visual-panel { order: -1; }
.visual-panel {
  background: var(--bg-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.visual-panel svg { width: 100%; height: 100%; object-fit: contain; }

/* 场景对照 */
.scenario-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: var(--gap);
}
.scenario-context { background: var(--bg-paper-light); padding: var(--gap); }
.scenario-action { padding: var(--gap); }
.step-list { counter-reset: step; list-style: none; padding: 0; }
.step-list li { counter-increment: step; position: relative; padding-left: 2em; margin-bottom: 0.8em; }
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--bg-dark);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

/* SVG 动效基础 */
.svg-anim { width: 100%; height: 100%; }
.anim-float { animation: safewFloat 6s ease-in-out infinite; }
.anim-float-delay-1 { animation-delay: -2s; }
.anim-float-delay-2 { animation-delay: -4s; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: safewDraw 4s ease forwards; }
.anim-breathe { animation: safewBreathe 5s ease-in-out infinite; }
.anim-slide-in { animation: safewSlideIn 4s ease forwards; }

@keyframes safewFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes safewDraw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes safewBreathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes safewSlideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 响应式 */
@media (max-width: 768px) {
  .magazine-layout { grid-template-columns: 1fr; }
  .toc-sidebar { display: none; }
  .alternate-row { grid-template-columns: 1fr; }
  .scenario-box { grid-template-columns: 1fr; }
  .mobile-toggle { display: block; }
  .nav { display: none; }
  .nav.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: inherit; padding: 1em; border-bottom: 1px solid currentColor; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
