/* =========================================
   SafeW 全局样式与动效系统
   ========================================= */
:root {
  /* 色板 */
  --bg-dark: #10112D;
  --bg-paper: #F5F0E5;
  --text-body: #151523;
  --brand-blue: #1416EB;
  --accent-green: #89ED6E;

  /* 设计 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 取色变量（默认纸面环境） */
  --text-primary: var(--text-body);
  --text-secondary: var(--text-body);
  --brand: var(--brand-blue);
  --accent: var(--accent-green);
}

/* 深色面环境覆盖 */
.dark-bg {
  background-color: var(--bg-dark);
  --text-primary: var(--bg-paper);
  --text-secondary: var(--bg-paper);
  --brand: var(--accent-green);
  --accent: var(--accent-green);
}

/* 浅色卡片环境覆盖（在深色面上使用） */
.card-light {
  background-color: var(--bg-paper);
  color: var(--text-body);
  --text-primary: var(--text-body);
  --text-secondary: var(--text-body);
  --brand: var(--brand-blue);
  --accent: var(--accent-green);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 标题系统 */
.eyebrow {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.75rem;
}
h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  margin-top: 2rem;
}
p {
  max-width: 38em;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}
.hl {
  color: var(--brand);
  font-weight: 700;
}
.dark-bg .hl {
  color: var(--accent);
}

/* 按钮系统 */
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; margin: 2rem 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--text-primary);
}
.dark-bg .btn-secondary {
  color: var(--bg-paper);
  border-color: var(--bg-paper);
}

/* 卡片与面板 */
.card {
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 2rem;
  margin-bottom: var(--gap);
  transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(21, 21, 35, 0.4); }

/* 表格 */
.table-wrapper { overflow-x: auto; margin: 2rem 0; border-radius: var(--radius-card); }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-paper);
  color: var(--text-body);
}
th, td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(21, 21, 35, 0.1);
}
th { font-weight: 700; background: rgba(21, 21, 35, 0.05); }
td:first-child { font-weight: 600; white-space: nowrap; }
a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.dark-bg a { color: var(--accent); }

/* FAQ / Details */
details {
  border: 1px solid rgba(21, 21, 35, 0.1);
  border-radius: 12px;
  margin-bottom: 1rem;
  padding: 1.25rem;
  transition: background-color 0.2s;
}
.dark-bg details { border-color: rgba(245, 240, 229, 0.15); }
summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  font-size: 1.2rem;
}
details[open] summary::after { content: "-"; }
details p { margin-top: 1rem; margin-bottom: 0; font-size: 0.95rem; }

/* 网格布局 */
.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); }

/* 导航与页头 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 240, 229, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(21, 21, 35, 0.08);
  padding: 1rem 0;
}
.dark-bg .header { background: rgba(16, 17, 45, 0.9); border-bottom-color: rgba(245, 240, 229, 0.1); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.brand img { height: 32px; width: auto; display: block; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { text-decoration: none; font-weight: 500; font-size: 0.95rem; color: var(--text-secondary); }
.nav-links a:hover { color: var(--brand); }
.nav-links a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.dark-bg .nav-links a { color: var(--text-secondary); }

.footer {
  padding: 4rem 0;
  border-top: 1px solid rgba(21, 21, 35, 0.1);
  margin-top: 4rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.dark-bg .footer { border-top-color: rgba(245, 240, 229, 0.1); }

/* SVG 动效基础 */
.svg-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hero-svg { width: 100%; height: auto; display: block; }
.flow-dot { fill: var(--accent); }
.bubble-float { animation: float 4s ease-in-out infinite alternate; }
.input-breathe { animation: breathe 2s ease-in-out infinite; }
.notify-slide { animation: slideIn 5s ease-in-out infinite; }
.connect-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 6s linear infinite; }

@keyframes float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0%, 10% { transform: translateX(-20px); opacity: 0; }
  20%, 80% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(20px); opacity: 0; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 减少动态效果 */
@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) {
  .nav-links { display: none; } /* 简化移动端导航，实际项目可加汉堡菜单 */
  h1 { font-size: 2.2rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
