/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计 Token 与色板 */
:root {
  --color-bg: #FCFCFD;
  --color-surface-dark: #141838;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}
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; }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding: var(--section-y) 0;
}

/* 标题系统 */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: var(--gap);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; }
h3 { font-size: 1.25rem; }
p { max-width: 38em; margin-bottom: var(--gap); }
.text-secondary { color: #4a5568; }

/* 眉标与高亮 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.badge::before { content: "— "; }
.hl { color: var(--color-brand); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .badge { color: var(--color-accent); }

/* 表面层取色覆盖 */
.surface-dark {
  background: var(--color-surface-dark);
  color: var(--color-bg);
}
.surface-dark a { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .badge { color: var(--color-accent); }
.surface-dark .text-secondary { color: rgba(252, 252, 253, 0.8); }

.surface-card-light {
  background: var(--color-bg);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.surface-card-light a { color: var(--color-brand); }
.surface-card-light .hl { color: var(--color-brand); }
.surface-card-light .badge { color: var(--color-brand); }

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.15s, background-color 0.2s, border-color 0.2s;
  text-align: center;
  text-decoration: none;
  line-height: 1;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-surface-dark);
  border: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}
.surface-dark .btn-secondary {
  color: var(--color-bg);
  border-color: var(--color-bg);
}
.btn-secondary:hover {
  transform: translateY(-1px);
  background: rgba(0,0,0,0.03);
}
.surface-dark .btn-secondary:hover {
  background: rgba(255,255,255,0.05);
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* 卡片与面板 */
.card-panel {
  background: var(--color-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.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); }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--gap) 0;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
.data-table th { font-weight: 700; width: 40%; }
.data-table tr:last-child td { border-bottom: none; }

/* 详情列表 (FAQ) */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--color-bg);
}
summary {
  padding: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--color-brand);
}
details[open] summary::after { content: "−"; }
.details-content { padding: 0 1rem 1rem; line-height: 1.6; }

/* 步骤条 */
.step-list { counter-reset: step; list-style: none; padding: 0; }
.step-list li {
  position: relative;
  padding-left: 3rem;
  margin-bottom: var(--gap);
}
.step-list li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--color-accent);
  color: var(--color-surface-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 场景块 */
.scene-block { margin-bottom: var(--gap); }
.scene-tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(20, 44, 235, 0.1);
  color: var(--color-brand);
  margin-bottom: 0.5rem;
}
.surface-dark .scene-tag { background: rgba(110, 175, 237, 0.15); color: var(--color-accent); }

/* 导航页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
}
.surface-dark .site-header { background: rgba(20, 24, 56, 0.9); border-color: rgba(255,255,255,0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.surface-dark .nav-links a { color: #151723; }
.surface-dark .nav-links a[aria-current="page"] { color: #142CEB; }

/* 页脚 */
.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid #e2e8f0;
  margin-top: var(--section-y);
  font-size: 0.9rem;
  color: #4a5568;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.footer-col h4 { margin-bottom: 0.75rem; font-size: 1rem; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.5rem; }

/* =========================================
   SVG 动效规范
   ========================================= */
.hero-svg, .feature-svg, .status-svg {
  width: 100%;
  height: auto;
}
.anim-float-1 { animation: floatCard 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-2 { animation: floatCard 7s ease-in-out infinite 1s; transform-box: fill-box; transform-origin: center; }
.anim-float-3 { animation: floatCard 5s ease-in-out infinite 2s; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: breathe 3s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 4s ease-in-out infinite alternate; }

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes breathe {
  0% { opacity: 0.6; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.02); }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50%, 100% { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-float-1, .anim-float-2, .anim-float-3, .anim-pulse, .anim-draw {
    animation: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-links { gap: 1rem; }
  .btn { width: 100%; justify-content: center; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
