/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 颜色系统 */
  --color-dark: #17203F;
  --color-paper: #FCFCFD;
  --color-text: #151823;
  --color-brand: #1441EB;
  --color-accent: #6EEDBD;
  
  /* 语义化变量（默认纸面模式） */
  --bg-main: var(--color-paper);
  --bg-card: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text);
  --text-muted: rgba(21, 24, 35, 0.6);
  --accent: var(--color-brand);
  --highlight: var(--color-brand);
  --border-subtle: rgba(21, 24, 35, 0.1);
  
  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21, 24, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-h-body: 1.75;
}

/* 深色面覆盖 */
.theme-dark {
  --bg-main: var(--color-dark);
  --bg-card: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: var(--color-paper);
  --text-muted: rgba(252, 252, 253, 0.7);
  --accent: var(--color-accent);
  --highlight: var(--color-accent);
  --border-subtle: rgba(252, 252, 253, 0.15);
}

/* 浅色卡片覆盖（置于深色面内时使用） */
.theme-card {
  --bg-card: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text);
  --text-muted: rgba(21, 24, 35, 0.6);
  --accent: var(--color-brand);
  --highlight: var(--color-brand);
  --border-subtle: rgba(21, 24, 35, 0.1);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: var(--line-h-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器与分节 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}
section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0;
}

/* 标题系统 */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.hl {
  color: var(--highlight);
}

/* 正文与段落 */
p {
  margin-bottom: 1rem;
  max-width: 38em;
}
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.875rem; }

/* --- 布局辅助 --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}
.flex-col { flex-direction: column; }
@media (min-width: 768px) {
  .grid-2.reverse { direction: rtl; }
  .grid-2.reverse > * { direction: ltr; }
}
.content-narrow { max-width: 640px; }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: none;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--color-dark);
}
.btn-primary:hover { background: #5de0ad; }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
}
.btn-secondary:hover { background: rgba(21,24,35,0.05); }
.theme-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.theme-dark .btn-secondary:hover { background: rgba(252,252,253,0.1); }

/* --- 组件：卡片 --- */
.card {
  background: var(--bg-card);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(21, 24, 35, 0.4); }

/* --- 组件：表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
th { font-weight: 600; color: var(--text-secondary); }
td { color: var(--text-primary); }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* --- 组件：FAQ --- */
details {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
  transition: background 0.2s ease;
}
details[open] { background: rgba(21,24,35,0.02); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
details p { margin-top: 0.75rem; margin-bottom: 0; }

/* --- 组件：步骤编号 --- */
.step-list { counter-reset: step; }
.step-item {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
}
.step-item::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 组件：流程条 --- */
.flow-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
}
.flow-node {
  flex: 1 1 140px;
  text-align: center;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.flow-arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: var(--accent);
}

/* --- SVG 通用 --- */
.svg-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}
.svg-illustration {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* --- SVG 动效 Keyframes --- */
@keyframes orbitBreathe {
  0%, 100% { transform: scale(1); opacity: 0.15; }
  50% { transform: scale(1.06); opacity: 0.25; }
}
@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.02); }
}
@keyframes slideUpFade {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(4px); opacity: 0.85; }
}
@keyframes drawLoop {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 动效类绑定 */
.anim-orbit { animation: orbitBreathe 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: floatSoft 5s ease-in-out infinite; }
.anim-bubble { animation: bubbleFloat 4.5s ease-in-out infinite; }
.anim-slide-up { animation: slideUpFade 4s ease-in-out infinite; }
.anim-draw { animation: drawLoop 5s ease-in-out infinite; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-pulse { animation: pulseDot 2s 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;
  }
  .anim-orbit, .anim-float, .anim-bubble, .anim-slide-up, .anim-draw, .anim-pulse {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.theme-dark .site-header { background: rgba(23, 32, 63, 0.9); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 28px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--accent); }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--section-y);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--accent); }
.copyright { font-size: 0.85rem; color: var(--text-muted); margin-top: 1.5rem; }

/* --- 响应式微调 --- */
@media (max-width: 767px) {
  .nav-links { display: none; } /* 移动端简化导航，实际项目可加汉堡菜单，此处保持纯静态简洁 */
  .flow-container { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
}
