/* ==================== 基础变量与设计 Token ==================== */
:root {
  --bg-dark: #17203F;
  --bg-paper: #FCFCFD;
  --text-main: #151823;
  --brand: #1441EB;
  --accent: #6EEDBD;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(21, 24, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --line-height-body: 1.65;
  --line-height-title: 1.15;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* 上下文颜色覆盖 */
.dark-section {
  --surface-bg: var(--bg-dark);
  --surface-text: var(--bg-paper);
  --surface-accent: var(--accent);
}
.paper-section {
  --surface-bg: var(--bg-paper);
  --surface-text: var(--text-main);
  --surface-accent: var(--brand);
}
.light-card {
  --surface-bg: var(--bg-paper);
  --surface-text: var(--text-main);
  --surface-accent: var(--brand);
}

/* ==================== 全局重置与排版 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg-paper);
  color: var(--text-main);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  width: min(var(--content-max), 100% - var(--gap) * 2);
  margin-inline: auto;
}

/* 标题系统 */
h1, h2, h3, h4 { line-height: var(--line-height-title); font-weight: 500; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
.hl { color: var(--surface-accent); }
.masthead {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 0.75rem;
  color: var(--surface-accent);
}
.masthead::before { content: ""; display: inline-block; width: 1.5em; height: 2px; background: currentColor; border-radius: 1px; }

/* ==================== 布局网格（宽屏索引 + 窄屏折叠） ==================== */
.page-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap);
  align-items: start;
}
.sidebar-nav {
  position: sticky; top: 100px;
  background: var(--surface-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1rem;
}
.sidebar-nav ul { display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-nav a {
  display: block; padding: 0.5rem 0.75rem;
  border-radius: 4px; font-size: 0.9rem; color: var(--surface-text);
  transition: background 0.2s;
}
.sidebar-nav a:hover, .sidebar-nav a[aria-current="page"] {
  background: rgba(21, 24, 35, 0.06); font-weight: 600;
}
.main-content { min-width: 0; }
@media (max-width: 1024px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar-nav {
    position: static; border: none; background: transparent;
    padding: 0; margin-bottom: var(--gap);
  }
  .sidebar-nav ul { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
  .sidebar-nav a { padding: 0.4rem 0.8rem; border: var(--card-border); border-radius: 20px; }
}

/* ==================== 头部与页脚 ==================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(252, 252, 253, 0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 24, 35, 0.08);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand span { font-weight: 700; font-size: 1.1rem; color: var(--text-main); }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; color: var(--text-main); }
.nav-links a:hover { color: var(--brand); }
@media (max-width: 768px) {
  .nav-links { display: none; }
  .header-inner { padding: 0 1rem; }
}
.site-footer {
  background: var(--bg-dark); color: var(--bg-paper);
  padding: 3rem 1rem; margin-top: var(--section-y);
}
.footer-inner {
  max-width: var(--content-max); margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem;
}
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--accent); }
.footer-col ul { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9rem; }
.footer-col a { color: var(--bg-paper); opacity: 0.85; }
.footer-col a:hover { opacity: 1; text-decoration: underline; }
.copyright { text-align: center; margin-top: 2rem; font-size: 0.8rem; opacity: 0.6; }

/* ==================== 按钮组件 ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  height: 52px; padding: 0 1.5rem;
  border-radius: var(--radius-btn); font-weight: 600; font-size: 1rem;
  cursor: pointer; transition: transform 0.2s ease, background 0.2s, border-color 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary {
  background: var(--accent); color: var(--bg-dark); border: none;
}
.btn-primary:hover { transform: translateY(-2px); background: #5ce0af; }
.btn-secondary {
  background: transparent; border: 1px solid var(--text-main); color: var(--text-main);
}
.dark-section .btn-secondary { border-color: var(--bg-paper); color: var(--bg-paper); }
.dark-section .btn-secondary:hover { background: rgba(252, 252, 253, 0.1); }

/* ==================== 卡片、表格与列表 ==================== */
.card {
  background: var(--surface-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--gap); }
.data-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.data-table th, .data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(21, 24, 35, 0.1); text-align: left; }
.data-table th { font-weight: 600; color: var(--surface-text); width: 40%; }
.data-table td { color: var(--surface-text); opacity: 0.9; }
.step-list { counter-reset: step; }
.step-list li { counter-increment: step; position: relative; padding-left: 2.5rem; margin-bottom: 1rem; }
.step-list li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--surface-accent); color: var(--bg-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}

/* ==================== FAQ ==================== */
.faq-item { border-bottom: 1px solid rgba(21, 24, 35, 0.1); }
.faq-item summary {
  padding: 1rem 0; cursor: pointer; font-weight: 600; color: var(--surface-text);
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding-bottom: 1rem; color: var(--surface-text); opacity: 0.9; line-height: 1.7; }

/* ==================== SVG 动效关键帧 ==================== */
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw { animation: draw-line 4s ease-in-out infinite alternate; }

.anim-float { transform: translateY(0); }
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-float { animation: float-bubble 6s ease-in-out infinite; }

.anim-pulse { opacity: 1; }
@keyframes pulse-dots {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}
.anim-pulse { animation: pulse-dots 4s ease-in-out infinite; }

.anim-slide { transform: translateX(0); opacity: 1; }
@keyframes slide-in {
  0% { transform: translateX(-12px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}
.anim-slide { animation: slide-in 3s ease-out forwards; }

.anim-twinkle { opacity: 0.3; }
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.9); }
  50% { opacity: 0.8; transform: scale(1.1); }
}
.anim-twinkle { animation: twinkle 5s ease-in-out infinite; }

/* 旋转中心约束 */
.gear-spin, .arrow-spin, .sync-icon {
  transform-box: fill-box; transform-origin: center;
}
@keyframes spin-slow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.gear-spin { animation: spin-slow 12s linear infinite; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.mb-2 { margin-bottom: 2rem; }
.section-bg { background: var(--surface-bg); }
svg { width: 100%; height: auto; max-width: 100%; }
