/* === 全局设计与 Token === */
:root {
  /* 色板 */
  --bg-dark: #271334;
  --bg-paper: #E9E8EA;
  --text-body: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;

  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;

  /* 卡片边界与阴影 */
  --card-border: 2px solid var(--text-body);
  --card-shadow: 4px 4px 0 var(--text-body);

  /* 节奏与密度 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --line-height-base: 1.65;

  /* 内容宽度 */
  --content-max: 1120px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === 基础重置与排版 === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  line-height: var(--line-height-base);
  color: var(--text-body);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  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: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}

/* 细线分节 */
.section-divider {
  border-top: 1px solid var(--text-body);
  opacity: 0.3;
  margin: 0;
}

/* === 眉标与标题 === */
.breadcrumb {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
  display: block;
}

.dark-surface .breadcrumb {
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-top: 0.5rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* 高亮关键词 */
.hl {
  color: var(--color-brand);
}

.dark-surface .hl {
  color: var(--color-accent);
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.2s ease, filter 0.2s ease;
  cursor: pointer;
  text-align: center;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--bg-dark);
  border: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-body);
  border: 2px solid var(--text-body);
}

.dark-surface .btn-secondary {
  color: var(--bg-paper);
  border-color: var(--bg-paper);
}

/* === 卡片 === */
.card {
  background-color: var(--bg-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dark-surface .card {
  background-color: var(--bg-paper);
  color: var(--text-body);
}

/* === 表格 === */
.table-wrapper {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--bg-paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(29, 21, 35, 0.15);
}

th {
  font-weight: 700;
  background: rgba(138, 19, 221, 0.08);
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* === FAQ (<details>) === */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background: var(--bg-paper);
  overflow: hidden;
}

summary {
  padding: 1rem 1.5rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(138, 19, 221, 0.05);
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details[open] summary {
  border-bottom: 1px solid rgba(29, 21, 35, 0.15);
}

details p {
  padding: 1rem 1.5rem;
  margin: 0;
}

/* === 页头与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(29, 21, 35, 0.1);
  padding: 0.75rem 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.2rem;
}

.logo img {
  width: 32px;
  height: 32px;
}

nav ul {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  position: relative;
}

nav a:hover, nav a[aria-current="page"] {
  color: var(--color-brand);
}

nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-brand);
}

.site-footer {
  background: var(--bg-dark);
  color: var(--bg-paper);
  padding: 3rem 0;
  margin-top: var(--section-y);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  text-align: center;
}

.footer-nav ul {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a:hover {
  color: var(--color-accent);
}

.footer-copy {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* === SVG 动效 Keyframes === */
/* 绘制动画 */
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* 浮动效果 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 脉冲呼吸 */
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 滑入效果 */
@keyframes slide-in-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 数据点流动 */
@keyframes flow-dot {
  0% { offset-distance: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* 动效类应用 */
.animate-draw {
  stroke-dasharray: 1;
  animation: draw-line 2s ease forwards;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse-opacity 2.5s ease-in-out infinite;
}

.animate-slide-in {
  animation: slide-in-up 0.8s ease-out forwards;
}

.flow-path {
  stroke-dasharray: 4;
  stroke-dashoffset: 0;
  animation: draw-line 3s linear infinite alternate;
}

/* 减少动态效果偏好 */
@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;
  }
  .animate-draw, .animate-float, .animate-pulse, .animate-slide-in, .flow-path {
    animation: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

/* === 响应式调整 === */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 1rem;
  }
  
  nav ul {
    gap: 1rem;
  }
  
  .grid-2col, .grid-3col {
    grid-template-columns: 1fr;
  }
  
  .feature-row {
    flex-direction: column;
  }
  
  .feature-row.reverse {
    flex-direction: column;
  }
}

.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.feature-row {
  display: flex;
  gap: var(--gap);
  align-items: center;
}

.feature-text {
  flex: 1;
  min-width: 0;
}

.feature-visual {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.dark-surface {
  background-color: var(--bg-dark);
  color: var(--bg-paper);
}

.dark-surface .card {
  background-color: var(--bg-paper);
  color: var(--text-body);
}

.dark-surface .btn-primary {
  background-color: var(--color-accent);
  color: var(--bg-dark);
}

.dark-surface .btn-secondary {
  color: var(--bg-paper);
  border-color: var(--bg-paper);
}
