/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与 Token --- */
:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #D6D4ED;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;
  --color-border: rgba(23, 21, 35, 0.12);
  
  /* 取色上下文 */
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --hl: var(--color-brand);
  --link: var(--color-brand);
  --shadow-color: rgba(23, 21, 35, 0.3);

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px var(--shadow-color);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  --header-h: 64px;

  /* 排版 Token */
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --title-weight: 800;
  --title-ls: -0.02em;
  --title-lh: 1.1;
  --body-lh: 1.55;
  --body-size: 16px;
}

/* 深色面覆盖 */
.bg-dark {
  --bg: var(--color-dark);
  --fg: var(--color-paper);
  --hl: var(--color-accent);
  --link: var(--color-accent);
  --shadow-color: rgba(214, 212, 237, 0.15);
}

/* 深色面内的浅色卡片恢复纸面取色 */
.bg-dark .card, .bg-dark .feature-panel, .bg-dark .timeline-step {
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --hl: var(--color-brand);
  --link: var(--color-brand);
  --shadow-color: rgba(23, 21, 35, 0.3);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  color: var(--fg);
  background-color: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}

/* 标题系统 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--hl);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.badge::before {
  content: "";
  display: block;
  width: 12px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
h1, h2, h3 {
  font-weight: var(--title-weight);
  letter-spacing: var(--title-ls);
  line-height: var(--title-lh);
  color: var(--fg);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.hl { color: var(--hl); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px -4px rgba(137, 237, 110, 0.4); }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--fg);
}
.btn-secondary:hover { background: color-mix(in srgb, var(--fg) 10%, transparent); }

/* 卡片与面板 */
.card {
  background: var(--bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px var(--shadow-color); }
.feature-panel {
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 24px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--bg); }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--hl); width: 35%; }
tr:last-child td { border-bottom: none; }

/* FAQ Details */
details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: var(--gap);
  overflow: hidden;
}
summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  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[open] summary { border-bottom: 1px solid var(--border); }
.details-content { padding: 16px 20px; color: var(--fg); line-height: 1.6; }

/* 时间线 */
.timeline { position: relative; padding-left: 32px; border-left: 2px solid var(--border); }
.timeline-step { position: relative; margin-bottom: 2rem; }
.timeline-step::before {
  content: attr(data-num);
  position: absolute;
  left: -44px;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* 新闻卡片网格 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--gap);
}
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-date { font-size: 0.8rem; color: var(--hl); margin-bottom: 0.5rem; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: rgba(214, 212, 237, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
}
.bg-dark .site-header { background: rgba(19, 16, 45, 0.9); }
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--hl); font-weight: 700; }
.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--fg);
  opacity: 0.8;
}

/* SVG 响应式与基础 */
.svg-visual { width: 100%; height: auto; max-width: 100%; }
.svg-visual svg { width: 100%; height: auto; }

/* =========================================
   SVG 动效关键帧 (CSS @keyframes)
   ========================================= */
/* 网格节点依次点亮 */
@keyframes node-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}
.node {
  transform-box: fill-box;
  transform-origin: center;
  animation: node-pulse 4s infinite ease-in-out;
}
.node:nth-child(1) { animation-delay: 0s; }
.node:nth-child(2) { animation-delay: 0.4s; }
.node:nth-child(3) { animation-delay: 0.8s; }
.node:nth-child(4) { animation-delay: 1.2s; }
.node:nth-child(5) { animation-delay: 1.6s; }
.node:nth-child(6) { animation-delay: 2.0s; }
.node:nth-child(7) { animation-delay: 2.4s; }
.node:nth-child(8) { animation-delay: 2.8s; }
.node:nth-child(9) { animation-delay: 3.2s; }

/* 连接线流动 */
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.flow-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 3s linear infinite;
}

/* 气泡轻微漂浮 */
@keyframes float-bubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.bubble-float {
  transform-box: fill-box;
  transform-origin: center;
  animation: float-bubble 5s ease-in-out infinite;
}
.bubble-float.delay-1 { animation-delay: 1s; }
.bubble-float.delay-2 { animation-delay: 2s; }

/* 通知卡片滑入 */
@keyframes slide-in {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.notify-card {
  animation: slide-in 6s ease-in-out infinite alternate;
}

/* 输入三点呼吸 */
@keyframes breathe-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.input-dot {
  animation: breathe-dot 2s ease-in-out infinite;
}
.input-dot:nth-child(2) { animation-delay: 0.2s; }
.input-dot:nth-child(3) { animation-delay: 0.4s; }

/* 减少动态效果适配 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  html { scroll-behavior: auto; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .hero-layout { flex-direction: column-reverse !important; }
  .split-layout { flex-direction: column !important; }
  .nav-links { display: none; } /* 移动端简化导航 */
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}
