/* === 基础变量与设计 Token === */
:root {
  --color-dark: #231334;
  --color-paper: #E9E8EA;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;

  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;

  --font-main: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  --line-height-body: 1.75;
  --line-height-heading: 1.1;
}

/* === 主题上下文覆盖 === */
.theme-light {
  --theme-text: var(--color-text);
  --theme-link: var(--color-brand);
  --theme-icon: var(--color-brand);
  --theme-border: var(--color-text);
  --theme-bg: var(--color-paper);
}
.theme-dark {
  --theme-text: var(--color-paper);
  --theme-link: var(--color-accent);
  --theme-icon: var(--color-accent);
  --theme-border: var(--color-paper);
  --theme-bg: var(--color-dark);
}

/* === 全局重置与排版 === */
*, *::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: var(--line-height-body);
  color: var(--theme-text);
  background: var(--theme-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--theme-link); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--theme-link); outline-offset: 3px; border-radius: 2px; }
ul, ol { list-style: none; }
p { margin-bottom: 1em; max-width: 38em; }
strong, b { font-weight: 700; }
small { font-size: 0.875rem; }

/* === 容器与区块 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section-inner {
  display: grid;
  gap: var(--gap);
  align-items: center;
}
@media (min-width: 768px) {
  .section-inner.two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .section-inner.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.flex-center { justify-content: center; text-align: center; }
.min-w-zero { min-width: 0; }

/* === 标题系统 === */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--theme-link);
  margin-bottom: 0.75rem;
}
.section-label::before {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
}
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  color: var(--theme-text);
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--theme-text);
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--theme-text);
  margin-bottom: 0.75rem;
}
.hl { color: var(--theme-link); }

/* === 按钮组件 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding-inline: 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(237, 210, 110, 0.3); }
.btn-secondary {
  background: transparent;
  color: var(--theme-text);
  border: 2px solid var(--theme-border);
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* === 卡片与面板 === */
.card {
  background: var(--theme-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background: var(--theme-bg);
  border: 2px solid var(--theme-border);
  border-radius: var(--radius-card);
  padding: 24px;
  overflow: hidden;
}

/* === 表格 === */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--theme-border);
}
th { font-weight: 700; color: var(--theme-text); }
td { color: var(--theme-text); }
tr:last-child td { border-bottom: none; }

/* === FAQ === */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--theme-bg);
}
.faq-summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--theme-text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-summary::-webkit-details-marker { display: none; }
.faq-summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--theme-link);
  transition: transform 0.2s ease;
}
details[open] .faq-summary::after { transform: rotate(45deg); }
.faq-answer {
  padding: 0 20px 16px;
  color: var(--theme-text);
  line-height: 1.7;
}

/* === 导航与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--theme-bg);
  border-bottom: 1px solid var(--theme-border);
  padding: 12px 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled { background: color-mix(in srgb, var(--theme-bg) 90%, transparent); backdrop-filter: blur(8px); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--theme-text); text-decoration: none; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; color: var(--theme-text); }
.nav-links a[aria-current="page"], .nav-links a:hover { color: var(--theme-link); }
.site-footer {
  border-top: 1px solid var(--theme-border);
  padding: 48px 0;
  background: var(--theme-bg);
  color: var(--theme-text);
}
.footer-inner { display: flex; flex-direction: column; gap: 24px; align-items: center; text-align: center; }
.footer-nav { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: var(--theme-link); font-size: 0.9rem; }
.footer-copy { font-size: 0.85rem; opacity: 0.8; }

/* === SVG 动效基类 === */
.svg-panel { width: 100%; height: auto; }
svg { overflow: visible; }
svg path, svg rect, svg circle, svg line { fill: none; stroke: currentColor; stroke-width: 1.5; }
svg text { fill: currentColor; font-family: inherit; font-size: 10px; }

/* 绘制线条 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s ease-in-out infinite;
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* 呼吸点 */
.anim-breathe {
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 卡片层叠漂浮 */
.anim-float-slow { animation: floatSlow 6s ease-in-out infinite; }
.anim-float-med { animation: floatMed 5s ease-in-out infinite 0.8s; }
.anim-float-fast { animation: floatFast 4.5s ease-in-out infinite 1.5s; }
@keyframes floatSlow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes floatMed { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes floatFast { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* 通知滑入 */
.anim-slide-in {
  animation: slideIn 5s ease-in-out infinite;
}
@keyframes slideIn {
  0%, 100% { transform: translateX(0); opacity: 0.8; }
  10%, 40% { transform: translateX(0); opacity: 1; }
  50%, 90% { transform: translateX(4px); opacity: 0.9; }
}

/* 连接线流动 */
.anim-flow {
  stroke-dasharray: 8 16;
  animation: flowDash 2s linear infinite;
}
@keyframes flowDash { to { stroke-dashoffset: -24; } }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .anim-draw, .anim-breathe, .anim-float-slow, .anim-float-med, .anim-float-fast, .anim-slide-in, .anim-flow {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
