/* === 设计变量与基础重置 === */
:root {
  --color-dark: #251943;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED6E89;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.55;
  --line-height-title: 1.1;
  --letter-spacing-title: -0.02em;
}

*, *::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);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
button, input, select, textarea { font: inherit; }

/* === 布局容器 === */
.site-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.page-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap);
  padding: var(--section-y) 0;
}

/* === 侧边导航 === */
.sidebar-nav {
  position: sticky;
  top: 80px;
  height: fit-content;
  padding: var(--gap);
  background: rgba(219, 212, 237, 0.6);
  border: 1px solid rgba(25, 21, 35, 0.1);
}
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 0.5rem; }
.sidebar-nav a {
  display: block;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}
.sidebar-nav a:hover, .sidebar-nav a:focus-visible {
  border-left-color: var(--color-brand);
  background: rgba(82, 20, 235, 0.05);
  outline: none;
}
.sidebar-nav a[aria-current="page"] {
  font-weight: 700;
  border-left-color: var(--color-brand);
  color: var(--color-brand);
}

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 0.75rem 0;
}
.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand img { height: 32px; width: auto; display: block; }
.brand span { margin-left: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.main-nav { display: flex; gap: 1.5rem; align-items: center; }
.main-nav a { font-weight: 500; font-size: 0.95rem; }
.main-nav a:hover { color: var(--color-brand); }
.main-nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: var(--section-y) 0;
  margin-top: var(--section-y);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-col h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--color-accent); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom {
  max-width: var(--content-max);
  margin: 2rem auto 0;
  padding: 1rem var(--gap) 0;
  border-top: 1px solid rgba(219, 212, 237, 0.2);
  font-size: 0.85rem;
  text-align: center;
  color: rgba(219, 212, 237, 0.7);
}

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  height: 48px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border-radius: var(--radius-btn);
}
.btn-primary:hover { transform: translateY(-1px); background: #d95a75; }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
  border-radius: var(--radius-btn);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); }
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }

/* === 组件：卡片 === */
.card {
  background: var(--color-paper);
  border: var(--card-border) solid var(--color-text);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
}
.card.dark { background: var(--color-dark); color: var(--color-paper); }

/* === 组件：表格 === */
.data-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.data-table th, .data-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.1); }
.data-table th { font-weight: 700; background: rgba(25, 21, 35, 0.03); }
.data-table tr:last-child td { border-bottom: none; }
.data-table a { color: var(--color-brand); text-decoration: underline; text-underline-offset: 2px; }
.theme-dark .data-table th, .theme-dark .data-table td { border-bottom-color: rgba(219, 212, 237, 0.15); }
.theme-dark .data-table th { background: rgba(219, 212, 237, 0.05); }
.theme-dark .data-table a { color: var(--color-accent); }

/* === 组件：FAQ === */
.faq-item { margin-bottom: 1rem; border-bottom: 1px solid rgba(25, 21, 35, 0.1); padding-bottom: 1rem; }
.faq-item summary {
  font-weight: 700; cursor: pointer; list-style: none; padding: 0.5rem 0;
  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; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin-top: 0.5rem; color: var(--color-text); opacity: 0.9; }
.theme-dark .faq-item { border-bottom-color: rgba(219, 212, 237, 0.15); }
.theme-dark .faq-item summary { color: var(--color-paper); }
.theme-dark .faq-item p { color: var(--color-paper); }

/* === 主题变体 === */
.section-light { background: var(--color-paper); color: var(--color-text); }
.section-light .hl { color: var(--color-brand); }
.section-light .mb { color: var(--color-brand); }
.section-light .accent-text { color: var(--color-accent); }
.section-light .link { color: var(--color-brand); }

.section-dark { background: var(--color-dark); color: var(--color-paper); }
.section-dark .hl { color: var(--color-accent); }
.section-dark .mb { color: var(--color-accent); }
.section-dark .accent-text { color: var(--color-accent); }
.section-dark .link { color: var(--color-accent); }

/* === 排版工具 === */
.masthead { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.masthead::before { content: ""; display: inline-block; width: 16px; height: 2px; }
.section-light .masthead { color: var(--color-brand); }
.section-dark .masthead { color: var(--color-accent); }

h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); font-weight: 800; line-height: var(--line-height-title); letter-spacing: var(--letter-spacing-title); margin-bottom: 1rem; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; line-height: var(--line-height-title); letter-spacing: var(--letter-spacing-title); margin: 2rem 0 1rem; text-wrap: balance; }
h3 { font-size: 1.25rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.5rem; }

/* === SVG 视觉面板 === */
.svg-visual { width: 100%; height: auto; max-width: 100%; }
.svg-panel { background: var(--color-dark); padding: var(--gap); border-radius: var(--radius-card); }
.theme-dark .svg-panel { background: var(--color-paper); }

/* === SVG 动效 === */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes dash-draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-orbit { animation: orbit-breathe 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-orbit-delay { animation-delay: 2s; }
.anim-orbit-slow { animation-duration: 8s; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-draw 3s ease forwards; }

@media (prefers-reduced-motion: reduce) {
  .anim-orbit, .anim-orbit-delay, .anim-orbit-slow, .anim-draw { animation: none !important; }
}

/* === 响应式 === */
@media (max-width: 768px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar-nav { position: static; margin-bottom: var(--gap); }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .header-inner { flex-wrap: wrap; gap: 1rem; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
