/* =========================================
   SafeW 全局样式与动效
   ========================================= */

/* 设计变量 */
:root {
  /* 颜色 */
  --color-dark: #21163C;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;

  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-sm: 8px;

  /* 边界与阴影 */
  --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: 1120px;
  --header-h: 64px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --lh-base: 1.65;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-base);
  color: var(--color-text);
  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 {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
  height: var(--header-h);
}
.site-header.scrolled {
  border-bottom-color: rgba(25, 21, 35, 0.08);
  background: rgba(244, 243, 247, 0.95);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}
.brand img { height: 32px; width: auto; }
.nav-list { display: flex; gap: 24px; align-items: center; }
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.2s;
  position: relative;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--color-brand); }
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-brand);
  border-radius: 1px;
}
.nav-actions { display: flex; gap: 12px; align-items: center; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: none;
}
.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); box-shadow: 0 6px 16px rgba(237, 146, 110, 0.35); }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); transform: translateY(-2px); }

/* 眉标 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.paper-face .eyebrow { color: var(--color-brand); }
.dark-face .eyebrow { color: var(--color-accent); }

/* 标题与高亮 */
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  margin-top: 24px;
}
.hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }

/* 区块基础 */
.section { padding-block: var(--section-y); }
.section-inner { max-width: var(--content-max); margin-inline: auto; }

/* 面体系 */
.paper-face { background: var(--color-paper); color: var(--color-text); }
.dark-face { background: var(--color-dark); color: var(--color-paper); }
.dark-face h1, .dark-face h2, .dark-face h3, .dark-face p, .dark-face li { color: var(--color-paper); }
.dark-face .eyebrow { color: var(--color-accent); }
.dark-face .hl { color: var(--color-accent); }

/* 卡片 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.dark-face .card {
  background: rgba(244, 243, 247, 0.08);
  border-color: rgba(244, 243, 247, 0.12);
  color: var(--color-paper);
}
.card:hover { transform: translateY(-4px); }

/* 时间轴 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(82, 20, 235, 0.2);
  border-radius: 1px;
}
.timeline-item { position: relative; margin-bottom: 32px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-marker {
  position: absolute;
  left: -32px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 3px solid var(--color-paper);
  box-shadow: 0 0 0 2px var(--color-brand);
}
.dark-face .timeline-marker {
  background: var(--color-accent);
  border-color: var(--color-dark);
  box-shadow: 0 0 0 2px var(--color-accent);
}
.timeline-content { padding-left: 16px; }
.timeline-time { font-size: 0.85rem; font-weight: 700; color: var(--color-brand); margin-bottom: 4px; }
.dark-face .timeline-time { color: var(--color-accent); }

/* 定义列表风格 */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.feature-item {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px;
}
.dark-face .feature-item {
  background: rgba(244, 243, 247, 0.06);
  border-color: rgba(244, 243, 247, 0.1);
  color: var(--color-paper);
}
.feature-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.feature-desc { font-size: 0.95rem; line-height: 1.6; color: var(--color-text); }
.dark-face .feature-desc { color: rgba(244, 243, 247, 0.85); }

/* 步骤 */
.step-list { counter-reset: step; }
.step-item {
  position: relative;
  padding-left: 48px;
  margin-bottom: 24px;
}
.step-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-title { font-weight: 700; margin-bottom: 4px; }
.step-note { font-size: 0.95rem; color: var(--color-text); }
.dark-face .step-note { color: rgba(244, 243, 247, 0.85); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}
.data-table th { font-weight: 700; color: var(--color-text); }
.dark-face .data-table th { color: var(--color-paper); }
.dark-face .data-table td { color: rgba(244, 243, 247, 0.85); }
.dark-face .data-table th, .dark-face .data-table td { border-bottom-color: rgba(244, 243, 247, 0.1); }
.data-table tr:last-child th, .data-table tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.dark-face .faq-item {
  background: rgba(244, 243, 247, 0.05);
  border-color: rgba(244, 243, 247, 0.1);
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-answer {
  padding: 0 20px 16px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
}
.dark-face .faq-answer { color: rgba(244, 243, 247, 0.85); }

/* 新闻卡片 */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); }
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-date { font-size: 0.8rem; color: var(--color-brand); margin-bottom: 8px; font-weight: 600; }
.dark-face .news-date { color: var(--color-accent); }
.news-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; line-height: 1.4; }
.news-excerpt { font-size: 0.95rem; line-height: 1.6; color: var(--color-text); flex-grow: 1; }
.dark-face .news-excerpt { color: rgba(244, 243, 247, 0.85); }

/* SVG 尺寸控制 */
.svg-panel { width: 100%; height: auto; max-width: 100%; display: block; }

/* 响应式 */
@media (max-width: 768px) {
  .nav-list { display: none; }
  .mobile-menu-btn { display: block; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .feature-grid, .news-grid { grid-template-columns: 1fr; }
}
@media (min-width: 769px) {
  .mobile-menu-btn { display: none; }
}

/* SVG 动效 Keyframes */
@keyframes nodePulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes typingBreathe {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes notifySlide {
  0%, 100% { transform: translateX(16px); opacity: 0; }
  15%, 85% { transform: translateX(0); opacity: 1; }
}
@keyframes lineDraw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes lockSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 动效类 */
.anim-node { animation: nodePulse 5s infinite ease-in-out; transform-box: fill-box; transform-origin: center; }
.anim-bubble { animation: bubbleFloat 4s infinite ease-in-out; transform-box: fill-box; transform-origin: center; }
.anim-typing { animation: typingBreathe 2.4s infinite ease-in-out; transform-box: fill-box; transform-origin: center; }
.anim-notify { animation: notifySlide 7s infinite ease-in-out; }
.anim-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: lineDraw 4s linear infinite; }
.anim-lock { animation: lockSpin 8s linear 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;
    animation: none !important;
  }
}
