/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与 Token --- */
:root {
  /* 色板 */
  --color-dark-surface: #271231;
  --color-paper: #F5F0E5;
  --color-text: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;
  
  /* 上下文覆盖（默认纸面） */
  --bg: var(--color-paper);
  --fg: var(--color-text);
  --link: var(--color-brand);
  --hl: var(--color-brand);
  --divider: rgba(31, 21, 35, 0.12);

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 深色面上下文 */
.surface-dark {
  --bg: var(--color-dark-surface);
  --fg: var(--color-paper);
  --link: var(--color-accent);
  --hl: var(--color-accent);
  --divider: rgba(245, 240, 229, 0.15);
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.section + .section::before {
  content: "";
  position: absolute;
  top: 0; left: var(--gap); right: var(--gap);
  height: 1px;
  background: var(--divider);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }

/* 排版层级 */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: 0; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.8rem); text-wrap: balance; hyphens: none; margin-bottom: 0.8em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.6em; }
h3 { font-size: 1.25rem; margin-bottom: 0.5em; }
p { margin-bottom: 1em; max-width: 38em; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  color: var(--link);
}
.hl { color: var(--hl); }
.surface-dark .hl { color: var(--color-paper); }

/* 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-btn);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark-surface);
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
}
.btn-primary:hover { transform: translateY(-2px); background: #d95aad; }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg);
  height: 48px;
  padding: 0 20px;
  font-size: 0.95rem;
}
.btn-secondary:hover { background: rgba(31, 21, 35, 0.06); }
.surface-dark .btn-secondary { border-color: var(--fg); color: var(--fg); }
.surface-dark .btn-secondary:hover { background: rgba(245, 240, 229, 0.1); }

/* 组件：卡片与面板 */
.card {
  background: var(--bg);
  border: var(--card-border) solid var(--fg);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.panel {
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: var(--gap);
  overflow: hidden;
  position: relative;
}

/* 组件：表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 500px;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
}
th { font-weight: 600; color: var(--hl); }
td:first-child { font-weight: 600; white-space: nowrap; }

/* 组件：FAQ */
details {
  border-bottom: 1px solid var(--divider);
  padding: 16px 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "+";
  font-weight: 700;
  color: var(--hl);
}
details[open] summary::before { content: "-"; }
details p { margin-top: 12px; font-size: 0.95rem; line-height: 1.7; }

/* 组件：时间线（快速开始） */
.timeline { counter-reset: step; }
.step {
  position: relative;
  padding-left: 48px;
  margin-bottom: 32px;
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 32px; height: 32px;
  background: var(--hl);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
}
.step-title { font-weight: 600; margin-bottom: 4px; }

/* 组件：新闻卡片 */
.news-card article {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--divider);
  padding: var(--gap);
  background: var(--bg);
}
.news-card time {
  font-size: 0.8rem;
  color: var(--hl);
  margin-bottom: 8px;
  display: block;
}
.news-card h4 { font-size: 1.1rem; margin-bottom: 8px; line-height: 1.3; }
.news-card p { font-size: 0.95rem; color: var(--fg); opacity: 0.9; flex-grow: 1; }

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); font-weight: 700; }
.brand img { height: 32px; width: auto; }
nav { display: flex; gap: 24px; align-items: center; }
nav a { color: var(--fg); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--hl); }
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--divider);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* SVG 动效系统 */
.svg-visual { width: 100%; height: auto; max-width: 600px; margin: 0 auto; }
.star { fill: var(--hl); opacity: 0.2; }
.line { stroke: var(--link); stroke-width: 1.5; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.bubble { fill: var(--bg); stroke: var(--link); stroke-width: 1.5; }
.notification { fill: var(--hl); opacity: 0.9; }

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.star { animation: twinkle 4s ease-in-out infinite; }
.line { animation: drawLine 6s ease-in-out infinite alternate; }
.float-bubble { animation: floatUp 5s ease-in-out infinite; }
.breathe-dot { animation: breathe 3s ease-in-out infinite; }

svg [class^="star"], svg [class^="line"], svg [class^="bubble"], svg [class^="notification"], svg [class^="breathe"] {
  transform-box: fill-box;
  transform-origin: center;
}

@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) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; }
  nav { order: 3; width: 100%; justify-content: center; margin-top: 8px; }
}
