/* ==========================================
   SafeW 全局样式与 SVG 动效
   ========================================== */

:root {
  /* 色板 */
  --color-dark: #121531;
  --color-paper: #E8E9EA;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #ED7D6E;

  /* 取色变量（跟随容器自动切换） */
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-highlight: var(--color-brand);
  --link-color: var(--color-brand);

  /* 结构性 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --font-base: 16px;
  --line-height-body: 1.65;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: var(--font-base);
  line-height: var(--line-height-body);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 表面层控制类 */
.surface-dark {
  --bg-surface: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-highlight: var(--color-accent);
  --link-color: var(--color-accent);
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-paper {
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-highlight: var(--color-brand);
  --link-color: var(--color-brand);
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* 排版层级 */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
p { max-width: 38em; margin-bottom: 1em; }
a { color: var(--link-color); text-decoration: underline; text-underline-offset: 3px; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
.hl { color: var(--text-highlight); font-weight: 600; }

/* 布局容器 */
.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: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.text-center { text-align: center; }

/* 组件：按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0 1.5em; height: 52px; border-radius: var(--radius-btn);
  font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background-color: var(--color-accent); color: var(--color-dark); border: 2px solid var(--color-accent); }
.btn-secondary { background: transparent; color: var(--text-primary); border: 2px solid var(--text-primary); }
.btn:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* 组件：卡片 */
.card {
  background: rgba(255,255,255,0.05); border: var(--card-border);
  border-radius: var(--radius-card); padding: 1.5rem;
  box-shadow: var(--card-shadow);
}
.surface-paper .card { background: rgba(0,0,0,0.03); }
.surface-dark .card { background: rgba(255,255,255,0.08); }

/* 组件：表格 */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.25); }
th { font-weight: 600; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 组件：FAQ */
details { margin-bottom: 1rem; border: 1px solid rgba(128,128,128,0.2); border-radius: 12px; overflow: hidden; }
summary { padding: 1rem; cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 2.5rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); transition: transform 0.2s; }
details[open] summary::after { content: '−'; transform: translateY(-50%) rotate(90deg); }
details p { padding: 0 1rem 1rem; margin: 0; line-height: 1.6; }

/* 组件：眉标 */
.badge-label {
  display: inline-block; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.05em; margin-bottom: 0.75rem; color: var(--text-highlight);
}

/* 组件：编号徽标 */
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px; background: var(--color-accent);
  color: var(--color-dark); font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}

/* 页头与页脚 */
header { position: sticky; top: 0; z-index: 100; background: rgba(232,233,234,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(0,0,0,0.06); }
.surface-dark header { background: rgba(18,21,49,0.92); border-bottom-color: rgba(255,255,255,0.1); }
.nav-container { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo img { height: 32px; width: auto; vertical-align: middle; margin-right: 0.5rem; }
nav ul { display: flex; gap: 1.5rem; list-style: none; }
nav a { color: inherit; text-decoration: none; font-weight: 500; opacity: 0.85; }
nav a:hover, nav a[aria-current="page"] { opacity: 1; color: var(--text-highlight); }
footer { padding: 3rem 0; border-top: 1px solid rgba(128,128,128,0.2); margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.75rem; opacity: 0.7; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: inherit; text-decoration: none; opacity: 0.8; }
.footer-col a:hover { opacity: 1; }
.copyright { margin-top: 2rem; text-align: center; font-size: 0.85rem; opacity: 0.6; }

/* SVG 通用样式 */
.svg-panel { width: 100%; height: auto; display: block; }
.svg-panel svg { width: 100%; height: auto; }
svg { overflow: visible; }

/* SVG 动效 Keyframes */
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes node-light { 0%, 100% { fill: rgba(255,255,255,0.15); } 50% { fill: var(--color-accent); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* 动效应用类 */
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 4s ease-in-out infinite; }
.fade-in { animation: fade-in-up 1.5s ease-out forwards; }
.float { animation: float 6s ease-in-out infinite; }
.breathe { animation: breathe 3s ease-in-out infinite; }
.slide-in-delay-1 { animation: slide-in 1.2s ease-out 0.2s forwards; opacity: 0; }
.slide-in-delay-2 { animation: slide-in 1.2s ease-out 0.4s forwards; opacity: 0; }
.slide-in-delay-3 { animation: slide-in 1.2s ease-out 0.6s forwards; opacity: 0; }
.node-lit-1 { animation: node-light 4s ease-in-out infinite 0s; }
.node-lit-2 { animation: node-light 4s ease-in-out infinite 0.5s; }
.node-lit-3 { animation: node-light 4s ease-in-out infinite 1.0s; }
.node-lit-4 { animation: node-light 4s ease-in-out infinite 1.5s; }
.node-lit-5 { animation: node-light 4s ease-in-out infinite 2.0s; }
.rot-center { 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; }
  .fade-in, .slide-in-delay-1, .slide-in-delay-2, .slide-in-delay-3 { opacity: 1; transform: none; }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  nav ul { display: none; }
  .hero-layout { flex-direction: column-reverse !important; }
}
