/* =========================================
   1. 设计变量 (Design Tokens)
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-text: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;
  --color-white: #FFFFFF;

  /* 结构与节奏 */
  --content-max: 1120px;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  
  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.65;
  
  /* 形状与边界 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
}

/* =========================================
   2. 基础重置与全局样式
   ========================================= */
*, *::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-paper);
  color: var(--color-text);
  line-height: var(--line-height-body);
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   3. 布局容器
   ========================================= */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding: var(--section-y) 0;
  position: relative;
}

/* 分节线 */
.section-divider {
  width: 100%;
  height: 1px;
  background-color: rgba(31, 21, 35, 0.15);
  border: none;
}

/* =========================================
   4. 页头与导航
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  backdrop-filter: blur(8px);
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: 0 4px 12px rgba(31, 21, 35, 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: color 0.2s ease;
  position: relative;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--color-brand);
}

.nav-link[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-brand);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--color-text);
}

/* =========================================
   5. 按钮组件
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  line-height: 1.2;
}

.btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

/* 深色面上的按钮变体 */
.dark-theme .btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}

.dark-theme .btn-secondary {
  color: var(--color-white);
  border-color: var(--color-white);
}

/* =========================================
   6. 标题与眉标
   ========================================= */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: var(--color-brand);
  text-transform: uppercase;
}

.dark-theme .section-label {
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: 16px;
}

.dark-theme h1,
.dark-theme h2,
.dark-theme h3,
.dark-theme h4 {
  color: var(--color-white);
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-top: 0;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.highlight {
  color: var(--color-brand);
}

.dark-theme .highlight {
  color: var(--color-accent);
}

/* =========================================
   7. 卡片与面板
   ========================================= */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: 0 12px 32px -12px rgba(31, 21, 35, 0.4);
  transform: translateY(-4px);
}

.dark-theme .card {
  background-color: var(--color-paper);
  color: var(--color-text);
}

.panel {
  background-color: var(--color-dark);
  padding: var(--gap);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  color: var(--color-white);
}

.dark-theme .panel {
  background-color: var(--color-dark);
  color: var(--color-white);
}

/* =========================================
   8. 表格样式
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(31, 21, 35, 0.1);
  border-radius: var(--radius-card);
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  white-space: normal;
  table-layout: fixed;
}

th, td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}

th {
  background-color: rgba(31, 21, 35, 0.05);
  font-weight: 700;
  color: var(--color-text);
}

td {
  color: var(--color-text);
}

tr:last-child td {
  border-bottom: none;
}

.dark-theme th,
.dark-theme td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

.dark-theme th {
  background-color: rgba(255, 255, 255, 0.05);
}

/* =========================================
   9. FAQ (Details/Summary)
   ========================================= */
details {
  border-bottom: 1px solid rgba(31, 21, 35, 0.15);
  padding: 20px 0;
}

summary {
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text);
  transition: color 0.2s ease;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--color-brand);
  transition: transform 0.3s ease;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  margin-top: 12px;
  color: var(--color-text);
  line-height: 1.7;
}

.dark-theme details {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.dark-theme summary {
  color: var(--color-white);
}

.dark-theme details p {
  color: rgba(255, 255, 255, 0.85);
}

/* =========================================
   10. 页脚
   ========================================= */
.site-footer {
  background-color: var(--color-dark);
  color: var(--color-white);
  padding: 64px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  margin-bottom: 48px;
}

.footer-col h4 {
  color: var(--color-white);
  font-size: 1rem;
  margin-bottom: 20px;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-col a:hover,
.footer-col a:focus-visible {
  color: var(--color-accent);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

/* =========================================
   11. SVG 动效 (CSS Keyframes)
   ========================================= */

/* 数据点沿路径流动 */
@keyframes flow-along-path {
  0% { offset-distance: 0%; }
  100% { offset-distance: 100%; }
}

.flow-dot {
  fill: var(--color-accent);
  animation: flow-along-path 4s linear infinite;
  offset-path: var(--flow-path);
}

/* 呼吸效果 (用于输入框光标等) */
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.breathing {
  animation: breathe 2s ease-in-out infinite;
}

/* 轻微漂浮 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.floating {
  animation: float 6s ease-in-out infinite;
}

/* 滑入效果 */
@keyframes slide-in-up {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.slide-in {
  animation: slide-in-up 0.8s ease-out forwards;
}

/* =========================================
   12. 响应式适配
   ========================================= */
@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;
  }
  .flow-dot {
    offset-path: none;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none; /* 简化处理，实际项目可加移动端菜单 JS */
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   13. 焦点可见性优化
   ========================================= */
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}
