/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  
  --radius-card: 24px;
  --radius-btn: 999px;
  --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, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.75;
  color: var(--tx, var(--color-text));
  background-color: var(--bg, var(--color-paper));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link, var(--color-brand)); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 容器与布局 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  background-color: var(--bg, var(--color-paper));
  position: relative;
}
section + section { border-top: 1px solid rgba(0,0,0,0.08); }
.surface-dark { --bg: #1c1330; --tx: #DBD4ED; --link: var(--color-accent); --accent: var(--color-accent); }
.surface-paper { --bg: var(--color-paper); --tx: var(--color-text); --link: var(--color-brand); --accent: var(--color-brand); }
.card.light { --bg: var(--color-paper); --tx: var(--color-text); --link: var(--color-brand); --accent: var(--color-brand); }

/* 排版层级 */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; color: var(--tx, var(--color-text)); letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); text-wrap: balance; margin-bottom: 0.8em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.6em; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.5em; }
p { margin-bottom: 1em; max-width: 38em; }
.text-hl { color: var(--accent, var(--color-brand)); font-weight: 600; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent, var(--color-brand));
  margin-bottom: 0.5em;
  position: relative;
  padding-left: 1.2em;
}
.badge::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
}

/* 组件：按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.8em 1.6em;
  min-height: 48px;
  border-radius: var(--radius-btn);
  font-size: 1rem; font-weight: 600;
  cursor: pointer; border: none; outline: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn-primary {
  background-color: var(--accent, var(--color-brand));
  color: var(--bg, var(--color-paper));
}
.btn-secondary {
  background: transparent;
  color: var(--tx, var(--color-text));
  border: 1px solid currentColor;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--accent, var(--color-brand)); }

/* 组件：卡片 */
.card {
  background: var(--bg, var(--color-paper));
  border: var(--card-border, 0) solid currentColor;
  box-shadow: var(--card-shadow, none);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
}
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 组件：表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 600; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* 组件：FAQ */
.faq-item { border-bottom: 1px solid rgba(128,128,128,0.2); margin-bottom: 1rem; }
summary {
  padding: 1rem 0; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2em; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details[open] summary { margin-bottom: 0.5rem; }
.faq-answer { padding-bottom: 1rem; color: var(--tx, var(--color-text)); opacity: 0.9; }

/* 组件：步骤徽标 */
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent, var(--color-brand));
  color: var(--bg, var(--color-paper));
  border-radius: 8px; font-weight: 700; font-size: 0.9rem;
  margin-right: 0.5em; vertical-align: middle;
}

/* 页头与页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap);
}
.brand { display: flex; align-items: center; gap: 0.8em; font-weight: 700; font-size: 1.1rem; color: var(--tx, var(--color-text)); }
.brand img { width: 32px; height: 32px; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { color: var(--tx, var(--color-text)); font-weight: 500; }
.nav a[aria-current="page"] { color: var(--accent, var(--color-brand)); }
.site-footer {
  padding: 3rem 0;
  background: var(--bg, var(--color-dark));
  color: var(--tx, var(--color-paper));
  border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--gap); }
.footer-links a { margin-right: 1.5rem; opacity: 0.8; }

/* SVG 动效关键帧 */
@keyframes flow-path {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-path 6s linear infinite alternate;
}
.bubble-float {
  animation: float-slow 5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.bubble-pop {
  animation: float-fast 4s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.input-dot {
  animation: breathe 2.5s ease-in-out infinite;
}

@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-line, .bubble-float, .bubble-pop, .input-dot { animation: none !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; height: auto; padding: 1rem var(--gap); }
  .nav { flex-wrap: wrap; justify-content: center; margin-top: 0.5rem; }
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
}
