/* ============================================================
   SafeW 全站共享样式
   设计变量 · 基础排版 · 布局 · 组件 · SVG 动效 · 响应式
   ============================================================ */

/* ---------- 设计 Token ---------- */
:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #D6D4ED;
  --color-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 结构尺寸 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 字体与行距 */
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-body: 1.55;
  --lh-tight: 1.2;
}

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-body);
  background: var(--color-paper);
  color: var(--color-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ---------- 容器与节奏 ---------- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}

/* ---------- 面色管理（严格遵循取色规则） ---------- */
.surface-paper {
  background: var(--color-paper);
  color: var(--color-body);
}
.surface-paper .eyebrow { color: var(--color-brand); }
.surface-paper .hl { color: var(--color-brand); }
.surface-paper .icon-svg { stroke: var(--color-brand); }
.surface-paper .accent-dot { background: var(--color-brand); }

.surface-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .eyebrow { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .icon-svg { stroke: var(--color-accent); }
.surface-dark .accent-dot { background: var(--color-accent); }

/* 深色面内的浅色卡片恢复纸面取色 */
.card-light {
  background: var(--color-paper);
  color: var(--color-body);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
.card-light .eyebrow { color: var(--color-brand); }
.card-light .hl { color: var(--color-brand); }
.card-light .icon-svg { stroke: var(--color-brand); }

/* ---------- 排版 ---------- */
.h1-hero {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--gap);
}
.h2-section {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: var(--gap);
}
.h3-sub {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5em;
}
.text-body {
  font-size: 1rem;
  line-height: var(--lh-body);
  max-width: 38em;
}
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
}
.hl {
  font-weight: 700;
}

/* ---------- 组件：按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  border: none;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(137, 237, 110, 0.35);
}
.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border: 1.5px solid currentColor;
}
.surface-dark .btn-secondary {
  color: var(--color-paper);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}
.surface-dark .btn-secondary:hover {
  background: rgba(255,255,255,0.12);
}

/* ---------- 组件：图标 SVG ---------- */
.icon-svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 组件：卡片 ---------- */
.card {
  background: var(--color-paper);
  color: var(--color-body);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border: var(--card-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px -12px rgba(23, 21, 35, 0.35);
}
.surface-dark .card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: none;
}
.surface-dark .card:hover {
  background: rgba(255,255,255,0.09);
}

/* ---------- 组件：表格 ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-paper);
  color: var(--color-body);
}
.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(23, 21, 35, 0.1);
}
.data-table th {
  font-weight: 700;
  background: rgba(23, 21, 35, 0.04);
}
.surface-dark .table-wrap { box-shadow: none; }
.surface-dark .data-table {
  background: rgba(255,255,255,0.05);
  color: var(--color-paper);
}
.surface-dark .data-table th,
.surface-dark .data-table td {
  border-bottom-color: rgba(255,255,255,0.1);
}
.surface-dark .data-table th {
  background: rgba(255,255,255,0.08);
}

/* ---------- 组件：FAQ / Details ---------- */
.faq-item {
  border-bottom: 1px solid rgba(23, 21, 35, 0.12);
  padding: 16px 0;
}
.surface-dark .faq-item {
  border-bottom-color: rgba(255,255,255,0.12);
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  margin-top: 8px;
  color: inherit;
  opacity: 0.9;
}

/* ---------- 布局网格 ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}
.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}
.step-list {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}
.step-item {
  counter-increment: step;
  position: relative;
  padding-left: 48px;
}
.step-item::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 32px; height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.surface-dark .step-item::before {
  background: var(--color-accent);
}

/* ---------- SVG 动效基础 ---------- */
.svg-anim {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.svg-orbit {
  transform-box: fill-box;
  transform-origin: center;
}
.svg-path-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* ---------- 关键帧 ---------- */
@keyframes orbit-breathe {
  0%, 100% { transform: scale(0.96); opacity: 0.6; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes orbit-breathe-alt {
  0%, 100% { transform: scale(1.02); opacity: 0.8; }
  50% { transform: scale(0.94); opacity: 0.5; }
}
@keyframes float-gentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ---------- 动效类绑定 ---------- */
.anim-orbit-1 { animation: orbit-breathe 6s ease-in-out infinite alternate; }
.anim-orbit-2 { animation: orbit-breathe-alt 8s ease-in-out infinite alternate; }
.anim-float  { animation: float-gentle 5s ease-in-out infinite alternate; }
.anim-draw   { animation: dash-flow 4s ease-in-out infinite; }
.anim-pulse  { animation: pulse-dot 3s ease-in-out infinite alternate; }

/* ---------- 页头页脚 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(214, 212, 237, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}
.surface-dark .site-header {
  background: rgba(19, 16, 45, 0.9);
  border-bottom-color: rgba(255,255,255,0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-links {
  display: flex;
  gap: 24px;
  font-weight: 500;
}
.nav-links a {
  position: relative;
  padding: 4px 0;
}
.nav-links a[aria-current="page"] {
  font-weight: 700;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}
.site-footer {
  padding-block: 48px;
  border-top: 1px solid rgba(23, 21, 35, 0.1);
  font-size: 0.9rem;
  opacity: 0.85;
}
.surface-dark .site-footer {
  border-top-color: rgba(255,255,255,0.1);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}
.footer-col h4 {
  font-weight: 700;
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  padding: 4px 0;
  transition: opacity 0.2s;
}
.footer-col a:hover { opacity: 0.7; }

/* ---------- 场景标签 ---------- */
.tag-label {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(39, 20, 235, 0.1);
  color: var(--color-brand);
  margin-bottom: 8px;
}
.surface-dark .tag-label {
  background: rgba(137, 237, 110, 0.15);
  color: var(--color-accent);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 0; }
  .nav-links { gap: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .step-list { grid-template-columns: 1fr; }
  .h1-hero { font-size: clamp(1.8rem, 6vw, 2.6rem); }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .svg-orbit { transform: none !important; }
  .svg-path-draw { stroke-dashoffset: 0 !important; }
}
