/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  --color-dark: #21163C;
  --color-paper: #F4F3F7;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  --color-paper-light: #EBE9F0;

  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;

  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;

  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-head: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-body);
  background: var(--color-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 { list-style: none; }

/* --- 容器与排版 --- */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-top: var(--section-y); padding-bottom: var(--section-y); position: relative; }
.section + .section { margin-top: calc(var(--section-y) * -0.5); }

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.02em; line-height: 1.25; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.1; margin-bottom: var(--gap); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 0.8); }
h3 { font-size: 1.25rem; margin-bottom: calc(var(--gap) * 0.5); }
p { margin-bottom: calc(var(--gap) * 0.6); max-width: 38em; }
p strong { font-weight: 600; }

.label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: calc(var(--gap) * 0.4);
  color: var(--color-brand);
}
.surface-dark .label { color: var(--color-accent); }
.card .label { color: var(--color-brand); }

.hl { color: var(--color-brand); font-weight: 600; }
.surface-dark .hl { color: var(--color-accent); }
.card .hl { color: var(--color-brand); }

/* --- 表面上下文覆盖 --- */
.surface-dark { background: var(--color-dark); color: var(--color-paper); }
.surface-dark h1, .surface-dark h2, .surface-dark h3, .surface-dark p, .surface-dark li { color: var(--color-paper); }
.surface-dark a { color: var(--color-paper); }
.surface-dark a:hover, .surface-dark a:focus-visible { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .label { color: var(--color-accent); }

.surface-paper { background: var(--color-paper); color: var(--color-body); }
.surface-paper-light { background: var(--color-paper-light); color: var(--color-body); }

/* 深色面上的浅色卡片恢复纸面取色规则 */
.surface-dark .card {
  background: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.surface-dark .card h3, .surface-dark .card p, .surface-dark .card li { color: var(--color-body); }
.surface-dark .card a { color: var(--color-body); }
.surface-dark .card .hl { color: var(--color-brand); }
.surface-dark .card .label { color: var(--color-brand); }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn svg { width: 20px; height: 20px; }
.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); background: #e0835d; }
.surface-dark .btn-primary { background: var(--color-accent); color: var(--color-dark); }

.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border: 2px solid var(--color-body);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.08); transform: translateY(-2px); }
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.surface-dark .btn-secondary:hover { background: rgba(244, 243, 247, 0.1); }

/* --- 组件：卡片 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }
.card-grid { display: grid; gap: var(--gap); }
.card-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.card-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* --- 组件：表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.12); }
th { font-weight: 600; background: rgba(25, 21, 35, 0.04); }
td:first-child { font-weight: 600; white-space: nowrap; }
.surface-dark th, .surface-dark td { border-color: rgba(244, 243, 247, 0.12); background: transparent; }
.surface-dark th { background: rgba(244, 243, 247, 0.08); }

/* --- 组件：FAQ (<details>) --- */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { border: var(--card-border); border-radius: var(--radius-card); background: var(--color-paper); overflow: hidden; }
.faq-item summary {
  padding: 18px 24px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; }
.faq-item summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 24px 18px 24px; margin: 0; font-size: 0.95rem; line-height: 1.7; }
.surface-dark .faq-item { background: rgba(244, 243, 247, 0.08); border-color: rgba(244, 243, 247, 0.15); }
.surface-dark .faq-item summary { color: var(--color-paper); }
.surface-dark .faq-item p { color: var(--color-paper); }

/* --- 组件：页头与页脚 --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.surface-dark .header { background: rgba(33, 22, 60, 0.92); border-bottom-color: rgba(244, 243, 247, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; position: relative; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.surface-dark .nav-links a:hover, .surface-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }
.footer { background: var(--color-dark); color: var(--color-paper); padding: 64px 0 32px; }
.footer-inner { display: flex; flex-direction: column; gap: 32px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 24px; }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; color: var(--color-accent); letter-spacing: 0.05em; }
.footer-col a { display: block; padding: 6px 0; opacity: 0.85; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.footer-bottom { border-top: 1px solid rgba(244, 243, 247, 0.15); padding-top: 24px; font-size: 0.85rem; opacity: 0.7; text-align: center; }

/* --- SVG 响应式与动效 --- */
.svg-responsive { width: 100%; height: auto; }
.hero-svg-container { position: relative; width: 100%; max-width: 520px; margin: 0 auto; aspect-ratio: 4/3; }

@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes align-pulse { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.04) rotate(3deg); } }
@keyframes float-bubble { 0%, 100% { transform: translateY(0); opacity: 0.7; } 50% { transform: translateY(-10px); opacity: 1; } }
@keyframes draw-stroke { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.anim-spin { animation: spin-slow 24s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-geo { animation: align-pulse 10s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: float-bubble 6s ease-in-out infinite; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-stroke 5s ease-in-out infinite alternate; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-layout { flex-direction: column; gap: 32px; }
  .split-row { flex-direction: column; gap: 32px; }
  .split-row.reverse { flex-direction: column; }
  .card-grid.cols-2, .card-grid.cols-3 { grid-template-columns: 1fr; }
  .steps-row { flex-direction: column; }
  .step-item { text-align: center; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
