/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 基础重置 */
*, *::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: 1.65;
  color: var(--text-color);
  background-color: var(--paper-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 设计变量 */
:root {
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  
  --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, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* 主题变量覆盖 */
.theme-dark {
  --bg-color: var(--color-dark);
  --text-color: var(--color-paper);
  --heading-color: var(--color-paper);
  --accent-color: var(--color-accent);
  --brand-color: var(--color-accent);
  --link-color: var(--color-accent);
}
.theme-light {
  --bg-color: var(--color-paper);
  --text-color: var(--color-text);
  --heading-color: var(--color-text);
  --accent-color: var(--color-accent);
  --brand-color: var(--color-brand);
  --link-color: var(--color-brand);
}

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  background-color: var(--bg-color);
  color: var(--text-color);
}
.section + .section { border-top: 1px solid rgba(128,128,128,0.15); }

/* 排版 */
h1, h2, h3, h4 {
  color: var(--heading-color);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1.5rem; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1rem; text-wrap: balance; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
mark, .hl { color: var(--accent-color); font-weight: 700; }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--brand-color);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.theme-dark .badge { color: var(--accent-color); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--accent-color); outline-offset: 2px; }
.btn-primary {
  background-color: var(--accent-color);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(237, 146, 110, 0.35); }
.btn-secondary {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--text-color);
}
.btn-secondary:hover { background-color: rgba(128,128,128,0.08); transform: translateY(-1px); }
.theme-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }

/* 卡片 */
.card {
  background-color: var(--bg-color);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 表格 */
.table-wrapper { overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius-card); }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 700; background-color: rgba(128,128,128,0.08); }
td:first-child { font-weight: 600; white-space: nowrap; }

/* FAQ */
details {
  margin-bottom: 0.75rem;
  border-radius: var(--radius-card);
  border: 1px solid rgba(128,128,128,0.2);
  background-color: var(--bg-color);
  transition: box-shadow 0.2s ease;
}
details[open] { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 1.25rem 1rem; margin: 0; color: var(--text-color); }

/* 时间轴 */
.timeline { position: relative; padding-left: 1.5rem; border-left: 2px solid var(--brand-color); }
.theme-dark .timeline { border-left-color: var(--accent-color); }
.timeline-item { position: relative; padding-bottom: 2rem; }
.timeline-item::before {
  content: ""; position: absolute; left: -1.65rem; top: 0.25rem;
  width: 10px; height: 10px; border-radius: 50%;
  background-color: var(--brand-color);
}
.theme-dark .timeline-item::before { background-color: var(--accent-color); }
.timeline-time { font-size: 0.85rem; font-weight: 700; color: var(--brand-color); margin-bottom: 0.25rem; }
.theme-dark .timeline-time { color: var(--accent-color); }

/* 步骤条 */
.steps-row { display: flex; gap: var(--gap); flex-wrap: wrap; }
.step-card { flex: 1 1 200px; counter-increment: step-counter; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background-color: var(--accent-color); color: var(--color-dark);
  font-weight: 800; font-size: 0.9rem; margin-bottom: 0.5rem;
}

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background-color: rgba(233, 232, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(128,128,128,0.15);
}
.theme-dark.site-header { background-color: rgba(33, 22, 60, 0.85); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand-link { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; }
.brand-img { width: 32px; height: 32px; object-fit: contain; }
.nav-list { display: flex; gap: 1.5rem; list-style: none; }
.nav-link { text-decoration: none; font-weight: 500; color: var(--text-color); opacity: 0.85; transition: opacity 0.2s; }
.nav-link:hover, .nav-link[aria-current="page"] { opacity: 1; color: var(--brand-color); }
.theme-dark .nav-link { color: var(--color-paper); }
.theme-dark .nav-link:hover, .theme-dark .nav-link[aria-current="page"] { color: var(--accent-color); }
.footer { padding: 2rem 0; border-top: 1px solid rgba(128,128,128,0.2); font-size: 0.9rem; text-align: center; }
.footer a { color: var(--link-color); text-decoration: none; margin: 0 0.5rem; }

/* SVG 容器 */
.svg-visual { width: 100%; height: auto; max-width: 100%; display: block; }
.svg-visual svg { width: 100%; height: auto; }

/* =========================================
   SVG 动效 (CSS Keyframes)
   ========================================= */
@keyframes geo-rotate-slow {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}
@keyframes geo-rotate-reverse {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-120deg); }
}
@keyframes float-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes fade-slide-in {
  0%, 100% { opacity: 0.85; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
}
@keyframes draw-path {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes pulse-dots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes scale-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.anim-geo-1 { animation: geo-rotate-slow 12s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-geo-2 { animation: geo-rotate-reverse 16s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: float-subtle 6s ease-in-out infinite; }
.anim-slide { animation: fade-slide-in 8s ease-in-out infinite; }
.anim-draw { animation: draw-path 5s ease-in-out infinite; }
.anim-pulse { animation: pulse-dots 3s ease-in-out infinite; }
.anim-scale { animation: scale-pulse 7s ease-in-out infinite; 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;
    scroll-behavior: auto !important;
  }
  .anim-geo-1, .anim-geo-2, .anim-float, .anim-slide, .anim-draw, .anim-pulse, .anim-scale {
    animation: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .steps-row { flex-direction: column; }
  .header-inner { height: 56px; }
  .nav-list { gap: 1rem; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
