/* ==================== 设计变量与基础重置 ==================== */
:root {
  /* 色板 */
  --color-bg-dark: #140E25;
  --color-bg-paper: #F7F5F3;
  --color-text-main: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  --header-h: 64px;

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-base: 1.65;
  --lh-tight: 1.25;
  --lh-hero: 1.15;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-paper);
  color: var(--color-text-main);
  line-height: var(--lh-base);
  font-size: 16px;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ==================== 布局容器 ==================== */
.container {
  width: min(100% - 32px, var(--content-max));
  margin-inline: auto;
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ==================== 上下文取色覆盖 ==================== */
.dark-face { background-color: var(--color-bg-dark); color: var(--color-bg-paper); }
.dark-face .hl { color: var(--color-accent); }
.dark-face .badge { color: var(--color-accent); }
.dark-face a:not(.btn):hover { color: var(--color-accent); }

.paper-face { background-color: var(--color-bg-paper); color: var(--color-text-main); }
.paper-face .hl { color: var(--color-brand); }
.paper-face .badge { color: var(--color-brand); }
.paper-face a:not(.btn):hover { color: var(--color-brand); }

/* 深色面内的浅色卡片恢复纸面取色 */
.dark-face .card { background-color: var(--color-bg-paper); color: var(--color-text-main); }
.dark-face .card .hl { color: var(--color-brand); }
.dark-face .card .badge { color: var(--color-brand); }
.dark-face .card a:not(.btn):hover { color: var(--color-brand); }

/* ==================== 排版组件 ==================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  margin-bottom: 12px; text-transform: uppercase;
}
.badge::before {
  content: ""; width: 14px; height: 2px; background: currentColor; border-radius: 2px;
}
.heading-group h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600; line-height: var(--lh-tight);
  margin-bottom: 16px; letter-spacing: -0.01em;
}
.heading-group p {
  max-width: 38em; font-size: 1.05rem; margin-bottom: 24px;
}
.text-prose {
  max-width: 38em; line-height: var(--lh-base);
}
.text-prose p { margin-bottom: 1em; }
.text-prose h3 {
  font-size: 1.25rem; font-weight: 600; margin: 1.5em 0 0.75em; line-height: var(--lh-tight);
}

/* ==================== 按钮系统 ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding-inline: 24px;
  font-size: 1rem; font-weight: 600; border-radius: var(--radius-btn);
  cursor: pointer; transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none; outline: none;
}
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.btn-primary {
  background-color: var(--color-accent); color: var(--color-bg-dark);
  box-shadow: 0 4px 12px rgba(200, 237, 110, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor; color: currentColor;
}
.paper-face .btn-secondary { color: var(--color-text-main); border-color: var(--color-text-main); }
.dark-face .btn-secondary { color: var(--color-bg-paper); border-color: var(--color-bg-paper); }
.btn-secondary:hover { background-color: rgba(128,128,128,0.1); transform: translateY(-1px); }

/* ==================== 卡片与表格 ==================== */
.card {
  background: var(--color-bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.card:hover { box-shadow: 0 12px 32px -12px rgba(25, 21, 35, 0.4); transform: translateY(-2px); }
table {
  width: 100%; border-collapse: collapse; font-size: 0.95rem;
}
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 600; white-space: nowrap; }
td { color: inherit; }
.dark-face th, .dark-face td { border-color: rgba(247, 245, 243, 0.15); }

/* ==================== FAQ (Details) ==================== */
.faq-list details {
  border-bottom: 1px solid rgba(128,128,128,0.2);
  padding: 16px 0;
}
.dark-face .faq-list details { border-color: rgba(247, 245, 243, 0.15); }
.faq-list summary {
  cursor: pointer; font-weight: 600; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-size: 1.2rem; font-weight: 400; opacity: 0.7; transition: transform 0.2s;
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list .answer { padding-top: 12px; line-height: var(--lh-base); opacity: 0.9; }

/* ==================== 页头页脚 ==================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247, 245, 243, 0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  height: var(--header-h);
}
.dark-face .site-header { background: rgba(20, 14, 37, 0.9); border-color: rgba(247, 245, 243, 0.1); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between; height: 100%;
}
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; opacity: 0.85; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; }
.site-footer {
  padding: 48px 0; border-top: 1px solid rgba(128,128,128,0.2);
  font-size: 0.9rem; opacity: 0.8;
}
.dark-face .site-footer { border-color: rgba(247, 245, 243, 0.1); }
.footer-grid { display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-col h4 { margin-bottom: 12px; font-weight: 600; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a:hover { text-decoration: underline; }

/* ==================== SVG 动效体系 ==================== */
.svg-container { width: 100%; height: auto; overflow: visible; }
.svg-container svg { width: 100%; height: 100%; }

/* 线条绘制 */
.anim-draw {
  stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: drawLine 4s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
@keyframes drawLine {
  0%, 10% { stroke-dashoffset: 1; }
  50%, 90% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* 节点流动 */
.anim-flow {
  offset-path: path("M 10 50 Q 60 20 110 50 T 210 50");
  animation: flowDot 6s linear infinite;
}
@keyframes flowDot {
  0% { offset-distance: 0%; opacity: 0; transform: scale(0.8); }
  10% { opacity: 1; transform: scale(1); }
  90% { opacity: 1; transform: scale(1); }
  100% { offset-distance: 100%; opacity: 0; transform: scale(0.8); }
}

/* 呼吸/漂浮 */
.anim-float {
  animation: floatY 5s ease-in-out infinite alternate;
}
@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}
.anim-breathe {
  animation: breathe 3s ease-in-out infinite alternate;
}
@keyframes breathe {
  0% { opacity: 0.4; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1.05); }
}

/* 变换中心 */
.transform-center { transform-box: fill-box; transform-origin: center; }

/* 减少动态效果 */
@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-draw, .anim-flow, .anim-float, .anim-breathe { animation: none !important; }
}
