/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  --c-dark: #10112D;
  --c-paper: #F5F0E5;
  --c-text: #151523;
  --c-brand: #1416EB;
  --c-accent: #89ED6E;
  --r-card: 24px;
  --r-btn: 999px;
  --b-card: 0;
  --s-card: 0 10px 28px -14px rgba(21, 21, 35, 0.3);
  --y-sec: clamp(5rem, 10vw, 9rem);
  --g-gap: clamp(1.5rem, 3vw, 2.5rem);
  --max-w: 1120px;
  --lh-body: 1.75;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* --- 主题上下文覆盖 --- */
.theme-dark {
  --bg: var(--c-dark);
  --fg: var(--c-paper);
  --hl: var(--c-accent);
  --link: var(--c-accent);
  --border-subtle: rgba(255, 255, 255, 0.1);
}
.theme-paper {
  --bg: var(--c-paper);
  --fg: var(--c-text);
  --hl: var(--c-brand);
  --link: var(--c-brand);
  --border-subtle: rgba(21, 21, 35, 0.12);
}
/* 深色背景内的浅色卡片恢复纸面取色 */
.card-light {
  background: var(--c-paper);
  color: var(--c-text);
  border-radius: var(--r-card);
  box-shadow: var(--s-card);
  padding: var(--g-gap);
}

/* --- 基础重置与排版 --- */
*, *::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: var(--lh-body);
  color: var(--c-text);
  background: var(--c-paper);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; transition: color 0.2s; }
a:hover { opacity: 0.85; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }

/* --- 容器与网格 --- */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--g-gap);
}
.grid-auto {
  display: grid;
  gap: var(--g-gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.flex-row { display: flex; flex-wrap: wrap; gap: var(--g-gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--g-gap); }

/* --- 区块结构 --- */
.section {
  padding-block: var(--y-sec);
  background: var(--bg);
  color: var(--fg);
}
.section + .section { border-top: 1px solid var(--border-subtle); }
.section-header { margin-bottom: var(--g-gap); }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  color: var(--hl);
}
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.8em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.6em;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.4em;
}
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--hl); font-weight: 600; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.8em 1.6em;
  border-radius: var(--r-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); }
.btn-primary { background: var(--c-accent); color: var(--c-dark); }
.btn-outline { background: transparent; border: 1px solid var(--fg); color: var(--fg); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* --- 卡片与面板 --- */
.card {
  background: var(--bg);
  border-radius: var(--r-card);
  box-shadow: var(--s-card);
  padding: var(--g-gap);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(21, 21, 35, 0.35); }
.panel {
  background: var(--c-dark);
  border-radius: var(--r-card);
  padding: var(--g-gap);
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
}
.panel .card-light { height: 100%; }

/* --- 表格 --- */
.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(--border-subtle);
}
th { font-weight: 600; }
td:first-child { font-weight: 500; color: var(--hl); }

/* --- FAQ (details/summary) --- */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1em 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-right: 2px solid var(--hl);
  border-bottom: 2px solid var(--hl);
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
details[open] summary::before { transform: rotate(-135deg); }
.faq-answer { margin-top: 0.6em; line-height: 1.7; color: var(--fg); }

/* --- 步骤列表 --- */
.step-list { list-style: none; counter-reset: step; }
.step-list li {
  position: relative;
  padding-left: 3em;
  margin-bottom: 1.2em;
  counter-increment: step;
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 2em; height: 2em;
  background: var(--c-accent);
  color: var(--c-dark);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* --- 头部与底部 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 240, 229, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo-area { display: flex; align-items: center; gap: 0.6em; }
.logo-area img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a { color: var(--c-text); font-weight: 500; }
.nav-links a[aria-current="page"] { color: var(--c-brand); font-weight: 600; }
.site-footer {
  background: var(--c-dark);
  color: var(--c-paper);
  padding: 3em 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2em;
}
.footer-links { display: flex; gap: 1.5em; flex-wrap: wrap; }
.footer-links a { color: var(--c-paper); opacity: 0.8; }
.footer-links a:hover { opacity: 1; }

/* --- SVG 动效规则 --- */
svg { width: 100%; height: auto; }
svg .anim-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
@keyframes drawStroke {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulseOp {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes dashFlow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw { animation: drawStroke 4s ease-in-out infinite alternate; }
.anim-float { animation: floatY 5s ease-in-out infinite; }
.anim-pulse { animation: pulseOp 3s ease-in-out infinite; }
.anim-flow { animation: dashFlow 6s linear infinite; }
.anim-rotate {
  animation: spin 12s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  .anim-draw, .anim-float, .anim-pulse, .anim-flow, .anim-rotate {
    animation: none !important;
  }
}
