/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-bg-dark: #10112D;
  --color-bg-paper: #F5F0E5;
  --color-text-body: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(21,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;

  /* 默认取色（纸面模式） */
  --bg-surface: var(--color-bg-paper);
  --color-text: var(--color-text-body);
  --color-link: var(--color-brand);
  --color-badge: var(--color-brand);
  --color-highlight: var(--color-brand);
}

/* 深色面覆盖 */
.surface-dark {
  --bg-surface: var(--color-bg-dark);
  --color-text: var(--color-bg-paper);
  --color-link: var(--color-accent);
  --color-badge: var(--color-accent);
  --color-highlight: var(--color-accent);
}

/* 卡片内浅色覆盖 */
.card-light-on-dark {
  --bg-surface: var(--color-bg-paper);
  --color-text: var(--color-text-body);
  --color-link: var(--color-brand);
  --color-badge: var(--color-brand);
  --color-highlight: var(--color-brand);
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-surface);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-link); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding: var(--section-y) 0;
}
.section-header {
  margin-bottom: var(--gap);
}
.breadcrumb {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-badge);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 2px;
  background: currentColor;
}

/* 标题系统 */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; margin-bottom: 0.6em; }
h3 { font-size: 1.25rem; line-height: 1.3; margin-bottom: 0.5em; }
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--color-highlight); }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--card-border);
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-text);
}
.brand img { height: 32px; width: auto; }
nav ul { display: flex; gap: 24px; align-items: center; }
nav a { font-size: 0.95rem; font-weight: 500; }
nav a[aria-current="page"] { color: var(--color-highlight); font-weight: 700; }

/* 按钮 */
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  border: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.btn-secondary:hover { transform: translateY(-2px); background: rgba(128,128,128,0.1); }
.btn-icon { width: 20px; height: 20px; }

/* 卡片与面板 */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.visual-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* 表格 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.spec-table th, .spec-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
  vertical-align: top;
}
.spec-table th { font-weight: 700; width: 35%; }
.spec-table tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.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;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .answer {
  padding: 0 20px 16px;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* 步骤条 */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}
.step-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.step-badge {
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-bg-dark);
  font-weight: 800;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.surface-dark .step-badge { background: var(--color-accent); color: var(--color-bg-dark); }

/* 新闻卡片 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}
.news-card {
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.news-date {
  font-size: 0.8rem;
  color: var(--color-text);
  opacity: 0.7;
}

/* 场景卡片 */
.scenario-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.scenario-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--color-brand);
}
.surface-dark .scenario-tag { color: var(--color-accent); }
@media (max-width: 768px) {
  .scenario-row { grid-template-columns: 1fr; }
  nav ul { gap: 16px; }
}

/* =========================================
   SVG 动效体系
   ========================================= */
.svg-visual {
  width: 100%;
  height: auto;
  max-width: 100%;
}
svg { overflow: visible; }

/* 描边绘制动画 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes draw-line {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}

/* 节点依次点亮 */
.node-light {
  fill: var(--color-brand);
  opacity: 0.25;
  transition: fill 0.3s;
}
.node-light.active-phase {
  animation: node-pulse 8s ease-in-out infinite;
}
.node-light:nth-child(odd) { animation-delay: 0s; }
.node-light:nth-child(even) { animation-delay: 1.2s; }
@keyframes node-pulse {
  0%, 100% { opacity: 0.25; fill: var(--color-brand); }
  40% { opacity: 1; fill: var(--color-accent); }
  60% { opacity: 1; fill: var(--color-accent); }
}

/* 呼吸点（输入中） */
.breath-dot {
  animation: breath 2.4s ease-in-out infinite;
}
.breath-dot:nth-child(2) { animation-delay: 0.4s; }
.breath-dot:nth-child(3) { animation-delay: 0.8s; }
@keyframes breath {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* 滑入通知 */
.slide-in-card {
  animation: card-slide 10s ease-in-out infinite;
}
@keyframes card-slide {
  0%, 10% { transform: translateY(20px); opacity: 0; }
  15%, 85% { transform: translateY(0); opacity: 1; }
  90%, 100% { transform: translateY(20px); opacity: 0; }
}

/* 气泡浮动 */
.float-bubble {
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 连接线流动 */
.flow-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-draw 5s linear infinite;
}
@keyframes flow-draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 旋转/缩放原点修正 */
.anim-spin, .anim-scale {
  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;
  }
  .draw-path, .flow-line, .node-light.active-phase, .breath-dot, .slide-in-card, .float-bubble {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
