/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* 1. 基础变量与重置 */
:root {
  /* 色板 */
  --c-dark: #140E25;
  --c-paper: #FCFCFD;
  --c-body: #191523;
  --c-brand: #5214EB;
  --c-accent: #6EEDD2;

  /* 结构 token */
  --r-card: 8px;
  --r-btn: 6px;
  --border-card: 2px solid var(--c-body);
  --shadow-card: 4px 4px 0 var(--c-body);
  --sec-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --max-w: 960px;
  --header-h: 72px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-main);
  line-height: 1.75;
  color: var(--c-body);
  background-color: var(--c-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 { padding: 0; margin: 0; list-style: none; }
button, input { font: inherit; color: inherit; }

/* 2. 容器与网格 */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.grid-2 {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-3 {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 修复横向溢出：限制表格宽度并允许内部滚动 */
table { width: 100%; border-collapse: collapse; margin: 24px 0; overflow-x: auto; display: block; }

/* 3. 表面取色系统 */
.surface-paper { background: var(--c-paper); color: var(--c-body); }
.surface-dark {
  background: var(--c-dark);
  color: var(--c-paper);
}

/* 标题与正文在表面的映射 */
.surface-paper h1, .surface-paper h2, .surface-paper h3, .surface-paper p, .surface-paper li { color: var(--c-body); }
.surface-paper .hl { color: var(--c-brand); }
.surface-dark h1, .surface-dark h2, .surface-dark h3, .surface-dark p, .surface-dark li { color: var(--c-paper); }
.surface-dark .hl { color: var(--c-accent); }

/* 卡片回退到纸面取色（当放在深色面上时） */
.card-light {
  background: var(--c-paper);
  color: var(--c-body);
  border: var(--border-card);
  box-shadow: var(--shadow-card);
  border-radius: var(--r-card);
}
.card-light h1, .card-light h2, .card-light h3, .card-light p, .card-light li { color: var(--c-body); }
.card-light .hl { color: var(--c-brand); }

/* 4. 排版组件 */
.section { padding-block: var(--sec-y); }
.section-header { margin-bottom: calc(var(--gap) * 1.5); }
.milestone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.surface-paper .milestone { color: var(--c-brand); }
.surface-dark .milestone { color: var(--c-accent); }

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 24px 0 12px;
}
p { margin: 0 0 16px; max-width: 38em; }
.hl { font-weight: 800; }

/* 5. 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--r-btn);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  border: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--c-accent);
  color: var(--c-dark);
}
.btn-secondary {
  background: transparent;
  color: var(--c-body);
  border: 2px solid var(--c-body);
}
.surface-dark .btn-secondary {
  color: var(--c-paper);
  border-color: var(--c-paper);
}

/* 图标尺寸 */
.icon { width: 20px; height: 20px; stroke-width: 1.8; flex-shrink: 0; }

/* 6. 列表与表格 */
.check-list { margin: 16px 0; padding-left: 20px; }
.check-list li { position: relative; padding-left: 24px; margin-bottom: 12px; }
.check-list li::before {
  content: "";
  position: absolute; left: 0; top: 6px;
  width: 8px; height: 8px;
  background: var(--c-brand);
  border-radius: 2px;
}
table { width: 100%; border-collapse: collapse; margin: 24px 0; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(25,21,35,0.1); }
th { font-weight: 700; }
td:first-child { font-weight: 600; }

/* 7. FAQ / Details */
.faq-item { border: var(--border-card); border-radius: var(--r-card); margin-bottom: 16px; background: var(--c-paper); color: var(--c-body); }
.summary-custom {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.summary-custom::-webkit-details-marker { display: none; }
.summary-custom::after { content: "+"; font-size: 1.5rem; font-weight: 300; transition: transform 0.2s; }
details[open] .summary-custom::after { transform: rotate(45deg); }
.details-content { padding: 0 20px 20px; line-height: 1.7; }

/* 8. 步骤时间线 */
.timeline { position: relative; padding-left: 32px; border-left: 2px solid var(--c-body); margin: 32px 0; }
.surface-dark .timeline { border-left-color: var(--c-paper); }
.step-item { position: relative; margin-bottom: 32px; }
.step-item::before {
  content: attr(data-step);
  position: absolute; left: -48px; top: 0;
  width: 32px; height: 32px;
  background: var(--c-accent);
  color: var(--c-dark);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}

/* 9. 视觉面板与 SVG */
.visual-panel {
  background: var(--c-dark);
  border-radius: 16px;
  padding: 24px;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.svg-responsive { width: 100%; height: auto; display: block; }

/* 10. SVG 动效 Keyframes & 类名 */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes slideIn { 0%, 100% { transform: translateX(0); opacity: 1; } 90%, 100% { opacity: 1; } }
@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes syncRotate { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(180deg); } }

.anim-float { animation: float 6s ease-in-out infinite; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-slide { animation: slideIn 5s ease-in-out infinite; }
.anim-draw { animation: drawLine 4s ease forwards; }
.anim-sync { animation: syncRotate 12s linear infinite; transform-box: fill-box; transform-origin: center; }

/* 描边路径默认状态 */
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-draw .draw-path { animation: drawLine 3s ease forwards; }

/* 11. 响应式与无障碍 */
@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;
  }
  .anim-float, .anim-breathe, .anim-slide, .anim-draw, .anim-sync { animation: none !important; }
}

/* 吸顶导航阴影 */
.header-scrolled { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
