/* ==================== 设计变量与基础重置 ==================== */
:root {
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --color-border-light: rgba(28, 21, 35, 0.12);

  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  margin: 0;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-brand); transition: color var(--transition-fast); }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.2em; margin: 0; }
li { margin-bottom: 0.5em; }

/* ==================== 布局与区块 ==================== */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
section { padding: var(--section-y) 0; position: relative; }
.section-dark { background: var(--color-dark); color: var(--color-paper); }
.section-dark a { color: var(--color-accent); }
.section-dark .hl { color: var(--color-accent); }
.section-dark .card { background: var(--color-paper); color: var(--color-text); border-color: var(--color-text); }
.section-dark .card .hl { color: var(--color-brand); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* ==================== 排版 ==================== */
h1, h2, h3, h4 { line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; margin-top: 0; margin-bottom: 0.6em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); text-wrap: balance; }
h3 { font-size: 1.25rem; }
p { max-width: 38em; margin-bottom: 1em; }
.mark {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
  text-transform: uppercase;
}
.paper .mark { color: var(--color-brand); }
.dark .mark { color: var(--color-accent); }
.hl { color: var(--color-brand); }
.section-dark .hl { color: var(--color-accent); }

/* ==================== 组件 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  height: 48px;
  padding: 0 1.4em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.btn-secondary { background: transparent; border: 2px solid currentColor; color: inherit; }
.paper .btn-secondary { border-color: var(--color-text); color: var(--color-text); }
.dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn-secondary:hover { background: rgba(128,128,128,0.1); }

.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}
.table-wrap { overflow-x: auto; margin: 1em 0; border: 1px solid var(--color-border-light); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 0.8em 1em; text-align: left; border-bottom: 1px solid var(--color-border-light); }
th { background: rgba(128,128,128,0.08); font-weight: 700; }
td:first-child { font-weight: 600; white-space: nowrap; }

.step-badge {
  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-right: 0.5em;
  flex-shrink: 0;
}
ol.steps { list-style: none; padding-left: 0; counter-reset: step; }
ol.steps li { counter-increment: step; display: flex; align-items: flex-start; gap: 0.8em; margin-bottom: 1.2em; }
ol.steps li::before { content: counter(step); }

details {
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  margin-bottom: 0.8em;
  overflow: hidden;
}
summary {
  padding: 1em;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 700; transition: transform var(--transition-fast); }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 1em 1em; margin: 0; }

/* ==================== 页头页脚 ==================== */
.header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(245, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border-light);
}
.section-dark ~ .header, .header.dark-mode { background: rgba(35, 19, 52, 0.9); border-color: rgba(255,255,255,0.1); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 800; font-size: 1.1rem; color: inherit; text-decoration: none; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.nav-links { display: flex; gap: 1.2em; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: inherit; font-weight: 500; padding: 0.4em 0; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a[aria-current="page"] { border-bottom-color: var(--color-accent); }
.footer { background: var(--color-dark); color: var(--color-paper); padding: 3em 0 2em; font-size: 0.9rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2em; margin-bottom: 2em; }
.footer h4 { color: var(--color-accent); margin-bottom: 0.8em; }
.footer ul { list-style: none; padding: 0; }
.footer a { color: var(--color-paper); opacity: 0.8; }
.footer a:hover { opacity: 1; }
.copyright { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5em; text-align: center; opacity: 0.7; }

/* ==================== SVG 动效系统 ==================== */
.svg-viz { width: 100%; height: auto; max-width: 100%; }
/* 描边绘制 */
.draw-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes drawPath { to { stroke-dashoffset: 0; } }
.animate-draw { animation: drawPath 1.2s ease-in-out infinite alternate; }

/* 网格节点依次点亮 */
@keyframes nodeGlow {
  0%, 100% { opacity: 0.25; stroke: var(--color-brand); }
  50% { opacity: 1; stroke: var(--color-accent); }
}
.grid-node { animation: nodeGlow 3s ease-in-out infinite; }
.grid-node:nth-child(1) { animation-delay: 0s; }
.grid-node:nth-child(2) { animation-delay: 0.3s; }
.grid-node:nth-child(3) { animation-delay: 0.6s; }
.grid-node:nth-child(4) { animation-delay: 0.9s; }
.grid-node:nth-child(5) { animation-delay: 1.2s; }
.grid-node:nth-child(6) { animation-delay: 1.5s; }
.grid-node:nth-child(7) { animation-delay: 1.8s; }
.grid-node:nth-child(8) { animation-delay: 2.1s; }

/* 气泡浮动 */
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.float-bubble { animation: floatUp 4s ease-in-out infinite; }
.float-bubble.delay-1 { animation-delay: 0.8s; }
.float-bubble.delay-2 { animation-delay: 1.6s; }

/* 呼吸点 */
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.breathe-dot { animation: breathe 2s ease-in-out infinite; }

/* 滑入 */
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.slide-in { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

/* 减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    animation: none !important;
  }
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column; }
  .nav-links { display: none; } /* 移动端简化，实际项目可加汉堡菜单，此处保持静态结构 */
  .mobile-menu-btn { display: block; }
}
.mobile-menu-btn { display: none; background: none; border: none; color: inherit; font-size: 1.5rem; cursor: pointer; }
@media (max-width: 768px) { .mobile-menu-btn { display: block; } }
