:root {
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 主题覆盖：深色面 / 浅色纸面 */
.theme-dark {
  --bg: var(--color-dark);
  --fg: var(--color-paper);
  --fg-secondary: rgba(245, 240, 229, 0.8);
  --accent: var(--color-accent);
  --brand: var(--color-accent);
  --border: rgba(245, 240, 229, 0.15);
  --card-bg: rgba(245, 240, 229, 0.05);
}
.theme-light {
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --fg-secondary: rgba(25, 21, 35, 0.7);
  --accent: var(--color-brand);
  --brand: var(--color-brand);
  --border: rgba(25, 21, 35, 0.16);
  --card-bg: var(--color-paper);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 容器与区块节奏 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding: var(--section-y) 0; position: relative; }
section:not(:last-child)::after {
  content: ""; display: block; height: 1px; width: 100%;
  background: var(--border); margin-top: calc(var(--section-y) * 0.5);
}

/* 排版 */
h1, h2, h3, h4 { line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; color: var(--fg); }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.8rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.6rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.lead { font-size: 1.1rem; line-height: 1.6; color: var(--fg-secondary); margin-bottom: 2rem; }
.hl { color: var(--accent); }
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 0.5rem;
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.5rem; font-size: 1rem; font-weight: 600;
  border-radius: var(--radius-btn); text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.btn-primary {
  background: var(--accent); color: var(--color-dark); border: none;
}
.btn-secondary {
  background: transparent; color: var(--fg); border: 1px solid var(--fg);
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

/* 卡片与网格 */
.card {
  background: var(--card-bg); border: var(--card-border); border-radius: var(--radius-card);
  padding: 1.5rem; box-shadow: var(--card-shadow);
}
.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); }

/* 横向滚动功能带 */
.scroll-strip {
  display: flex; gap: var(--gap); overflow-x: auto; padding-bottom: 1rem;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--fg-secondary) transparent;
}
.scroll-strip::-webkit-scrollbar { height: 6px; }
.scroll-strip::-webkit-scrollbar-thumb { background: var(--fg-secondary); border-radius: 4px; }
.scroll-strip > * { flex: 0 0 320px; scroll-snap-align: start; }
@media (max-width: 768px) { .scroll-strip > * { flex: 0 0 280px; } }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); }
th { font-weight: 700; color: var(--fg); }
td { color: var(--fg-secondary); }

/* FAQ */
details { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
summary { padding: 1rem; cursor: pointer; font-weight: 600; color: var(--fg); list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; }
details[open] summary::after { content: "-"; }
details p { padding: 0 1rem 1rem; color: var(--fg-secondary); }

/* 页头与页脚 */
header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--fg); font-weight: 800; font-size: 1.2rem; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5rem; list-style: none; }
nav a { text-decoration: none; color: var(--fg-secondary); font-weight: 500; transition: color 0.2s; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); }
footer { padding: 3rem 0; border-top: 1px solid var(--border); margin-top: var(--section-y); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a { text-decoration: none; color: var(--fg-secondary); font-size: 0.9rem; }
.footer-links a:hover { color: var(--accent); }
.copyright { color: var(--fg-secondary); font-size: 0.85rem; }

/* SVG 动效基础 */
.svg-container { width: 100%; height: auto; display: block; }
.svg-anim path, .svg-anim circle, .svg-anim rect, .svg-anim polyline, .svg-anim line {
  pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0;
}
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}
.draw { animation: draw-line 4s ease-out forwards; }
.breathe { animation: breathe 6s ease-in-out infinite; }
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1.2s; }
.delay-3 { animation-delay: 2s; }

/* 动画子元素变换基准 */
.glow-group, .float-group, .pulse-group {
  transform-box: fill-box; transform-origin: center;
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .draw, .breathe { animation: none !important; }
}

/* 修复列表溢出 */
ol, ul { max-width: 100%; }

/* 兜底：裁掉横向溢出 */
ul.toc-list {
  overflow-x: clip;
}
