/* =========================================
   SafeW 全站共享样式
   设计变量 · 排版 · 组件 · SVG 动效
   ========================================= */

/* 1. 设计 Token 与色板 */
:root {
  /* 颜色 */
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;
  --color-border-light: rgba(25, 21, 35, 0.12);

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* 卡片边界与阴影 */
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  /* 节奏与密度 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0 0 0.6em; font-weight: 600; line-height: 1.25; letter-spacing: 0; }
p { margin: 0 0 1em; }

/* 容器 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }

/* 表面层变量覆盖 */
.surface-dark { background: 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 .icon { stroke: var(--color-accent); }

.surface-paper { background: var(--color-paper); color: var(--color-text); }
.surface-paper .hl { color: var(--color-brand); }
.surface-paper a:not(.btn) { color: var(--color-brand); }
.surface-paper .icon { stroke: var(--color-brand); }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
  padding: 0.2em 0.6em;
  border-radius: 4px;
}
.surface-dark .badge { color: var(--color-accent); }
.surface-paper .badge { color: var(--color-brand); }

/* 高亮关键词 */
.hl { font-weight: 600; }

/* 3. 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background: #5de0c6; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.surface-dark .btn-outline {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.surface-dark .btn-outline:hover { background: rgba(252, 252, 253, 0.08); }

.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 4. 组件：卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}
.surface-dark .card {
  background: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
}
.card:hover { transform: translateY(-2px); }

/* 5. 组件：表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}
th { font-weight: 700; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* 6. 组件：FAQ (details/summary) */
details {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  margin-bottom: 0.8rem;
  background: transparent;
}
.summary-row {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}
.summary-row::-webkit-details-marker { display: none; }
.summary-row::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s;
}
details[open] .summary-row::after { transform: rotate(45deg); }
.detail-content { padding: 0 1rem 1rem; line-height: 1.7; }

/* 7. 组件：编号徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.surface-paper .step-badge { background: var(--color-brand); color: var(--color-paper); }

/* 8. 页头与导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border-light);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo img { height: 32px; width: auto; display: block; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; }
.nav-links a:hover, .nav-links [aria-current="page"] { color: var(--color-brand); }
.surface-dark .nav-links a { color: var(--color-paper); }
.surface-dark .nav-links a:hover, .surface-dark .nav-links [aria-current="page"] { color: var(--color-accent); }

.mobile-toggle { display: none; background: none; border: none; cursor: pointer; }

/* 9. SVG 动效关键帧 */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes breath {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes flowLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.anim-float { animation: float 6s ease-in-out infinite alternate; }
.anim-float-delay { animation: float 7s ease-in-out infinite alternate; animation-delay: -2s; }
.anim-slide { animation: slideIn 5s ease-out forwards; }
.anim-breathe span { animation: breath 3s ease-in-out infinite alternate; }
.anim-flow path { animation: flowLine 8s linear infinite; }

/* 限制旋转/缩放中心 */
svg [class*="anim-"] { 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;
    animation: none !important;
  }
}

/* 10. 响应式适配 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }
  .grid-split { grid-template-columns: 1fr !important; }
  .timeline { padding-left: 1.5rem; }
}
.grid-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
.section-title { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
.h1-hero { font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.15; margin-bottom: 1rem; }
.text-body { max-width: 38em; }
