/* === 设计 Token & 全局变量 === */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  
  /* 派生色（用于分割线、次级底色，不用于正文） */
  --color-divider: rgba(28, 21, 35, 0.1);
  --color-divider-dark: rgba(245, 243, 247, 0.15);
  
  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  
  /* 间距与节奏 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --line-height-body: 1.75;
  
  /* 最大宽度 */
  --content-max: 1120px;
  
  /* 字体 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === 基础排版 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
ul, ol { list-style: none; }

/* === 容器 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* === 面与区块 === */
.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.dark-surface .hl { color: var(--color-accent); }
.dark-surface a:not(.btn) { color: var(--color-accent); }
.dark-surface kbd, .dark-surface .badge { color: var(--color-accent); }

.light-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.light-paper .hl { color: var(--color-brand); }
.light-paper a:not(.btn) { color: var(--color-brand); }
.light-paper kbd, .light-paper .badge { color: var(--color-brand); }

section {
  padding-block: var(--section-y);
  position: relative;
}
.section-divider {
  width: 100%;
  height: 1px;
  background-color: var(--color-divider);
  border: none;
}
.dark-surface .section-divider {
  background-color: var(--color-divider-dark);
}

/* === 标题系统 === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(125, 20, 235, 0.08);
}
.dark-surface .badge {
  background: rgba(237, 210, 110, 0.15);
  color: #fff;
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }

p { margin-bottom: 1rem; max-width: 38em; }
p:last-child { margin-bottom: 0; }

.hl { color: inherit; } /* 由父级面控制 */

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background-color: #f2d985; }

.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--color-text);
  color: var(--color-text);
}
.dark-surface .btn-outline {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-outline:hover { background-color: rgba(28, 21, 35, 0.05); }
.dark-surface .btn-outline:hover { background-color: rgba(245, 243, 247, 0.1); }

.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* === 头部与导航 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-divider);
  padding: 1rem 0;
}
.dark-surface .site-header {
  background-color: rgba(35, 19, 52, 0.9);
  border-bottom-color: var(--color-divider-dark);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
}
.brand img { height: 32px; width: auto; }
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  opacity: 1;
}
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}
.dark-surface .nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

/* === 页脚 === */
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--color-divider);
  margin-top: 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 1rem;
  opacity: 0.7;
}
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* === 组件：胶囊 / 卡片 === */
.capsule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 99px;
  background: rgba(125, 20, 235, 0.06);
  font-size: 0.9rem;
  font-weight: 500;
}
.dark-surface .capsule {
  background: rgba(237, 210, 110, 0.1);
}
.capsule svg { width: 16px; height: 16px; }

.card {
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
  min-width: 0;
}
.dark-surface .card {
  background: rgba(245, 243, 247, 0.05);
}
.card:hover { transform: translateY(-4px); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

/* === 表格 === */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--color-divider);
  margin-top: 1rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
}
th { font-weight: 700; background: rgba(125, 20, 235, 0.04); }
.dark-surface th { background: rgba(245, 243, 247, 0.08); }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* === FAQ === */
details {
  border: 1px solid var(--color-divider);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: background-color 0.2s;
}
details[open] { background: rgba(125, 20, 235, 0.03); }
.dark-surface details[open] { background: rgba(245, 243, 247, 0.05); }
summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
.details-content { padding: 0 1.25rem 1.25rem; }

/* === 步骤条 === */
.steps-horiz {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.step-item {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

/* === SVG 动效 Keyframes === */
@keyframes grid-glow {
  0%, 100% { fill: rgba(245, 243, 247, 0.15); }
  50% { fill: var(--color-accent); }
}
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes typing-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slide-in-right {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes dash-flow {
  to { stroke-dashoffset: 0; }
}

.anim-grid-node { animation: grid-glow 6s infinite ease-in-out; }
.anim-bubble { animation: bubble-float 4s infinite ease-in-out; }
.anim-typing span { animation: typing-dot 1.4s infinite ease-in-out; }
.anim-typing span:nth-child(2) { animation-delay: 0.2s; }
.anim-typing span:nth-child(3) { animation-delay: 0.4s; }
.anim-slide { animation: slide-in-right 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-draw path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: dash-flow 2s ease forwards;
}

/* 延迟类 */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }
.delay-9 { animation-delay: 0.9s; }
.delay-10 { animation-delay: 1.0s; }

/* === 响应式与无障碍 === */
@media (max-width: 768px) {
  .nav-links { display: none; } /* 简化移动端，实际项目可加汉堡菜单 */
  .steps-horiz { flex-direction: column; }
  h1 { font-size: 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .anim-grid-node, .anim-bubble, .anim-typing, .anim-slide, .anim-draw {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
div.grid-2,
li {
  overflow-x: clip;
}
