/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计 Token & 色板变量 */
:root {
  --c-dark: #2D1438;
  --c-paper: #F6F3F7;
  --c-text: #1F1523;
  --c-brand: #9E13DD;
  --c-accent: #6EEDA8;
  
  --r-card: 20px;
  --r-btn: 12px;
  --shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --sec-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --max-w: 1280px;
  --lh-body: 1.55;
}

/* 上下文变量覆盖 */
.dark-section {
  --bg: var(--c-dark);
  --fg: var(--c-paper);
  --accent: var(--c-accent);
  --brand: var(--c-accent);
}
.light-section {
  --bg: var(--c-paper);
  --fg: var(--c-text);
  --brand: var(--c-brand);
  --accent: var(--c-accent);
}
.light-card {
  --bg: var(--c-paper);
  --fg: var(--c-text);
  --brand: var(--c-brand);
  --accent: var(--c-accent);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background-color: var(--c-paper);
  color: var(--c-text);
  line-height: var(--lh-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  width: min(100% - 32px, var(--max-w));
  margin-inline: auto;
}
.grid {
  display: grid;
  gap: var(--gap);
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 页面区块通用结构 */
.section {
  padding-block: var(--sec-y);
  background-color: var(--bg);
  color: var(--fg);
}
.section-header {
  margin-bottom: calc(var(--gap) * 2);
  max-width: 38em;
}
.supertitle {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.5rem;
}
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.8rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.6rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--brand); font-weight: 700; }
.dark-section .hl { color: var(--accent); }

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--r-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 2px solid transparent;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--accent);
  color: var(--c-dark);
}
.btn-primary:hover { filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  border-color: currentColor;
  color: var(--fg);
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* 卡片与面板 */
.card {
  background-color: var(--bg);
  border: var(--card-border, 1px solid rgba(128,128,128,0.15));
  border-radius: var(--r-card);
  padding: var(--gap);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 12px 32px -12px rgba(31, 21, 35, 0.4); }

/* 表格 */
.table-wrapper { overflow-x: auto; border-radius: var(--r-card); }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  color: var(--fg);
}
th, td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
th { font-weight: 700; background: rgba(128,128,128,0.08); }
td:first-child { font-weight: 600; }

/* FAQ Details */
details {
  background: var(--bg);
  border: 1px solid rgba(128,128,128,0.2);
  border-radius: var(--r-card);
  margin-bottom: 12px;
  padding: 16px 20px;
  transition: background 0.2s;
}
details[open] { background: rgba(128,128,128,0.05); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 24px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
}
details[open] summary::after { content: "−"; }
details p { margin-top: 12px; margin-bottom: 0; font-size: 0.95rem; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}
.dark-section .site-header { background: rgba(45, 20, 56, 0.9); border-bottom-color: rgba(246, 243, 247, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.logo img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; position: relative; }
.nav-links a:hover { color: var(--brand); }
.dark-section .nav-links a { color: var(--fg); }
.dark-section .nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.dark-section .nav-links a[aria-current="page"] { color: var(--accent); }

.site-footer {
  background: var(--c-dark);
  color: var(--c-paper);
  padding: 48px 0;
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
}
.footer-col h4 { margin-bottom: 16px; color: var(--c-accent); }
.footer-col a { display: block; margin-bottom: 10px; opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; color: var(--c-accent); }

/* SVG 容器与动效 */
.svg-panel {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-card);
  overflow: hidden;
  position: relative;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
svg { width: 100%; height: auto; }
svg circle, svg rect, svg path {
  transform-box: fill-box;
  transform-origin: center;
}

/* 动效关键帧 */
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes dashDraw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.orbit-ring { animation: breathe 7s ease-in-out infinite; }
.orbit-ring-alt { animation: breathe 9s ease-in-out infinite 1.5s; }
.chat-bubble { animation: float 4.5s ease-in-out infinite; }
.msg-slide { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.draw-path { stroke-dasharray: 1; stroke-dashoffset: 0; animation: dashDraw 2.5s ease forwards; }
.pulse-indicator { animation: pulseDot 2s 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;
    animation: none !important;
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .steps-row { flex-direction: column; }
  .step-item { text-align: center; }
}
@media (min-width: 769px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
