/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #2D1438;
  --color-paper: #F6F3F7;
  --color-body: #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: 1280px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-body: 1.75;
}

/* 基础重置与全局变量作用域 */
*, *::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: var(--line-height-body);
  color: var(--color-body);
  background-color: var(--color-paper);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }

/* 容器与布局 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
section {
  padding: var(--section-y) 0;
  position: relative;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.text-center { text-align: center; }
.mt-lg { margin-top: var(--gap); }
.mb-md { margin-bottom: calc(var(--gap) * 0.6); }

/* 文本层级 */
.heading-h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}
.heading-h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}
.heading-h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.8rem;
}
.subtitle {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: inline-block;
}
.highlight { font-weight: 600; }
.body-text { max-width: 38em; margin-bottom: 1.5rem; }
.body-text p { margin-bottom: 1rem; }

/* 面色控制变量 */
.bg-dark {
  --fg: var(--color-paper);
  --fg-muted: rgba(246, 243, 247, 0.75);
  --accent: var(--color-accent);
  --border: rgba(246, 243, 247, 0.15);
  background-color: var(--color-dark);
}
.bg-light {
  --fg: var(--color-body);
  --fg-muted: rgba(31, 21, 35, 0.65);
  --accent: var(--color-brand);
  --border: rgba(31, 21, 35, 0.12);
  background-color: var(--color-paper);
}
.section-inner { color: var(--fg); }
.section-inner .subtitle { color: var(--accent); }
.section-inner .highlight { color: var(--accent); }
.section-inner .body-text { color: var(--fg); }
.section-inner a:not(.btn) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0 1.5rem;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-1px); background-color: #5ce096; }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg);
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }
.icon-btn { width: 20px; height: 20px; flex-shrink: 0; }

/* 卡片与面板 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  color: var(--color-body);
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  color: var(--color-paper);
  position: relative;
  overflow: hidden;
}

/* 表格 */
.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 var(--border);
}
th { font-weight: 600; }
td:first-child { font-weight: 500; color: var(--fg); }
td:last-child { color: var(--fg-muted); }

/* 列表与时间轴 */
.list-check { display: flex; flex-direction: column; gap: 1rem; }
.list-check li { display: flex; gap: 0.8rem; align-items: flex-start; }
.check-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; stroke: var(--accent); }
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding-bottom: 2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; left: -2.55rem; top: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--color-dark);
}
.timeline-time { font-size: 0.8rem; font-weight: 700; color: var(--accent); margin-bottom: 0.4rem; letter-spacing: 0.05em; }

/* 步骤条 */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); counter-reset: step; }
.step-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  position: relative;
  counter-increment: step;
}
.step-card::before {
  content: "0" counter(step);
  position: absolute; top: -0.8rem; left: 1.2rem;
  background: var(--accent); color: var(--color-dark);
  font-weight: 800; font-size: 0.85rem; padding: 0.2rem 0.6rem;
  border-radius: 6px;
}
.step-num { font-size: 0.8rem; font-weight: 700; color: var(--accent); margin-bottom: 0.5rem; display: block; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 1rem; }
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: var(--color-paper);
  overflow: hidden;
}
summary {
  padding: 1.2rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  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; font-weight: 400; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details > div { padding: 0 1.5rem 1.2rem; color: var(--color-body); line-height: 1.7; }

/* 新闻卡片 */
.news-card { background: var(--color-paper); border: var(--card-border); border-radius: var(--radius-card); padding: 1.5rem; display: flex; flex-direction: column; height: 100%; }
.news-date { font-size: 0.75rem; color: var(--fg-muted); margin-bottom: 0.6rem; display: block; }
.news-title { font-weight: 600; margin-bottom: 0.6rem; line-height: 1.4; }
.news-excerpt { font-size: 0.9rem; color: var(--fg-muted); line-height: 1.6; flex-grow: 1; }

/* 页头与页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246, 243, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; color: var(--color-body); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--color-body); }
.nav-links a:hover { color: var(--color-brand); }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 600; }
.hamburger { display: none; background: none; border: none; cursor: pointer; }

.site-footer { background: var(--color-dark); color: var(--color-paper); padding: 3rem 0 2rem; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: 2rem; }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 1rem; color: var(--accent); }
.footer-col ul { display: flex; flex-direction: column; gap: 0.6rem; }
.footer-col a { font-size: 0.9rem; color: var(--fg-muted); }
.footer-col a:hover { color: var(--color-paper); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.5rem; text-align: center; font-size: 0.8rem; color: var(--fg-muted); }

/* SVG 动效核心规则 */
.svg-container { width: 100%; height: auto; }
.svg-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.draw-line { animation: drawStroke 4s ease-in-out infinite alternate; }
.float-bubble { animation: floatBreathe 5s ease-in-out infinite; }
.float-delay { animation-delay: 0.8s; }
.float-delay-2 { animation-delay: 1.6s; }
.rotate-slow { animation: rotateSlow 12s linear infinite; transform-box: fill-box; transform-origin: center; }

@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatBreathe {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .timeline { padding-left: 1.5rem; }
  .timeline-marker { left: -2.05rem; }
  .heading-h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
  .container { padding: 0 1rem; }
}

@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-line, .float-bubble, .rotate-slow { animation: none !important; }
}
