/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --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, sans-serif;
  --line-height-body: 1.65;
  --line-height-title: 1.1;
  --letter-spacing-title: -0.02em;

  /* 组件尺寸 */
  --btn-h: 52px;
  --icon-size: 20px;
  --badge-size: 32px;
}

/* 基础重置与全局 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}

/* 表面层变量控制（防止颜色继承错误） */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark a:not(.btn) { color: var(--color-accent); }
.surface-dark .brand-icon { color: var(--color-accent); }
.surface-light-on-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
}
.surface-light-on-dark .hl { color: var(--color-brand); }
.surface-light-on-dark a:not(.btn) { color: var(--color-brand); }
.surface-light-on-dark .brand-icon { color: var(--color-brand); }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(246, 243, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled {
  border-bottom-color: rgba(31, 21, 35, 0.1);
  box-shadow: 0 2px 12px rgba(31, 21, 35, 0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.brand img { height: 32px; width: auto; }
nav ul { display: flex; gap: 24px; }
nav a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}
nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-brand);
  transition: width 0.25s ease;
}
nav a:hover::after, nav[aria-current="page"] a::after { width: 100%; }
nav[aria-current="page"] a { color: var(--color-brand); font-weight: 700; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-h);
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  transform: translateY(-1px);
  background-color: #d95aad;
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--color-text);
}
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { opacity: 0.85; }

/* 眉标 */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--color-brand);
}
.surface-dark .breadcrumb { color: var(--color-accent); }

/* 标题系统 */
h1, h2, h3, h4 {
  font-weight: 800;
  line-height: var(--line-height-title);
  letter-spacing: var(--letter-spacing-title);
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 24px; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 20px; }
h3 { font-size: 1.35rem; margin-bottom: 12px; }
p { max-width: 38em; margin-bottom: 16px; }
.hl { color: var(--color-brand); }
.surface-dark .hl { color: var(--color-accent); }

/* 图文交错布局 */
.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
.split-row.reverse { direction: rtl; }
.split-row.reverse > * { direction: ltr; }
.visual-panel {
  background-color: var(--color-dark);
  padding: 24px;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.visual-panel svg { width: 100%; height: auto; max-height: 100%; }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 16px;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: var(--card-border);
  text-align: left;
}
.data-table th { font-weight: 700; background-color: rgba(31, 21, 35, 0.04); }
.surface-dark .data-table th { background-color: rgba(246, 243, 247, 0.08); }

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.surface-dark .card {
  background-color: rgba(246, 243, 247, 0.06);
  border-color: rgba(246, 243, 247, 0.12);
}
.card time { font-size: 0.85rem; opacity: 0.8; display: block; margin-bottom: 4px; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.faq-item { border: var(--card-border); background-color: var(--color-paper); }
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  font-weight: 700;
  color: var(--color-brand);
  width: 20px;
  text-align: center;
}
.faq-item[open] summary::before { content: "-"; }
.faq-item p { padding: 0 20px 16px; margin: 0; font-size: 0.95rem; }

/* 步骤时间线 */
.timeline { position: relative; padding-left: 32px; margin-top: 24px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background-color: rgba(31, 21, 35, 0.15);
}
.step { position: relative; padding-bottom: 32px; }
.step:last-child { padding-bottom: 0; }
.step-badge {
  position: absolute;
  left: -32px;
  top: 0;
  width: var(--badge-size);
  height: var(--badge-size);
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* 列表标记 */
.marked-list { margin: 16px 0; padding-left: 24px; }
.marked-list li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 10px;
  line-height: 1.7;
}
.marked-list li::marker { color: var(--color-brand); }
.surface-dark .marked-list li::marker { color: var(--color-accent); }

/* SVG 动效基础 */
.svg-anim { width: 100%; height: auto; }
svg [class*="anim-"] { transition: transform 0.3s ease, opacity 0.3s ease; }
svg [class*="anim-"] { transform-box: fill-box; transform-origin: center; }

/* 路径描边动画 */
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-path 4s ease-in-out infinite alternate;
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 几何旋转拼合 */
.anim-rotate-slow { animation: rotate-slow 12s linear infinite; }
@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.anim-rotate-snapped { animation: rotate-snap 8s ease-in-out infinite alternate; }
@keyframes rotate-snap {
  0% { transform: rotate(-15deg); }
  100% { transform: rotate(15deg); }
}

/* 气泡浮升 */
.anim-float { animation: float-up 6s ease-in-out infinite alternate; }
@keyframes float-up {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

/* 呼吸点 */
.anim-breathe { animation: breathe 3s ease-in-out infinite alternate; }
@keyframes breathe {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* 通知滑入 */
.anim-slide-in { animation: slide-in 5s ease-in-out infinite alternate; }
@keyframes slide-in {
  0% { transform: translateX(-12px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 减少动态效果 */
@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;
  }
  html { scroll-behavior: auto; }
}

/* 响应式 */
@media (max-width: 768px) {
  .split-row { grid-template-columns: 1fr; }
  .split-row.reverse { direction: ltr; }
  nav ul { gap: 16px; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .visual-panel { aspect-ratio: 16/9; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
