/* =========================================
   SafeW 共享样式表
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --bg-dark: #121531;
  --bg-paper: #E8E9EA;
  --text-main: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;

  /* 结构 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;

  /* 排版 Token */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --lh-text: 1.65;
  --lh-title: 1.25;
  --fw-title: 600;
}

/* --- 表面层取色映射 --- */
.surface-paper {
  --bg-surface: var(--bg-paper);
  --text-surface: var(--text-main);
  --brand-surface: var(--brand);
  --highlight-surface: var(--brand);
}
.surface-dark {
  --bg-surface: var(--bg-dark);
  --text-surface: var(--bg-paper);
  --brand-surface: var(--accent);
  --highlight-surface: var(--accent);
}
.card-light {
  --bg-surface: var(--bg-paper);
  --text-surface: var(--text-main);
  --brand-surface: var(--brand);
  --highlight-surface: var(--brand);
}

/* --- 基础重置与全局 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-text);
  color: var(--text-surface);
  background-color: var(--bg-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand-surface); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--highlight-surface); outline-offset: 2px; border-radius: 2px; }

/* --- 容器与布局 --- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
section {
  padding-block: var(--section-y);
  position: relative;
}
.surface-paper + .surface-paper::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: currentColor;
  opacity: 0.12;
}

/* --- 排版 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-surface);
  margin-bottom: 0.75rem;
}
h1, h2, h3, h4 {
  font-weight: var(--fw-title);
  line-height: var(--lh-title);
  letter-spacing: 0;
  color: var(--text-surface);
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--highlight-surface); font-weight: 700; }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  height: 52px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
}
.btn-secondary {
  background: transparent;
  color: var(--text-surface);
  border: 1px solid var(--text-surface);
}
.btn-primary:hover, .btn-secondary:hover { transform: translateY(-1px); }
.btn-primary:focus-visible { outline: 3px solid var(--bg-paper); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* --- 组件：卡片 --- */
.card {
  background-color: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* --- 组件：表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 320px;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
th { font-weight: 600; color: var(--text-surface); }
td { color: var(--text-surface); }
tr:last-child td { border-bottom: none; }

/* --- 组件：FAQ --- */
details {
  border-bottom: 1px solid rgba(128,128,128,0.2);
  padding: 1rem 0;
  list-style: none;
}
summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-surface);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--brand-surface);
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 0.75rem; color: var(--text-surface); }

/* --- 组件：步骤徽标 --- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--accent);
  color: var(--bg-dark);
  font-weight: 700;
  border-radius: 8px;
  flex-shrink: 0;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface);
  border-bottom: 1px solid rgba(128,128,128,0.15);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-area { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; color: var(--text-surface); }
.logo-area img { width: 28px; height: 28px; object-fit: contain; }
nav { display: flex; gap: 1.5rem; align-items: center; }
nav a { color: var(--text-surface); font-weight: 500; font-size: 0.95rem; }
nav a[aria-current="page"] { color: var(--highlight-surface); font-weight: 700; }
.site-footer {
  padding-block: 2rem;
  border-top: 1px solid rgba(128,128,128,0.15);
  text-align: center;
  color: var(--text-surface);
  font-size: 0.9rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: var(--brand-surface); }

/* --- SVG 动效核心 --- */
.svg-responsive {
  width: 100%;
  height: auto;
  display: block;
}
svg path, svg circle, svg rect, svg line, svg polyline, svg polygon {
  transform-box: fill-box;
  transform-origin: center;
}

/* 描边绘制效果 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLoop 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes drawLoop {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}

/* 同心轨道呼吸 */
.anim-orbit {
  animation: orbitBreath 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.anim-orbit-delay { animation-delay: -4s; }
.anim-orbit-slow { animation-duration: 16s; }
@keyframes orbitBreath {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* 气泡浮动 */
.anim-float {
  animation: floatY 8s ease-in-out infinite;
}
.anim-float-delay { animation-delay: -3s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 通知滑入 */
.anim-slide-in {
  animation: slideIn 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes slideIn {
  0%, 10% { transform: translateX(0); opacity: 1; }
  15%, 85% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(12px); opacity: 0; }
}

/* --- 减少动态效果 --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  .anim-draw, .anim-orbit, .anim-float, .anim-slide-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column-reverse; }
  .hero-text { order: 1; }
  .hero-visual { order: 2; max-width: 90%; margin-inline: auto; }
  nav { gap: 1rem; }
  .btn { width: 100%; justify-content: center; }
}
