/* =========================================
   SafeW 共享样式表
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色 */
  --color-dark: #21163C;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --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: 960px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}
.section-divider {
  width: 100%;
  height: 1px;
  background-color: rgba(25, 21, 35, 0.08);
}

/* --- 背景面切换 --- */
.bg-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .overline { color: var(--color-accent); }
.bg-dark a:not(.btn):hover { color: var(--color-accent); }
.bg-dark .card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-color: rgba(25, 21, 35, 0.16);
}
.bg-dark .card .hl { color: var(--color-brand); }
.bg-dark .card .overline { color: var(--color-brand); }

/* --- 排版组件 --- */
.overline {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  color: var(--color-brand);
}
.bg-dark .overline { color: var(--color-accent); }

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  margin-top: 0;
  margin-bottom: 0.5em;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); text-wrap: balance; }
h3 { font-size: 1.25rem; }
p { margin-top: 0; margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--color-brand); font-weight: 600; }
.bg-dark .hl { color: var(--color-accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); background-color: #d9835f; }
.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}
.bg-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-secondary:hover { background-color: rgba(25, 21, 35, 0.06); }
.bg-dark .btn-secondary:hover { background-color: rgba(244, 243, 247, 0.1); }

/* --- 卡片 --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: calc(var(--gap) * 1.25);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}
.data-table th { font-weight: 600; color: var(--color-text); }
.bg-dark .data-table th, .bg-dark .data-table td { border-color: rgba(244, 243, 247, 0.15); }
.bg-dark .data-table th { color: var(--color-paper); }

/* --- 详情列表 (FAQ) --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background-color: var(--color-paper);
}
details summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--color-brand);
  transition: transform 0.2s;
}
details[open] summary::after { transform: translateY(-50%) rotate(45deg); color: var(--color-accent); }
details > div { padding: 0 1.25rem 1rem; line-height: 1.7; }

/* --- 时间轴 --- */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid rgba(25, 21, 35, 0.1);
  margin-top: 1.5rem;
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 1rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.85rem;
  top: 0.35em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-brand);
  border: 2px solid var(--color-paper);
}
.timeline-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(82, 20, 235, 0.1);
  color: var(--color-brand);
  padding: 0.2em 0.6em;
  border-radius: 6px;
  margin-bottom: 0.4em;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(244, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-list { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-size: 0.95rem; font-weight: 500; padding: 0.25em 0; position: relative; }
.nav-link[aria-current="page"], .nav-link:hover { 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);
}
.brand-logo { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.brand-logo img { width: 32px; height: 32px; object-fit: contain; }

.site-footer {
  padding: var(--section-y) 0;
  background-color: var(--color-dark);
  color: var(--color-paper);
  border-top: 1px solid rgba(244, 243, 247, 0.1);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  text-align: center;
}
.footer-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: rgba(244, 243, 247, 0.7); font-size: 0.9rem; }
.footer-nav a:hover { color: var(--color-accent); }
.footer-copy { font-size: 0.8rem; color: rgba(244, 243, 247, 0.5); margin-top: 1rem; }

/* --- SVG 动效 --- */
.svg-container { width: 100%; height: auto; overflow: visible; }
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
/* 网格节点依次点亮 */
@keyframes grid-node-pulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}
.anim-node {
  transform-box: fill-box;
  transform-origin: center;
  fill: var(--color-brand);
}
.bg-dark .anim-node { fill: var(--color-accent); }
.anim-node:nth-child(1) { animation: grid-node-pulse 4s ease-in-out infinite 0s; }
.anim-node:nth-child(2) { animation: grid-node-pulse 4s ease-in-out infinite 0.6s; }
.anim-node:nth-child(3) { animation: grid-node-pulse 4s ease-in-out infinite 1.2s; }
.anim-node:nth-child(4) { animation: grid-node-pulse 4s ease-in-out infinite 1.8s; }
.anim-node:nth-child(5) { animation: grid-node-pulse 4s ease-in-out infinite 2.4s; }
.anim-node:nth-child(6) { animation: grid-node-pulse 4s ease-in-out infinite 3.0s; }

/* 描边流动 */
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 3s ease forwards;
}

/* 气泡呼吸 */
@keyframes bubble-breathe {
  0%, 100% { opacity: 0.6; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}
.anim-bubble {
  transform-box: fill-box;
  transform-origin: center;
  animation: bubble-breathe 4s ease-in-out infinite;
}

/* 通知滑入 */
@keyframes slide-in {
  0%, 100% { opacity: 0.7; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(6px); }
}
.anim-slide {
  animation: slide-in 5s ease-in-out infinite;
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 0; }
  .nav-list { gap: 1rem; margin-top: 0.5rem; }
  .btn { width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
  .timeline { padding-left: 1rem; }
  .timeline-item { padding-left: 0.5rem; }
}

/* --- 减少动态效果 --- */
@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;
  }
  .anim-node, .anim-draw, .anim-bubble, .anim-slide {
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}
