/* =========================================
   SafeW 全局样式表 (style.css)
   ========================================= */

/* 1. 设计变量 (Design Tokens) */
:root {
  /* 色板 */
  --color-dark-bg: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 默认取色（纸面模式） */
  --bg-surface: var(--color-paper);
  --text-main: var(--color-text);
  --text-muted: #3E3650;
  --accent: var(--color-brand);
  --border-color: rgba(25, 21, 35, 0.12);
  --card-bg: rgba(255, 255, 255, 0.6);

  /* 几何与布局 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --content-max: 960px;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  
  /* 排版 */
  --font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-body: 1.75;
}

/* 深色面取色覆盖 */
.dark-surface {
  --bg-surface: var(--color-dark-bg);
  --text-main: var(--color-paper);
  --text-muted: rgba(219, 212, 237, 0.7);
  --accent: var(--color-accent);
  --border-color: rgba(219, 212, 237, 0.15);
  --card-bg: rgba(219, 212, 237, 0.08);
}

/* 浅色卡片在深色面上恢复纸面取色 */
.light-card-in-dark {
  --bg-surface: var(--color-paper);
  --text-main: var(--color-text);
  --text-muted: #3E3650;
  --accent: var(--color-brand);
  --border-color: rgba(25, 21, 35, 0.12);
  --card-bg: transparent;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-family);
  background-color: var(--bg-surface);
  color: var(--text-main);
  line-height: var(--line-height-body);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

img, svg { display: block; max-width: 100%; height: auto; }

/* 3. 通用组件 */
.section-divider {
  width: 100%;
  height: 1px;
  background-color: var(--border-color);
  border: none;
}

/* 眉标 */
.kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* 深色背景下的眉标与强调色需要更深的颜色以保证对比度 */
.dark-surface .kicker,
.dark-surface .highlight {
  color: #4A12CC;
}

/* 标题 */
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-main);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.35rem; margin-bottom: 1rem; }

.highlight { color: var(--accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 24px;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(153, 119, 238, 0.3);
  opacity: 1;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--text-main);
}
.btn-secondary:hover {
  background-color: var(--border-color);
  opacity: 1;
}

/* 卡片 */
.card {
  background-color: var(--card-bg);
  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); }

/* 网格 */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* 表格 */
.table-responsive { overflow-x: auto; border-radius: var(--radius-card); border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; min-width: 400px; }
th, td { padding: 16px 24px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { font-weight: 700; color: var(--text-main); background-color: var(--card-bg); }
td { color: var(--text-main); }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}
.faq-item summary {
  list-style: none;
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  position: relative;
  padding-right: 40px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--accent);
  line-height: 1;
}
.faq-item[open] summary::after { content: "-"; }
.faq-item p { padding-bottom: 20px; color: var(--text-muted); line-height: 1.7; }

/* 提示框 */
.callout {
  border-left: 4px solid var(--accent);
  background-color: var(--card-bg);
  padding: 24px;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  margin: var(--gap) 0;
}

/* 4. 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand a { display: flex; align-items: center; gap: 10px; color: var(--text-main); font-weight: 700; font-size: 1.2rem; }
.brand img { height: 32px; width: auto; }
.nav-list { display: flex; gap: 32px; list-style: none; }
.nav-link { color: var(--text-main); font-weight: 500; font-size: 0.95rem; }
.nav-link[aria-current="page"] { color: var(--accent); font-weight: 700; }

.footer {
  padding: 64px 0 32px;
  border-top: 1px solid var(--border-color);
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--gap);
  margin-bottom: 48px;
}
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 16px; color: var(--text-main); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.copyright { text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* 5. SVG 动效方向：几何体旋转拼合 / 界面元素呼吸 */
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawStroke 4s ease-in-out infinite alternate; }
.anim-bubble { animation: bubblePop 4s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite alternate; }
.anim-input-dot { animation: inputDot 2s infinite; }
.anim-line-flow { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: flowLine 3s linear infinite; }
.anim-spin-slow { animation: spinSlow 20s linear infinite; transform-box: fill-box; transform-origin: center; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes drawStroke {
  0% { stroke-dashoffset: 1; opacity: 0.6; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes bubblePop {
  0% { transform: scale(0.95) translateY(2px); opacity: 0.7; }
  100% { transform: scale(1.05) translateY(-4px); opacity: 1; }
}
@keyframes inputDot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes flowLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes spinSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 6. 响应式适配 */
@media (max-width: 768px) {
  .nav-list { display: none; } /* 简化移动端，实际项目可加汉堡菜单 */
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .grid-3 { grid-template-columns: 1fr; }
  .steps-row { flex-direction: column; }
  .step-item { text-align: left !important; }
}

@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;
  }
}
