/* === 设计变量与基础重置 === */
:root {
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* === 表面层颜色继承系统 === */
.surface-dark {
  --bg-surface: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(252, 253, 255, 0.85);
  --accent-primary: var(--color-accent);
  --brand-primary: var(--color-accent);
  color: var(--text-primary);
  background: var(--bg-surface);
}
.surface-dark a:not(.btn) { color: var(--accent-primary); }
.surface-dark .hl { color: var(--accent-primary); }

.surface-paper {
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(25, 21, 35, 0.75);
  --accent-primary: var(--color-brand);
  --brand-primary: var(--color-brand);
  color: var(--text-primary);
  background: var(--bg-surface);
}
.surface-paper a:not(.btn) { color: var(--brand-primary); }
.surface-paper .hl { color: var(--brand-primary); }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* === 排版层级 === */
h1, h2, h3 { font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 1.2rem; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin-bottom: 1.5rem; }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-bottom: 0.8rem; }
p { margin-bottom: 1.2rem; max-width: 38em; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-card);
  background: rgba(128,128,128,0.1);
}
.surface-dark .badge { background: rgba(255,255,255,0.1); }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border: none;
}
.btn:focus-visible { outline: 3px solid var(--accent-primary); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

/* === 组件：卡片 === */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }

/* === 布局辅助 === */
.section { padding-block: var(--section-y); border-bottom: var(--line-sep); }
.section:last-child { border-bottom: none; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* === SVG 响应式 === */
.svg-responsive { width: 100%; height: auto; }
svg[aria-hidden="true"] { overflow: hidden; }

/* === SVG 动效关键帧 === */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes slideIn {
  0% { transform: translateX(-16px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-float-delay { animation: float 5s ease-in-out infinite 1.5s; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-draw { animation: drawLine 6s linear infinite; }
.anim-slide { animation: slideIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

/* 旋转缩放子元素修正 */
.anim-spin { animation: spin 12s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === 减少动态效果 === */
@media (prefers-reduced-motion: reduce) {
  .anim-float, .anim-float-delay, .anim-breathe, .anim-draw, .anim-slide, .anim-spin {
    animation: none !important;
  }
}

/* === 导航与页脚 === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 253, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 0.8rem 0;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* === 特殊区块样式 === */
.hero-visual-wrap { position: relative; min-height: 400px; display: flex; align-items: center; justify-content: center; }
.floating-stat-card {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 320px);
  z-index: 10;
}
.magazine-layout { display: grid; grid-template-columns: 1fr 240px; gap: 2.5rem; }
.toc-sidebar { position: sticky; top: 80px; align-self: start; }
.toc-list { border-left: 2px solid var(--color-brand); padding-left: 1rem; }
.toc-link { display: block; padding: 0.4rem 0; font-size: 0.9rem; color: var(--text-secondary); }
.toc-link.active, .toc-link:hover { color: var(--brand-primary); font-weight: 600; }
.timeline-step { display: flex; gap: 1.2rem; margin-bottom: 1.5rem; }
.step-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 1.2rem;
  border-radius: var(--radius-btn);
}
.news-card article { height: 100%; display: flex; flex-direction: column; }
.news-card time { margin-top: auto; font-size: 0.85rem; color: var(--text-secondary); }
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
th, td { text-align: left; padding: 0.8rem; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 600; color: var(--text-secondary); }
td:first-child { font-weight: 600; }
details { border: 1px solid rgba(128,128,128,0.3); border-radius: var(--radius-card); margin-bottom: 0.8rem; overflow: hidden; }
summary { padding: 1rem; cursor: pointer; font-weight: 600; list-style: none; }
summary::-webkit-details-marker { display: none; }
details[open] summary { border-bottom: 1px solid rgba(128,128,128,0.2); }
.details-content { padding: 1rem; color: var(--text-secondary); }
.scene-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.scene-card { background: rgba(128,128,128,0.05); padding: 1.5rem; border-radius: var(--radius-card); }
.feature-list dt { font-weight: 700; margin-top: 1.2rem; margin-bottom: 0.3rem; }
.feature-list dd { margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--color-brand); color: var(--text-secondary); }
.surface-dark .feature-list dd { border-left-color: var(--color-accent); }
.surface-dark .scene-card { background: rgba(255,255,255,0.05); }

/* 响应式调整 */
@media (max-width: 768px) {
  .magazine-layout { grid-template-columns: 1fr; }
  .toc-sidebar { display: none; }
  .scene-row { grid-template-columns: 1fr; }
  .floating-stat-card { position: static; transform: none; margin-top: 2rem; }
  .hero-visual-wrap { min-height: 280px; }
}
