/* ==================== 设计变量与基础重置 ==================== */
:root {
  --color-dark: #2D1438;
  --color-paper: #F6F3F7;
  --color-body: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;
  
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31,21,35,0.3);
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  
  --line-height-body: 1.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: var(--line-height-body);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ==================== 表面色彩系统 ==================== */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .badge { color: var(--color-accent); }
.surface-dark a:not(.btn) { color: var(--color-accent); }
.surface-dark .icon { stroke: var(--color-accent); }

.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-body);
}
.surface-paper .hl { color: var(--color-brand); }
.surface-paper .badge { color: var(--color-brand); }
.surface-paper a:not(.btn) { color: var(--color-brand); }
.surface-paper .icon { stroke: var(--color-brand); }

.card-light-on-dark {
  background-color: var(--color-paper);
  color: var(--color-body);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
.card-light-on-dark .hl { color: var(--color-brand); }
.card-light-on-dark .badge { color: var(--color-brand); }
.card-light-on-dark a:not(.btn) { color: var(--color-brand); }
.card-light-on-dark .icon { stroke: var(--color-brand); }

/* ==================== 布局与排版 ==================== */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding: var(--section-y) 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  text-wrap: balance;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.hl {
  font-weight: 600;
}

/* ==================== 按钮组件 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(110,237,168,0.3);
}

.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.surface-paper .btn-secondary { color: var(--color-body); border-color: var(--color-body); }
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

/* ==================== 导航与页脚 ==================== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(31,21,35,0.1);
  padding: 0.75rem 0;
  transition: box-shadow 0.3s ease;
}
.surface-dark header {
  background: var(--color-dark);
  border-bottom-color: rgba(246,243,247,0.1);
}
header.scrolled {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo img {
  width: 32px;
  height: 32px;
}

nav ul {
  display: flex;
  gap: 1.5rem;
}
nav a {
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
nav a:hover, nav a[aria-current="page"] {
  border-bottom-color: currentColor;
}

footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(31,21,35,0.1);
  margin-top: var(--section-y);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
}
.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ==================== 表格与组件 ==================== */
.panel {
  border-radius: var(--radius-card);
  padding: var(--gap);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(31,21,35,0.1);
}
.surface-dark th, .surface-dark td {
  border-bottom-color: rgba(246,243,247,0.1);
}
th {
  font-weight: 600;
}

.faq-item {
  border-bottom: 1px solid rgba(31,21,35,0.1);
  padding: 1rem 0;
}
.surface-dark .faq-item {
  border-bottom-color: rgba(246,243,247,0.1);
}
details summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s;
}
details[open] summary::after {
  content: "−";
}
details p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ==================== SVG 动效系统 ==================== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes slide-in {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.svg-float { animation: float 4s ease-in-out infinite; }
.svg-breathe { animation: breathe 3s ease-in-out infinite; }
.svg-slide { animation: slide-in 5s ease-in-out infinite; }
.svg-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 4s linear infinite; }
.svg-star { animation: star-twinkle 5s ease-in-out infinite; }

/* 旋转/缩放子元素统一坐标基准 */
.svg-sub-element {
  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;
  }
}
