/* === 设计变量 === */
:root {
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;
  
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.75;
  --line-height-tight: 1.1;
  --tracking-tight: -0.02em;
}

/* === 基础重置 === */
*, *::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);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* === 容器与布局 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section + .section { border-top: 1px solid rgba(31, 21, 35, 0.12); }
.dark-face { background-color: var(--color-dark); color: var(--color-paper); }
.dark-face h1, .dark-face h2, .dark-face h3, .dark-face p, .dark-face li { color: var(--color-paper); }
.dark-face .hl { color: var(--color-accent); }
.paper-face { background-color: var(--color-paper); color: var(--color-text); }
.paper-face h1, .paper-face h2, .paper-face h3, .paper-face p, .paper-face li { color: var(--color-text); }
.paper-face .hl { color: var(--color-brand); }

/* === 排版 === */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.paper-face .badge { color: var(--color-brand); }
.dark-face .badge { color: var(--color-accent); }

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: var(--line-height-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 1rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: var(--tracking-tight);
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
p, li { font-size: clamp(1rem, 1.1vw, 1.125rem); line-height: var(--line-height-base); }
.max-w-prose { max-width: 38em; }
.grid { display: grid; gap: var(--gap); }
.grid-cols-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-outline {
  border: 1px solid currentColor;
  color: inherit;
}
.dark-face .btn-outline { color: var(--color-paper); border-color: var(--color-paper); }

/* === 组件：卡片 === */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
  transition: box-shadow 0.2s ease;
}
.dark-face .card { background: rgba(255,255,255,0.06); box-shadow: none; }
.card:hover { box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.35); }

/* === 组件：表格 === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(31, 21, 35, 0.1); }
th { font-weight: 700; }
.dark-face th, .dark-face td { border-bottom-color: rgba(255,255,255,0.1); }

/* === 组件：FAQ === */
details { border-bottom: 1px solid rgba(31, 21, 35, 0.1); padding: 1rem 0; }
.dark-face details { border-bottom-color: rgba(255,255,255,0.1); }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; font-weight: 700; color: var(--color-brand); }
.dark-face summary::before { color: var(--color-accent); }
details[open] summary::before { content: "−"; }
details p { margin-top: 0.75rem; color: var(--color-text); }
.dark-face details p { color: var(--color-paper); }

/* === SVG 动效 === */
.svg-visual { width: 100%; height: auto; max-width: 100%; }
.flow-dot {
  fill: var(--color-accent);
  animation: flowAlongPath 4s linear infinite;
}
.draw-path {
  stroke: var(--color-brand);
  stroke-width: 2;
  fill: none;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s ease-in-out infinite alternate;
}
.dark-face .draw-path { stroke: var(--color-accent); }
.float-layer {
  animation: floatY 6s ease-in-out infinite;
}
.breathe {
  animation: breatheOpacity 4s ease-in-out infinite;
}

@keyframes flowAlongPath {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breatheOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  .flow-dot, .draw-path, .float-layer, .breathe { animation: none !important; }
}

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
  padding: 1rem 0;
}
.dark-face .site-header { background: var(--color-dark); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; font-size: 1.25rem; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; transition: opacity 0.2s; }
.nav a:hover { opacity: 0.7; }
.nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.dark-face .nav a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-inner { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { opacity: 0.8; font-size: 0.9rem; }
.footer-links a:hover { opacity: 1; }
.copyright { font-size: 0.85rem; opacity: 0.6; }
