/* =========================================================
   SafeW 全站共享样式 · Design Tokens & Base
   ========================================================= */
:root {
  /* 色板 */
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-text: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;

  /* 结构性约束 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(21, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;

  /* 排版与节奏 */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-body: 1.65;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; border-radius: 2px; }

/* 容器与分节 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding: var(--section-y) 0; }
.bg-dark { background: var(--color-dark); color: var(--color-paper); }
.bg-paper { background: var(--color-paper); color: var(--color-text); }
.bg-light { background: #EBE6DB; color: var(--color-text); }

/* 标题系统 */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0.02em; line-height: 1.2; margin: 0 0 1rem; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); text-wrap: balance; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; max-width: 38em; }
strong { font-weight: 700; }

/* 眉标与高亮 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.bg-paper .eyebrow { color: var(--color-brand); }
.bg-dark .eyebrow { color: var(--color-accent); }
.bg-light .eyebrow { color: var(--color-brand); }

.hl { color: var(--color-brand); }
.bg-dark .hl { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); background: #7de063; }
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.btn-secondary:hover { background: rgba(0,0,0,0.05); transform: translateY(-2px); }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.bg-dark .btn-secondary:hover { background: rgba(245,240,229,0.1); }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 3px; }
.bg-dark .btn:focus-visible { outline-color: var(--color-accent); }

/* 网格与棋盘布局 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.checker-layout { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.checker-item { flex: 1 1 45%; min-width: 0; }
.checker-item:nth-child(even) { order: -1; }
@media (max-width: 768px) {
  .checker-item { flex: 1 1 100%; order: unset !important; }
}

/* 卡片与面板 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.bg-dark .card {
  background: #1A1C42;
  border-color: rgba(245, 240, 229, 0.16);
  color: var(--color-paper);
}
.visual-panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bg-light .visual-panel { background: #10112D; }

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--card-border); text-align: left; vertical-align: top; }
th { font-weight: 700; white-space: nowrap; }
td { color: inherit; }
.bg-dark th, .bg-dark td { border-bottom-color: rgba(245,240,229,0.16); }

/* FAQ */
details { margin-bottom: 16px; border: var(--card-border); border-radius: 12px; padding: 16px; background: var(--color-paper); }
.bg-dark details { background: #1A1C42; border-color: rgba(245,240,229,0.16); }
summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-left: 1.5rem; }
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  position: absolute; left: 0; top: 0.6em;
  width: 8px; height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
details[open] summary::before { background: currentColor; }
details > p { margin-top: 12px; margin-bottom: 0; }

/* 徽章与列表 */
.badge-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  border-radius: 8px;
  margin-right: 12px;
  flex-shrink: 0;
}
.step-list { list-style: none; padding: 0; margin: 0; }
.step-list li { display: flex; align-items: flex-start; margin-bottom: 16px; }
.step-list li p { margin: 0; }

/* 页头页脚 */
.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(--card-border);
}
.bg-dark .site-header { background: rgba(16, 17, 45, 0.9); border-bottom-color: rgba(245,240,229,0.16); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-links { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: inherit; font-weight: 500; }
.nav-links a:hover { color: var(--color-brand); }
.bg-dark .nav-links a:hover { color: var(--color-accent); }
.nav-links [aria-current="page"] { font-weight: 700; }
.footer { border-top: 1px solid var(--card-border); padding: 48px 0; margin-top: var(--section-y); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; gap: 24px; }
.footer-links a { color: inherit; opacity: 0.8; }
.footer-links a:hover { opacity: 1; }

/* SVG 动效 Keyframes */
@keyframes drawPath {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0% { transform: translateX(16px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes flowDot {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(32px, -16px); opacity: 0; }
}

/* 动效类绑定 */
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawPath 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.float-1 { animation: floatY 4s ease-in-out infinite; }
.float-2 { animation: floatY 5s ease-in-out infinite 0.8s; }
.float-3 { animation: floatY 4.5s ease-in-out infinite 1.5s; }
.breathe-dot { animation: breathe 2s ease-in-out infinite; }
.slide-notif { animation: slideIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s both; }
.flow-point { animation: flowDot 3s linear infinite; }

/* 子元素旋转/缩放基准 */
svg .anim-group { transform-box: fill-box; transform-origin: center; }

/* 减少动态效果 */
@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;
  }
}

/* 响应式微调 */
@media (max-width: 640px) {
  .header-inner { height: 56px; }
  .nav-links { display: none; } /* 移动端简化：实际项目可加汉堡菜单，此处为保证静态纯净 */
  h1 { font-size: clamp(1.8rem, 6vw, 2.5rem); }
  .btn { width: 100%; justify-content: center; }
}

/* 兜底：裁掉横向溢出 */
div.container,
li {
  overflow-x: clip;
}
