/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --bg-dark: #271231;
  --bg-paper: #F5F0E5;
  --text-body: #1F1523;
  --brand: #9B12D8;
  --accent: #ED6EC0;

  /* 表面取色映射 */
  --surface-bg: var(--bg-paper);
  --surface-fg: var(--text-body);
  --surface-brand: var(--brand);
  --surface-accent: var(--accent);

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 表面覆盖类 */
.surface-dark {
  --surface-bg: var(--bg-dark);
  --surface-fg: var(--bg-paper);
  --surface-brand: var(--accent);
  --surface-accent: var(--accent);
}

.surface-paper {
  --surface-bg: var(--bg-paper);
  --surface-fg: var(--text-body);
  --surface-brand: var(--brand);
  --surface-accent: var(--accent);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--surface-bg);
  color: var(--surface-fg);
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 区块节奏 */
.section {
  padding: var(--section-y) 0;
}
.section + .section { border-top: 1px solid rgba(128,128,128,0.15); }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  color: var(--surface-brand);
}

/* 标题 */
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--surface-fg);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.6em; }
h3 { font-size: 1.25rem; margin-bottom: 0.4em; }
.hl { color: var(--surface-brand); }
.surface-dark .hl { color: var(--surface-accent); }

/* 正文约束 */
.prose {
  max-width: 38em;
  margin-bottom: 1.5em;
  font-size: clamp(1rem, 1.1vw, 1.125rem);
}

/* --- 页头与导航 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-bg);
  border-bottom: 1px solid rgba(128,128,128,0.12);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 800;
  font-size: 1.1rem;
}
.logo img { width: 28px; height: 28px; object-fit: contain; }
nav ul { display: flex; gap: var(--gap); }
nav a { font-weight: 500; font-size: 0.95rem; padding: 0.4em 0; position: relative; }
nav a:hover, nav a[aria-current="page"] { color: var(--surface-brand); }
nav a[aria-current="page"]::after {
  content: ""; position: absolute; bottom: -4px; left: 0; right: 0; height: 2px; background: currentColor;
}
.nav-cta { margin-left: 0.5em; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 48px;
  padding: 0 1.4em;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.btn:focus-visible { outline: 3px solid var(--surface-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--surface-accent);
  color: var(--bg-dark);
}
.btn-primary:hover { transform: translateY(-2px); background: #d65aad; }
.btn-secondary {
  background: transparent;
  border-color: var(--surface-fg);
  color: var(--surface-fg);
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); transform: translateY(-2px); }

/* --- 卡片与面板 --- */
.card {
  background: var(--surface-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.4); }
.panel {
  background: var(--surface-bg);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}

/* --- 表格 --- */
.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 rgba(128,128,128,0.2); }
th { font-weight: 700; background: rgba(128,128,128,0.05); }
td:first-child { font-weight: 600; min-width: 140px; }

/* --- 列表与步骤 --- */
.step-list { counter-reset: step; }
.step-list li {
  position: relative;
  padding-left: 2.8em;
  margin-bottom: 1em;
}
.step-list li::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute; left: 0; top: 0;
  width: 2em; height: 2em;
  background: var(--surface-accent);
  color: var(--bg-dark);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}

/* --- FAQ (details/summary) --- */
details {
  border-bottom: 1px solid rgba(128,128,128,0.2);
  padding: 1em 0;
}
summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; font-size: 1.2em; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 0.6em; color: var(--surface-fg); opacity: 0.9; }

/* --- 响应式网格 --- */
.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-col { display: flex; flex-direction: column; gap: var(--gap); }

/* --- SVG 动效基座 --- */
.svg-visual { width: 100%; height: auto; }
.svg-visual path, .svg-visual circle, .svg-visual rect {
  fill: none;
  stroke: var(--surface-fg);
  stroke-width: 1.5;
  transition: stroke 0.3s;
}
.surface-dark .svg-visual path,
.surface-dark .svg-visual circle,
.surface-dark .svg-visual rect { stroke: var(--surface-fg); }

/* 描边绘制 */
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.anim-draw { animation: drawLine 2.5s ease forwards; }

/* 呼吸与浮动 */
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.anim-breathe-1 { animation: breathe 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-breathe-2 { animation: breathe 8s ease-in-out infinite 1s; transform-box: fill-box; transform-origin: center; }
.anim-breathe-3 { animation: breathe 10s ease-in-out infinite 2s; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: float 4s ease-in-out infinite; }
.anim-slide { animation: slideIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

/* 减少动态效果 */
@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;
  }
}

/* 窄屏适配 */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.8em 0; }
  nav ul { flex-wrap: wrap; gap: 0.6em; margin-top: 0.5em; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}
