/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --bg-dark: #121531;
  --bg-paper: #E8E9EA;
  --text-body: #151723;
  --brand: #142CEB;
  --accent: #ED7D6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--text-body);
  --card-shadow: 4px 4px 0 var(--text-body);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-base: 1.75;
  --line-height-tight: 1.25;

  /* 默认取色（纸面） */
  --text-color: var(--text-body);
  --heading-color: var(--text-body);
  --link-color: var(--brand);
  --subtle-color: rgba(21, 23, 35, 0.6);
  --bg-surface: var(--bg-paper);
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--text-color);
  background: var(--bg-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { padding-left: 1.2em; margin: 0; }
h1, h2, h3, h4 { margin: 0 0 0.8em 0; font-weight: 600; line-height: var(--line-height-tight); color: var(--heading-color); }
p { margin: 0 0 1.2em 0; max-width: 40em; }

/* 容器与布局 */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-block: var(--section-y); }
.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-center { display: flex; align-items: center; justify-content: center; }

/* 表面层控制 */
.surface-dark {
  --text-color: var(--bg-paper);
  --heading-color: var(--bg-paper);
  --link-color: var(--accent);
  --subtle-color: rgba(232, 233, 234, 0.7);
  --bg-surface: var(--bg-dark);
  background: var(--bg-dark);
  color: var(--text-color);
}
.surface-paper {
  --text-color: var(--text-body);
  --heading-color: var(--text-body);
  --link-color: var(--brand);
  --subtle-color: rgba(21, 23, 35, 0.6);
  --bg-surface: var(--bg-paper);
  background: var(--bg-paper);
  color: var(--text-color);
}
.card-light {
  background: var(--bg-paper);
  color: var(--text-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* 眉标与标题修饰 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6em;
  color: var(--link-color);
}
.badge::before { content: ""; display: inline-block; width: 12px; height: 2px; background: currentColor; }
.hl { color: var(--link-color); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  height: 48px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  text-align: center;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); background: #d96b5c; }
.btn-secondary {
  background: transparent;
  color: var(--text-color);
  border: 2px solid var(--text-color);
}
.btn-secondary:hover { transform: translateY(-2px); opacity: 0.8; }

/* 卡片 */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }

/* 表格 */
.table-wrap { overflow-x: auto; margin: 1.5em 0; border: var(--card-border); border-radius: var(--radius-card); }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--subtle-color); }
th { font-weight: 600; background: rgba(0,0,0,0.03); }
td { vertical-align: top; }

/* FAQ */
details { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
summary {
  padding: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 40px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: bold;
}
details[open] summary::after { content: "-"; }
details > p { padding: 0 16px 16px; margin: 0; line-height: 1.7; }

/* 步骤徽标 */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--accent);
  color: var(--bg-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  margin-right: 0.5em;
  flex-shrink: 0;
}

/* 页头与页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--subtle-color);
  backdrop-filter: blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--heading-color); }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { color: var(--text-color); font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--link-color); }
.site-footer { padding: 48px 0; border-top: 1px solid var(--subtle-color); margin-top: 48px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-links { display: flex; gap: 16px; }
.footer-copy { font-size: 0.85rem; color: var(--subtle-color); margin-top: 16px; }

/* SVG 动效核心 */
.svg-anim { width: 100%; height: auto; display: block; }
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-stroke 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.anim-breathe {
  transform-box: fill-box;
  transform-origin: center;
  animation: breathe 4s ease-in-out infinite;
}
.anim-float {
  transform-box: fill-box;
  transform-origin: center;
  animation: float 5s ease-in-out infinite;
}
@keyframes draw-stroke {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(1.02); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 减少动态效果 */
@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;
  }
  .anim-draw, .anim-breathe, .anim-float { animation: none !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .hero-layout { flex-direction: column; }
  .hero-visual { order: -1; max-width: 90%; margin: 0 auto; }
}
@media (min-width: 769px) {
  .mobile-menu-btn { display: none; }
}
