/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* ---------- 设计变量 ---------- */
:root {
  /* 色板 */
  --color-dark: #2D1438;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 字体与节奏 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.15;
  --lh-body: 1.75;
  --letter-heading: -0.01em;
}

/* ---------- 重置与基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
body {
  background: var(--color-paper);
  color: var(--color-text);
  line-height: var(--lh-body);
  font-size: 16px;
  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);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}

/* ---------- 背景与取色类 ---------- */
.bg-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl { color: var(--color-accent); }
.bg-dark a:not(.btn) { color: var(--color-accent); }
.bg-dark .icon-fill { stroke: var(--color-accent); }

/* 修复：深色背景下的导航链接对比度 */
.bg-paper header.site-header.bg-paper .nav-list a.nav-link {
  color: #4a1265;
}

.bg-paper {
  background: var(--color-paper);
  color: var(--color-text);
}
.bg-paper .hl { color: var(--color-brand); }
.bg-paper a:not(.btn) { color: var(--color-brand); }

.bg-card {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
.bg-card .hl { color: var(--color-brand); }
.bg-card a:not(.btn) { color: var(--color-brand); }

/* ---------- 排版 ---------- */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--letter-heading);
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin-bottom: 1.25rem; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.small-caps {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.small-caps::before {
  content: "";
  width: 16px;
  height: 2px;
  background: currentColor;
  display: inline-block;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid transparent;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  border: 2px solid currentColor;
  color: inherit;
}
.btn-secondary:hover { background: rgba(0,0,0,0.05); transform: translateY(-2px); }
.bg-dark .btn-secondary { border-color: var(--color-paper); }
.bg-dark .btn-secondary:hover { background: rgba(255,255,255,0.08); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- 组件：卡片网格 ---------- */
.grid-cards {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.card-panel {
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.card-panel ul {
  padding-left: 1.2rem;
  list-style: disc;
}
.card-panel li { margin-bottom: 0.6rem; }

/* ---------- 组件：时间轴 ---------- */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid currentColor;
  opacity: 0.85;
}
.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.55rem;
  top: 0.4rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  border: 2px solid var(--color-paper);
}
.bg-dark .timeline-item::before { border-color: var(--color-dark); }
.timeline-time {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  opacity: 0.8;
}

/* ---------- 组件：步骤编号 ---------- */
.step-list { counter-reset: step; }
.step-list li {
  counter-increment: step;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.step-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}
.step-content strong { display: block; margin-bottom: 0.3rem; }

/* ---------- 组件：表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid currentColor;
  opacity: 0.9;
}
th { font-weight: 700; opacity: 1; }
td:first-child { font-weight: 600; }

/* ---------- 组件：FAQ ---------- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  overflow: hidden;
}
summary {
  padding: 1.2rem;
  cursor: pointer;
  font-weight: 600;
  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-content { padding: 0 1.2rem 1.2rem; }

/* ---------- 组件：新闻卡片 ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}
.news-card {
  padding: var(--gap);
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--color-paper);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.news-date { font-size: 0.8rem; opacity: 0.7; }

/* ---------- 页头与页脚 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}
.bg-dark .site-header { background: rgba(45, 20, 56, 0.95); border-color: rgba(255,255,255,0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.logo img { width: 32px; height: 32px; object-fit: contain; }
.nav-list { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-weight: 500; opacity: 0.85; transition: opacity 0.2s; }
.nav-link:hover, .nav-link[aria-current="page"] { opacity: 1; }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid currentColor;
  opacity: 0.9;
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }

/* ---------- SVG 动效 ---------- */
.hero-svg {
  width: 100%;
  height: auto;
  max-width: 800px;
  margin-inline: auto;
}
.anim-float { animation: floatY 6s ease-in-out infinite; }
.anim-float-delay { animation: floatY 6s ease-in-out infinite 2s; }
.anim-float-delay2 { animation: floatY 6s ease-in-out infinite 4s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.anim-breathe { animation: breatheOpacity 5s ease-in-out infinite; }
@keyframes breatheOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.anim-flow-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 8s linear infinite;
}
@keyframes drawStroke {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.anim-pulse-dot {
  animation: pulseScale 4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes pulseScale {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 响应式微调 ---------- */
@media (max-width: 768px) {
  .nav-list { gap: 1rem; }
  .grid-cards { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
}
