/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* === 设计变量 === */
:root {
  /* 配色 */
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  --color-text-rgb: 25, 21, 35;
  
  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(var(--color-text-rgb), 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  
  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-body: 1.55;
}

/* === 基础重置 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* === 布局容器 === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}

/* === 表面主题 === */
.dark-surface { background: var(--color-dark); color: var(--color-paper); }
.paper-surface { background: var(--color-paper); color: var(--color-text); }

/* 深色面文字覆盖 */
.dark-surface h1, .dark-surface h2, .dark-surface h3, .dark-surface p, .dark-surface li, .dark-surface td, .dark-surface th { color: var(--color-paper); }
.dark-surface .hl { color: var(--color-accent); }
.dark-surface .badge { color: var(--color-accent); }
.dark-surface .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.dark-surface .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.dark-surface .card { background: #f8f4f1; color: var(--color-text); border: var(--card-border); }
.dark-surface .table-wrapper { background: var(--color-paper); border-radius: var(--radius-card); overflow: hidden; }
.dark-surface .table-wrapper table { color: var(--color-text); }
.dark-surface .table-wrapper th, .dark-surface .table-wrapper td { border-bottom-color: rgba(var(--color-text-rgb), 0.1); color: var(--color-text); }

/* 纸面文字覆盖 */
.paper-surface .hl { color: var(--color-brand); }
.paper-surface .badge { color: var(--color-brand); }
.paper-surface .btn-primary { background: var(--color-brand); color: var(--color-paper); }
.paper-surface .btn-secondary { border-color: var(--color-text); color: var(--color-text); }

/* === 排版 === */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: var(--gap);
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: var(--gap);
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
      p { margin-bottom: var(--gap); max-width: 40em; }
      strong { font-weight: 600; }
.text-muted { opacity: 0.8; }

/* === 组件：按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  height: 52px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary { background: var(--color-brand); color: var(--color-paper); }
.btn-secondary { border-color: var(--color-text); color: var(--color-text); background: transparent; }
.dark-surface .btn-primary { background: var(--color-accent); color: var(--color-dark); }
.dark-surface .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); background: transparent; }

/* === 组件：卡片 === */
.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 ease;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.card-grid .card { display: flex; flex-direction: column; }
.card-grid .card-icon { width: 24px; height: 24px; margin-bottom: 0.75rem; stroke: currentColor; stroke-width: 1.5; fill: none; }
.card-grid .card-title { font-weight: 600; margin-bottom: 0.5rem; }
.card-grid .card-desc { font-size: 0.95rem; line-height: 1.6; }

/* === 组件：表格 === */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 0; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(var(--color-text-rgb), 0.1); }
th { font-weight: 600; }
td { white-space: normal; overflow-wrap: anywhere; }

/* === 组件：FAQ === */
.faq-item { border-bottom: var(--card-border); margin-bottom: 0; }
.faq-item:last-child { border-bottom: none; }
details summary {
  padding: 1rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-weight: 400; opacity: 0.6; }
details[open] summary::after { content: "−"; }
details summary:hover { opacity: 0.85; }
details .faq-answer { padding-bottom: 1rem; line-height: 1.6; }

/* === 组件：流程条 === */
.flow-row {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}
.flow-node {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(var(--color-text-rgb), 0.05);
  padding: 1rem;
  border-radius: var(--radius-card);
  text-align: center;
}
.dark-surface .flow-node { background: rgba(var(--color-text-rgb), 0.1); }
.flow-arrow { flex: 0 0 auto; width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.5; fill: none; opacity: 0.5; }

/* === 组件：新闻卡片 === */
.news-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.news-date { font-size: 0.85rem; opacity: 0.7; }
.news-title { font-weight: 600; font-size: 1.1rem; }
.news-excerpt { font-size: 0.95rem; line-height: 1.6; }

/* === 组件：编号清单 === */
.step-list { counter-reset: step; }
.step-list li {
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1.25rem;
}
.step-list li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 2rem; height: 2rem;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.dark-surface .step-list li::before { background: var(--color-accent); color: var(--color-dark); }

/* === SVG 动效基础 === */
.svg-visual { width: 100%; height: auto; }
.star-twinkle { animation: twinkle 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.conn-line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 8s ease-in-out infinite; }
.msg-bubble-float { animation: floatSoft 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.notif-panel { animation: slidePanel 9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.input-dots circle { animation: breathe 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes slidePanel {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-8px); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* === 响应式与无障碍 === */
@media (max-width: 768px) {
  .hero-layout { flex-direction: column; }
  .hero-visual { order: 2; margin-top: var(--gap); }
  .hero-text { order: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .star-twinkle, .conn-line, .msg-bubble-float, .notif-panel, .input-dots circle {
    animation: none !important;
  }
}
.header-nav { display: flex; gap: 1.5rem; align-items: center; }
.header-nav a { font-weight: 500; opacity: 0.85; transition: opacity 0.2s; }
.header-nav a:hover, .header-nav a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.dark-surface .header-nav a:hover, .dark-surface .header-nav a[aria-current="page"] { color: var(--color-accent); }
.footer-link-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-link-group a { opacity: 0.8; }
.footer-link-group a:hover { opacity: 1; text-decoration: underline; }
