/* 设计变量与基础重置 */
:root {
  --color-bg-dark: #141838;
  --color-bg-paper: #FCFCFD;
  --color-text-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --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: 1.75;
  color: var(--color-text-body);
  background: var(--color-bg-paper);
  -webkit-font-smoothing: antialiased;
}

/* 排版层级 */
h1 { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 0.5em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.25; margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.75rem; }
p { max-width: 38em; margin-bottom: 1.5rem; }
.eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.75rem; display: block; }
.hl { font-weight: 800; }

/* 容器与布局 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--gap); }
.text-col { display: flex; flex-direction: column; }
.visual-col { position: relative; }

/* 取色规则：纸面（默认） */
.bg-paper { background-color: var(--color-bg-paper); color: var(--color-text-body); }
.bg-paper .hl { color: var(--color-brand); }
.bg-paper .eyebrow { color: var(--color-brand); }
.bg-paper a:not(.btn) { color: var(--color-brand); text-decoration: underline; text-underline-offset: 3px; }
.bg-paper .card-light { background: #F3F4F6; border: var(--card-border); box-shadow: var(--card-shadow); }

/* 取色规则：深色面 */
.bg-dark { background-color: var(--color-bg-dark); color: var(--color-bg-paper); }
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .eyebrow { color: var(--color-accent); }
.bg-dark a:not(.btn) { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.bg-dark .card-light { background: var(--color-bg-paper); color: var(--color-text-body); border: 1px solid rgba(0,0,0,0.06); }

/* 页头与导航 */
header { position: sticky; top: 0; z-index: 100; background: rgba(252,252,253,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(0,0,0,0.06); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.logo img { height: 32px; width: auto; display: block; }
.logo span { font-weight: 800; font-size: 1.1rem; color: var(--color-text-body); }
nav ul { display: flex; list-style: none; gap: 1.5rem; }
nav a { text-decoration: none; color: var(--color-text-body); font-weight: 500; transition: color 0.2s; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
@media (max-width: 768px) {
  .nav-inner { flex-direction: column; height: auto; padding: 1rem 0; }
  nav ul { flex-wrap: wrap; justify-content: center; gap: 1rem; }
}

/* 页脚 */
footer { border-top: 1px solid rgba(0,0,0,0.06); padding: var(--section-y) 0; background: var(--color-bg-paper); }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { font-weight: 700; margin-bottom: 0.75rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { text-decoration: none; color: var(--color-text-body); opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.footer-bottom { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(0,0,0,0.06); text-align: center; font-size: 0.85rem; opacity: 0.7; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0 1.25rem; height: 48px; border-radius: var(--radius-btn); font-weight: 600; text-decoration: none; cursor: pointer; transition: transform 0.2s, background 0.2s, border-color 0.2s; }
.btn-primary { background: var(--color-accent); color: var(--color-bg-dark); }
.btn-primary:hover { background: #5a9de0; transform: translateY(-1px); }
.btn-secondary { background: transparent; border: 1px solid var(--color-text-body); color: var(--color-text-body); }
.btn-secondary:hover { background: rgba(0,0,0,0.04); transform: translateY(-1px); }
.btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.bg-dark .btn-secondary { border-color: var(--color-bg-paper); color: var(--color-bg-paper); }
.bg-dark .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* 卡片与面板 */
.card { border-radius: var(--radius-card); padding: var(--gap); }
.panel { border-radius: var(--radius-card); overflow: hidden; }
.panel svg { width: 100%; height: auto; display: block; }

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  white-space: normal;
}
th { font-weight: 700; }
td:last-child { white-space: nowrap; }

/* FAQ */
details { margin-bottom: 1rem; border-bottom: 1px solid rgba(0,0,0,0.08); padding-bottom: 1rem; }
summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 1.5rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 0.75rem; color: var(--color-text-body); }
.bg-dark details { border-bottom-color: rgba(255,255,255,0.1); }
.bg-dark details p { color: var(--color-bg-paper); }

/* SVG 动效核心类 */
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-flow { animation: flowLine 4s linear infinite alternate; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-grid { animation: gridBlink 5s ease-in-out infinite; }
svg text { user-select: none; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes flowLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes gridBlink { 0%, 100% { fill: #2a2f5c; } 50% { fill: #6EAFED; } }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr !important; }
  .sidebar-toc { display: none; }
  .step-row { flex-direction: column; }
}
