/* === 设计变量与基础重置 === */
:root {
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;
  --color-accent-dark: #0A0B10;

  --radius-card: 8px;
  --radius-btn: 6px;
  --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: 1120px;
  --line-height-body: 1.75;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* === 上下文颜色覆盖 === */
.bg-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl, .bg-dark mark { color: var(--color-accent); }
.bg-dark a.link { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

.card-on-dark {
  background: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
}
.card-on-dark .hl { color: var(--color-brand); }
.card-on-dark a.link { color: var(--color-brand); }

/* === 排版系统 === */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
h1, h2, h3 { font-weight: 600; line-height: 1.25; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 0.8em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.6em; }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
p { max-width: 38em; margin-bottom: 1em; }
label, .mark {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5em;
  color: var(--color-brand);
}
.bg-dark label, .bg-dark .mark { color: var(--color-accent); }

/* === 布局网格 === */
.page-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 860px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; margin-bottom: var(--gap); }
  .main-content { order: 1; }
}

/* === 侧栏导航 === */
.sidebar nav { position: sticky; top: 100px; }
.sidebar ul { border-left: 2px solid var(--color-text); padding-left: 12px; }
.sidebar li { margin-bottom: 0.6em; }
.sidebar a {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}
.sidebar a:hover, .sidebar a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.bg-dark .sidebar a { color: var(--color-paper); }
.bg-dark .sidebar a:hover, .bg-dark .sidebar a[aria-current="page"] { color: var(--color-accent); }
.bg-dark .sidebar ul { border-left-color: var(--color-paper); }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 52px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: none;
}
.btn-primary { background: var(--color-accent); color: var(--color-accent-dark); }
.btn-primary:hover { transform: translateY(-2px); background: #5DDCC0; }
.btn-secondary { background: transparent; border: 2px solid var(--color-text); color: var(--color-text); }
.btn-secondary:hover { transform: translateY(-2px); background: rgba(0,0,0,0.04); }
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }

/* === 组件：卡片 === */
.card {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
}
.card-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}
.card h3 { margin-top: 0; }
.card-meta { font-size: 0.85rem; opacity: 0.7; margin-bottom: 0.8em; display: block; }

/* === 组件：表格 === */
.data-table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.data-table th, .data-table td { padding: 14px 16px; border-bottom: 1px solid var(--color-text); text-align: left; vertical-align: top; }
.data-table th { font-weight: 600; width: 35%; }
.data-table tr:last-child th, .data-table tr:last-child td { border-bottom: none; }

/* === 组件：FAQ === */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  background: var(--color-paper);
  overflow: hidden;
}
summary {
  padding: 16px 20px;
  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.2rem; font-weight: 400; }
details[open] summary::after { content: "−"; }
details[open] summary { border-bottom: 1px solid var(--color-text); }
details p { padding: 16px 20px; margin: 0; font-size: 0.95rem; line-height: 1.7; }

/* === 组件：步骤条 === */
.steps-row {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  counter-reset: step;
}
.step-item {
  flex: 1 1 200px;
  counter-increment: step;
  position: relative;
  padding-top: 2.5em;
}
.step-item::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 0; left: 0;
  width: 2em; height: 2em;
  background: var(--color-accent);
  color: var(--color-accent-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-btn);
}
.bg-dark .step-item::before { background: var(--color-accent); color: var(--color-accent-dark); }

/* === 新闻卡片 === */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}
.news-card {
  background: var(--color-paper);
  color: var(--color-text);
  border: 1px solid var(--color-text);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.news-card time { font-size: 0.8rem; opacity: 0.7; }
.news-card p { font-size: 0.95rem; margin: 0; }

/* === 场景面板 === */
.scenario-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: var(--gap);
}
@media (max-width: 768px) { .scenario-panel { grid-template-columns: 1fr; } }
.scenario-block {
  padding: 24px;
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--color-paper);
  color: var(--color-text);
}
.scenario-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.tag-problem { background: #FEE2E2; color: #991B1B; }
.tag-action { background: #DBEAFE; color: #1E40AF; }
.tag-result { background: #D1FAE5; color: #065F46; }

/* === 页头页脚 === */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
}
.bg-dark .site-header { background: var(--color-dark); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; opacity: 0.8; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.bg-dark .nav-links a { color: var(--color-paper); }
.bg-dark .nav-links a:hover, .bg-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--color-text);
  margin-top: var(--section-y);
  font-size: 0.9rem;
  opacity: 0.8;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { opacity: 0.7; transition: opacity 0.2s; }
.footer-links a:hover { opacity: 1; }

/* === SVG 动效核心 === */
.svg-stage { width: 100%; height: auto; max-width: 600px; }
.draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@keyframes drawLoop {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
.animate-draw { animation: drawLoop 6s infinite ease-in-out; }
.animate-draw-fast { animation: drawLoop 4s infinite ease-in-out; }

.node {
  fill: var(--color-text);
  opacity: 0.15;
  transition: fill 0.3s, opacity 0.3s;
}
.bg-dark .node { fill: var(--color-paper); }
.card-on-dark .node { fill: var(--color-text); }
@keyframes nodePulse {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}
.animate-node { animation: nodePulse 5s infinite ease-in-out; transform-box: fill-box; transform-origin: center; }

.float { animation: gentleFloat 7s infinite ease-in-out; }
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.breathe { animation: breathCycle 4s infinite ease-in-out; }
@keyframes breathCycle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.slide-in { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; transform: translateX(20px); }
@keyframes slideIn { to { opacity: 1; transform: translateX(0); } }

/* === 无障碍与响应式 === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
