/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-deep: #2D1438;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;

  /* 语义化颜色变量（默认纸面环境） */
  --c-bg: var(--color-paper);
  --c-text: var(--color-text);
  --c-heading: var(--color-text);
  --c-label: var(--color-brand);
  --c-link: var(--color-brand);
  --c-accent: var(--color-accent);
  --c-btn-primary-bg: var(--color-accent);
  --c-btn-primary-text: var(--color-deep);
  --c-btn-secondary-text: var(--color-text);
  --c-btn-secondary-border: var(--color-text);
  --c-card-border-color: rgba(31, 21, 35, 0.16);

  /* 结构与间距 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --header-h: 64px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* 深色面覆盖 */
.surface-dark {
  --c-bg: var(--color-deep);
  --c-text: var(--color-paper);
  --c-heading: var(--color-paper);
  --c-label: var(--color-accent);
  --c-link: var(--color-accent);
  --c-accent: var(--color-accent);
  --c-btn-primary-bg: var(--color-accent);
  --c-btn-primary-text: var(--color-deep);
  --c-btn-secondary-text: var(--color-paper);
  --c-btn-secondary-border: var(--color-paper);
  --c-card-border-color: rgba(246, 243, 247, 0.16);
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.75;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--c-link); text-decoration: none; transition: opacity 0.2s ease; }
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-block: var(--section-y);
  position: relative;
}
.section-inner {
  display: grid;
  gap: var(--gap);
  align-items: center;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* 排版 */
h1, h2, h3 {
  color: var(--c-heading);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 500;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); text-wrap: balance; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); text-wrap: balance; margin-bottom: 0.5em; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75em; }
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--c-label); }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-label);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 52px;
  padding: 0 1.5em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--c-label); outline-offset: 2px; }
.btn-primary {
  background: var(--c-btn-primary-bg);
  color: var(--c-btn-primary-text);
}
.btn-primary:hover { transform: translateY(-2px); opacity: 0.95; }
.btn-secondary {
  background: transparent;
  color: var(--c-btn-secondary-text);
  border-color: var(--c-btn-secondary-border);
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); transform: translateY(-2px); }
.btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.5; fill: none; }

/* 卡片 */
.card {
  background: var(--c-bg);
  border: 1px solid var(--c-card-border-color);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }
.card-grid { display: grid; gap: var(--gap); }
.card-grid.two { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.card-grid.three { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid var(--c-card-border-color);
}
th { font-weight: 700; color: var(--c-heading); }
td:last-child { color: var(--c-text); }
tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
  border: 1px solid var(--c-card-border-color);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--c-heading);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--c-card-border-color);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.faq-item[open] summary::before { content: "−"; }
.faq-item .faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--c-text);
  line-height: 1.75;
}

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
  height: var(--header-h);
}
.site-header.scrolled {
  border-bottom-color: var(--c-card-border-color);
  background: color-mix(in srgb, var(--c-bg) 90%, transparent);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--c-heading);
}
.brand img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5rem; align-items: center; }
nav a { color: var(--c-text); font-weight: 500; padding: 0.5em 0; position: relative; }
nav a[aria-current="page"] { color: var(--c-label); }
nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--c-label);
  transition: width 0.2s ease;
}
nav a:hover::after, nav a[aria-current="page"]::after { width: 100%; }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--c-card-border-color);
  text-align: center;
  color: var(--c-text);
  opacity: 0.85;
  font-size: 0.9rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: var(--c-link); }

/* SVG 图标通用 */
.icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  flex-shrink: 0;
}
.icon-lg { width: 32px; height: 32px; }
.icon-sm { width: 18px; height: 18px; }

/* SVG 动效基类 */
.anim-transform {
  transform-box: fill-box;
  transform-origin: center;
}
/* 绘制线条 */
@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 4s ease-in-out infinite;
}
/* 呼吸缩放 */
@keyframes breathe-scale {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}
.anim-breathe {
  animation: breathe-scale 6s ease-in-out infinite;
}
/* 浮动 */
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.anim-float {
  animation: float-y 5s ease-in-out infinite;
}
/* 滑入 */
@keyframes slide-up {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-6px); opacity: 1; }
}
.anim-slide {
  animation: slide-up 7s ease-in-out infinite;
}
/* 脉冲点 */
@keyframes pulse-dot {
  0%, 100% { r: 3; opacity: 0.8; }
  50% { r: 5; opacity: 1; }
}
.anim-pulse {
  animation: pulse-dot 3s ease-in-out infinite;
}
/* 轨道呼吸 */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.15); opacity: 0.7; }
}
.anim-orbit {
  animation: orbit-breathe 8s ease-in-out infinite;
}

/* 响应式与无障碍 */
@media (max-width: 768px) {
  .section-inner { grid-template-columns: 1fr; }
  .header-nav-desktop { display: none; }
  .mobile-menu-btn { display: inline-flex; }
}
@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-breathe, .anim-float, .anim-slide, .anim-pulse, .anim-orbit {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
