/* ================= 设计变量 ================= */
:root {
  --color-dark: #141838;
  --color-paper: #F7F5F3;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 上下文取色覆盖 */
.dark-surface {
  --_text: var(--color-paper);
  --_link: var(--color-accent);
  --_hl: var(--color-accent);
  --_bg: var(--color-dark);
}
.light-card {
  --_text: var(--color-text);
  --_link: var(--color-brand);
  --_hl: var(--color-brand);
  --_bg: var(--color-paper);
}

/* ================= 基础重置与排版 ================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-brand); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.2em; }
li { margin-bottom: 0.5em; }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
section {
  padding-block: var(--section-y);
  border-bottom: 1px solid rgba(21,23,35,0.08);
}
section:last-of-type { border-bottom: none; }

/* 标题系统 */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: inherit;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.6em; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.5em; }
p { max-width: 38em; margin-bottom: 1em; }
.hl { color: var(--_hl, var(--color-brand)); }

/* 眉标 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6em;
  color: var(--_link, var(--color-brand));
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 2px;
  background: currentColor;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.2em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-1px); background: #5a9cd8; }
.btn-secondary {
  background: transparent;
  color: var(--_text, var(--color-text));
  border: 1px solid var(--_text, var(--color-text));
}
.btn-secondary:hover { transform: translateY(-1px); background: rgba(21,23,35,0.05); }

/* 卡片与面板 */
.card {
  background: var(--_bg, var(--color-paper));
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  color: var(--_text, var(--color-text));
}
.panel {
  background: var(--color-dark);
  border-radius: 12px;
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}
.light-card .panel {
  background: var(--color-paper);
  border: 1px solid rgba(21,23,35,0.1);
  box-shadow: none;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  color: var(--_text, var(--color-text));
  table-layout: fixed;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(21,23,35,0.1);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
th { font-weight: 700; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* 列表与定义列表 */
dl { display: grid; gap: 1.5em; }
dt { font-weight: 700; margin-bottom: 0.3em; display: flex; align-items: center; gap: 0.5em; }
dd { margin-left: 0; padding-left: 0; }
.icon-sm { width: 20px; height: 20px; stroke-width: 1.8; flex-shrink: 0; }

/* FAQ */
details {
  border: 1px solid rgba(21,23,35,0.15);
  border-radius: var(--radius-card);
  margin-bottom: 0.8em;
  background: var(--_bg, var(--color-paper));
  color: var(--_text, var(--color-text));
}
summary {
  padding: 1em;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 0.9em;
}
details[open] summary::before { content: "−"; }
details > div { padding: 0 1em 1em; line-height: 1.7; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247,245,243,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21,23,35,0.08);
}
.dark-surface .site-header { background: rgba(20,24,56,0.95); border-bottom-color: rgba(247,245,243,0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: 1.5em; list-style: none; padding: 0; margin: 0; }
.nav-link { color: var(--_text, var(--color-text)); font-weight: 500; }
.nav-link[aria-current="page"] { color: var(--_hl, var(--color-brand)); text-decoration: underline; text-underline-offset: 4px; }
.site-footer {
  padding: 3em 0;
  border-top: 1px solid rgba(21,23,35,0.1);
  text-align: center;
  color: var(--_text, var(--color-text));
  font-size: 0.9rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.5em; margin-bottom: 1em; list-style: none; }
.footer-links a { color: var(--_link, var(--color-brand)); }

/* 响应式网格 */
.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); }

/* 杂志布局 */
.magazine { display: grid; grid-template-columns: 2fr 1fr; gap: 2em; }
.toc { position: sticky; top: 80px; align-self: start; }
.toc li { margin-bottom: 0.8em; }
.toc a { color: var(--_link, var(--color-brand)); font-size: 0.9rem; }
.toc a:hover { text-decoration: underline; }

/* 时间线 */
.timeline { display: flex; flex-direction: column; gap: 1.5em; counter-reset: step; }
.step-item { display: flex; gap: 1em; align-items: flex-start; counter-increment: step; }
.step-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  display: grid; place-items: center;
  border-radius: 6px;
  font-size: 0.95rem;
}
.step-content { padding-top: 0.4em; }

/* SVG 基础 */
.svg-panel { width: 100%; height: auto; display: block; }
.svg-icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ================= SVG 动效 ================= */
.anim-flow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 5s ease-in-out infinite alternate;
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.anim-float { animation: floatBubble 6s ease-in-out infinite alternate; }
@keyframes floatBubble {
  0% { transform: translateY(0); opacity: 0.7; }
  100% { transform: translateY(-10px); opacity: 1; }
}

.anim-breathe { animation: breathDots 3s ease-in-out infinite; }
@keyframes breathDots {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.anim-slide { animation: slidePanel 7s ease-out infinite alternate; }
@keyframes slidePanel {
  0% { transform: translateX(16px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 旋转/缩放子元素基准 */
.anim-rotate, .anim-scale {
  transform-box: fill-box;
  transform-origin: center;
}
.anim-rotate { animation: spinSlow 12s linear infinite; }
@keyframes spinSlow { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .anim-flow, .anim-float, .anim-breathe, .anim-slide, .anim-rotate, .anim-scale {
    animation: none !important;
  }
}

/* 窄屏适配 */
@media (max-width: 768px) {
  .magazine { grid-template-columns: 1fr; }
  .toc { position: static; border-top: 1px solid rgba(21,23,35,0.1); padding-top: 1em; }
  .header-inner .btn { display: none; }
}
