/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计 Token 与基础变量 */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  --color-white: #FFFFFF;

  /* 默认取色（纸面） */
  --surface-bg: var(--color-paper);
  --text-primary: var(--color-body);
  --text-secondary: rgba(25, 21, 35, 0.72);
  --accent-use: var(--color-brand);
  --link-color: var(--color-brand);
  --divider-color: rgba(25, 21, 35, 0.12);

  /* 按钮固定配色 */
  --btn-bg: var(--color-accent);
  --btn-text: var(--color-dark);
  --btn-border: transparent;

  /* 间距与尺寸 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --header-h: 64px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
}

/* 深色面覆盖 */
.dark-surface {
  --surface-bg: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(219, 212, 237, 0.8);
  --accent-use: var(--color-accent);
  --link-color: var(--color-accent);
  --divider-color: rgba(219, 212, 237, 0.15);
  --btn-bg: var(--color-accent);
  --btn-text: var(--color-dark);
}

/* 浅色卡片（置于深色面内） */
.light-card {
  background-color: var(--color-paper);
  border-radius: var(--radius-card);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  --surface-bg: var(--color-paper);
  --text-primary: var(--color-body);
  --text-secondary: rgba(25, 21, 35, 0.72);
  --accent-use: var(--color-brand);
  --link-color: var(--color-brand);
  --divider-color: rgba(25, 21, 35, 0.12);
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section + .section { border-top: 1px solid var(--divider-color); }

/* 排版 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-use);
  margin-bottom: 0.75rem;
}
.dark-surface .badge {
  color: #B39DDB;
}
.badge::before {
  content: "";
  display: inline-block;
  width: 1.2ch;
  height: 1px;
  background-color: currentColor;
}
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; color: var(--text-secondary); max-width: 38em; }
.hl { color: var(--accent-use); font-weight: 700; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6ch;
  height: 48px;
  padding-inline: 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--btn-border);
  background-color: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--accent-use); outline-offset: 2px; }
.btn-outline {
  background: transparent;
  border-color: var(--text-primary);
  color: var(--text-primary);
}
.btn-outline:hover { background-color: rgba(128,128,128,0.08); }

/* 图文交错布局 */
.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}
@media (max-width: 768px) {
  .split-row { grid-template-columns: 1fr; }
  .split-row.reverse { flex-direction: column-reverse; }
}
.visual-panel {
  background-color: var(--surface-bg);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.dark-surface .visual-panel { background-color: rgba(255,255,255,0.04); }
.bg-paper .visual-panel { background-color: rgba(0,0,0,0.03); }

/* 列表与定义列表 */
.def-list dt {
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1.25rem;
  margin-bottom: 0.25rem;
}
.def-list dd {
  margin-left: 0;
  color: var(--text-secondary);
  padding-left: 1rem;
  border-left: 2px solid var(--accent-use);
}

/* 步骤条 */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  counter-reset: step;
}
.step-item {
  counter-increment: step;
  position: relative;
  padding-top: 2.5rem;
}
.step-item::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  background-color: var(--accent-use);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 8px;
}

/* 表格 */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--divider-color);
}
th { font-weight: 700; color: var(--text-primary); }
td { color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }

/* 新闻卡片 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}
.news-card {
  background-color: var(--surface-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease;
}
.dark-surface .news-card { background-color: rgba(255,255,255,0.05); }
.bg-paper .news-card { background-color: rgba(0,0,0,0.02); }
.news-card:hover { transform: translateY(-2px); }
.news-date {
  font-size: 0.8rem;
  color: var(--accent-use);
  font-weight: 600;
}
.news-card h4 { font-size: 1.1rem; line-height: 1.3; }
.news-card p { font-size: 0.9rem; margin-bottom: 0; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
details {
  background-color: var(--surface-bg);
  border: var(--card-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  transition: background-color 0.2s;
}
.dark-surface details { background-color: rgba(255,255,255,0.04); }
.bg-paper details { background-color: rgba(0,0,0,0.02); }
summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5ch;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  color: var(--accent-use);
  font-weight: 700;
  transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(45deg); }
details p { margin-top: 0.75rem; margin-bottom: 0; font-size: 0.95rem; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--surface-bg);
  border-bottom: 1px solid var(--divider-color);
  backdrop-filter: blur(8px);
  height: var(--header-h);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 0.6ch; font-weight: 800; color: var(--text-primary); }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; }
.nav a[aria-current="page"] { color: var(--accent-use); }
@media (max-width: 640px) {
  .nav { gap: 1rem; }
  .nav .hide-mobile { display: none; }
}
.site-footer {
  padding-block: 3rem;
  border-top: 1px solid var(--divider-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: var(--link-color); }

/* =========================================
   SVG 动效 (CSS Keyframes)
   ========================================= */
.hero-svg {
  width: 100%;
  height: auto;
  max-width: 600px;
}
.grid-node {
  fill: var(--accent-use);
  opacity: 0.3;
  animation: nodePulse 6s infinite ease-in-out;
}
.grid-node:nth-child(1) { animation-delay: 0s; }
.grid-node:nth-child(2) { animation-delay: 0.8s; }
.grid-node:nth-child(3) { animation-delay: 1.6s; }
.grid-node:nth-child(4) { animation-delay: 2.4s; }
.grid-node:nth-child(5) { animation-delay: 3.2s; }
.bubble {
  animation: bubbleFloat 5s infinite ease-in-out;
}
.bubble-1 { animation-delay: 0s; }
.bubble-2 { animation-delay: 1.5s; }
.input-dot {
  animation: dotBreathe 3s infinite ease-in-out;
}
.input-dot:nth-child(1) { animation-delay: 0s; }
.input-dot:nth-child(2) { animation-delay: 0.4s; }
.input-dot:nth-child(3) { animation-delay: 0.8s; }
.notif-card {
  animation: notifSlide 8s infinite ease-in-out;
}
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 4s infinite linear;
}

@keyframes nodePulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes dotBreathe {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes notifSlide {
  0%, 10% { transform: translateX(120%); opacity: 0; }
  15%, 85% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(120%); opacity: 0; }
}
@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  20% { stroke-dashoffset: 0; }
  80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
  .grid-node, .bubble, .input-dot, .notif-card, .draw-line {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
