/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与主题覆盖 --- */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.55;
  --line-height-tight: 1.25;
}

/* 主题变量覆盖规则 */
.theme-paper {
  --text-primary: var(--color-body);
  --text-secondary: var(--color-body);
  --text-muted: rgba(25, 21, 35, 0.65);
  --link-color: var(--color-brand);
  --marker-color: var(--color-brand);
  --hl-color: var(--color-brand);
  --border-color: rgba(25, 21, 35, 0.12);
}

.theme-dark {
  --text-primary: var(--color-paper);
  --text-secondary: rgba(247, 245, 243, 0.85);
  --text-muted: rgba(247, 245, 243, 0.6);
  --link-color: var(--color-accent);
  --marker-color: var(--color-accent);
  --hl-color: var(--color-accent);
  --border-color: rgba(247, 245, 243, 0.15);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--color-paper);
  -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: color 0.2s; }
a:hover { opacity: 0.85; }
:focus-visible { outline: 2px solid var(--link-color); outline-offset: 2px; border-radius: 2px; }

/* --- 容器与网格 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* --- 区块节奏 --- */
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section--dark { background-color: var(--color-dark); }
.section--paper { background-color: var(--color-paper); }

/* --- 标题系统 --- */
.marker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--marker-color);
  margin-bottom: 0.5em;
}
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: 0.02em;
  margin-bottom: 1em;
  word-break: keep-all;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: 0.02em;
  margin-top: 2em;
  margin-bottom: 0.8em;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5em;
  text-wrap: balance;
}
.text-hl { color: var(--hl-color); font-weight: inherit; }

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  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, border-color 0.2s;
  white-space: nowrap;
  border: 2px solid transparent;
}
.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn--primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn--secondary {
  background-color: transparent;
  border-color: var(--text-primary);
  color: var(--text-primary);
}
.theme-dark .btn--secondary { border-color: var(--text-primary); color: var(--text-primary); }
.btn--secondary:hover { background-color: rgba(255,255,255,0.05); }
.btn svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* --- 卡片与面板 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s;
}
.theme-dark .card { background: rgba(247, 245, 243, 0.08); border-color: rgba(247, 245, 243, 0.15); }
.card:hover { transform: translateY(-2px); }
.visual-panel {
  background: var(--color-dark);
  border-radius: 12px;
  padding: 1.5em;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.visual-panel svg { width: 100%; height: 100%; }

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
th { font-weight: 700; color: var(--text-secondary); }
td:last-child { color: var(--text-primary); }

/* --- 步骤条 --- */
.step-list { counter-reset: step; list-style: none; display: grid; gap: var(--gap); }
.step-item {
  position: relative;
  padding-left: 3rem;
  min-height: 3rem;
}
.step-item::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 2.4rem; height: 2.4rem;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- FAQ --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}
summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.02);
}
.theme-dark summary { background: rgba(255,255,255,0.05); }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
.details-content { padding: 1rem 1.25rem; line-height: 1.6; color: var(--text-secondary); }

/* --- 新闻卡片 --- */
.news-card {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.news-date { font-size: 0.85rem; color: var(--text-muted); }

/* --- 流程箭头 --- */
.flow-arrow {
  display: none;
  width: 2rem;
  height: 2rem;
  align-self: center;
  color: var(--link-color);
}
@media (min-width: 768px) {
  .flow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: center; }
  .flow-arrow { display: block; }
}

/* --- 页头页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
}
.theme-dark .site-header { background: rgba(20, 14, 37, 0.9); }
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding-block: 0.8rem; }
  .nav-links { gap: 0.8rem; justify-content: center; margin-top: 0.5rem; }
}
.nav-link { font-weight: 500; font-size: 0.95rem; }
.nav-link[aria-current="page"], .nav-link:hover { font-weight: 700; }
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: var(--section-y);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.8rem; color: var(--text-muted); }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-copy { margin-top: 2rem; font-size: 0.85rem; color: var(--text-muted); text-align: center; }

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-anim-container { width: 100%; height: 100%; }
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-pulse { animation: pulse 4s ease-in-out infinite; }
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.anim-slide-up { animation: slideUp 5s ease-in-out infinite; }
.anim-orbit {
  transform-box: fill-box;
  transform-origin: center;
  animation: orbit 8s linear infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}
@keyframes draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes slideUp {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-8px); opacity: 1; }
}
@keyframes orbit {
  0% { transform: rotate(0deg) scale(1); opacity: 0.5; }
  50% { transform: rotate(180deg) scale(1.1); opacity: 0.9; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.5; }
}

/* 减少动态效果支持 */
@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;
  }
  [class*="anim-"] { animation: none !important; }
}
