/* =========================================
   SafeW 全站共享样式 & 设计 Token
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #17203F;
  --color-paper: #FCFCFD;
  --color-text: #151823;
  --color-brand: #1441EB;
  --color-accent: #6EEDBD;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(21, 24, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.65;
  font-size: 16px;
}

/* 面色主题控制 */
.paper-bg { background: var(--color-paper); color: var(--color-text); }
.dark-bg { background: var(--color-dark); color: var(--color-paper); }
.dark-bg .hl, .dark-bg .overline, .dark-bg a:not(.btn) { color: var(--color-accent); }
.paper-bg .hl, .paper-bg .overline, .paper-bg a:not(.btn) { color: var(--color-brand); }

/* 容器与间距 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.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); }

/* 排版 */
.overline {
  display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.5rem;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.25; margin-bottom: var(--gap); text-wrap: balance; }
h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; max-width: 38em; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; max-width: 38em; }

/* 强调词 */
.hl { font-weight: 800; }

/* 组件：卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.dark-bg .card {
  background: #1f2a4d;
  border-color: rgba(252, 252, 253, 0.1);
  color: var(--color-paper);
}
.dark-bg .card p, .dark-bg .card li { color: var(--color-paper); }

/* 组件：按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; height: 48px; border-radius: var(--radius-btn);
  font-weight: 600; text-decoration: none; transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  cursor: pointer; border: none;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary { background: transparent; border: 1px solid currentColor; color: inherit; }
.btn-secondary:hover { background: rgba(128, 128, 128, 0.1); }
.focus-visible:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* 组件：表格 */
table { width: 100%; min-width: 0; border-collapse: collapse; margin: 1rem 0; }
th, td { padding: 0.75rem; border-bottom: 1px solid currentColor; text-align: left; vertical-align: top; word-break: break-word; overflow-wrap: anywhere; }
th { font-weight: 600; opacity: 1; }
td { opacity: 0.85; }
.dark-bg th, .dark-bg td { border-bottom-color: rgba(252,252,253,0.15); }

/* 组件：FAQ */
details { margin-bottom: 0.75rem; border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
summary {
  padding: 0.75rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
details[open] summary { border-bottom: 1px solid currentColor; opacity: 0.7; }
details p { padding: 0.75rem; margin-bottom: 0; }

/* 组件：步骤徽标 */
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; background: var(--color-accent); color: var(--color-dark);
  font-weight: 800; font-size: 0.9rem; margin-right: 0.75rem; flex-shrink: 0;
}

/* 页头 */
header { position: sticky; top: 0; z-index: 100; backdrop-filter: blur(8px); background: rgba(252,252,253,0.92); border-bottom: 1px solid rgba(21,24,35,0.08); }
.dark-bg header { background: rgba(23,32,63,0.92); border-bottom: 1px solid rgba(252,252,253,0.08); }
.nav-container { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; font-weight: 700; }
.brand img { height: 32px; width: auto; }
nav { display: flex; align-items: center; gap: 1.5rem; }
nav a { text-decoration: none; color: inherit; font-weight: 500; transition: color 0.2s; }
nav a:hover { opacity: 0.8; }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.dark-bg nav a[aria-current="page"] { color: var(--color-accent); }
@media (max-width: 768px) { nav { display: none; } }

/* 页脚 */
footer { padding: 3rem 0; border-top: 1px solid currentColor; opacity: 0.85; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.footer-grid a { color: inherit; text-decoration: none; margin-bottom: 0.5rem; display: block; }
.footer-grid a:hover { opacity: 0.7; }
.footer-bottom { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid currentColor; opacity: 0.6; font-size: 0.85rem; }

/* =========================================
   SVG 动效 Keyframes & 类名
   ========================================= */
@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateX(16px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes orbitPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.04); opacity: 0.7; }
}

.svg-draw {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: drawLine 3s ease-in-out forwards;
}
.svg-float { animation: float 4s ease-in-out infinite; }
.svg-breathe { animation: breathe 3s ease-in-out infinite; }
.svg-slide { animation: slideIn 0.8s ease forwards; }
.svg-orbit { animation: orbitPulse 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

svg { width: 100%; height: auto; max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .svg-draw, .svg-float, .svg-breathe, .svg-slide, .svg-orbit {
    animation: none !important;
  }
}
