/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* 基础变量与 Token */
:root {
  /* 颜色系统 */
  --bg-dark: #13102D;
  --bg-paper: #F7F5F3;
  --text-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;
  --text-on-dark: #F7F5F3;
  --text-on-dark-muted: rgba(247, 245, 243, 0.75);
  
  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.25;
  --lh-body: 1.55;
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; transition: opacity 0.2s; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  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(min(100%, 280px), 1fr));
}

/* 区域背景与取色控制 */
.section-dark {
  background-color: var(--bg-dark);
  color: var(--text-on-dark);
}
.section-dark h1, .section-dark h2, .section-dark h3, .section-dark p, .section-dark li {
  color: var(--text-on-dark);
}
.section-dark .badge, .section-dark a:not(.btn), .section-dark .icon {
  color: var(--color-accent);
}
.section-dark .text-muted { color: var(--text-on-dark-muted); }

.section-paper {
  background-color: var(--bg-paper);
  color: var(--text-body);
}
.section-paper h1, .section-paper h2, .section-paper h3, .section-paper p, .section-paper li {
  color: var(--text-body);
}
.section-paper .badge, .section-paper a:not(.btn), .section-paper .icon {
  color: var(--color-brand);
}
.section-paper .text-muted { color: rgba(23, 21, 35, 0.7); }

/* 卡片（深色面内的浅色卡片恢复纸面取色） */
.card-light {
  background-color: var(--bg-paper);
  border: var(--card-border);
  color: var(--text-body);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
}
.card-light h3, .card-light p, .card-light li { color: var(--text-body); }
.card-light .badge, .card-light a:not(.btn) { color: var(--color-brand); }

/* 排版组件 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--gap);
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600; line-height: var(--lh-tight); margin-bottom: var(--gap); text-wrap: balance; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: var(--lh-tight); margin-bottom: calc(var(--gap) * 0.5); }
p { margin-bottom: var(--gap); max-width: 38em; }
strong { font-weight: 600; }
.hl { color: var(--color-brand); }
.section-dark .hl { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, background 0.2s, color 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--bg-dark);
}
.btn-primary:hover { transform: translateY(-2px); background-color: #7de060; }
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
}
.section-paper .btn-secondary { color: var(--text-body); border-color: var(--text-body); }
.section-dark .btn-secondary { color: var(--text-on-dark); border-color: var(--text-on-dark); }
.btn-secondary:hover { background: rgba(128,128,128,0.1); }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 28px; width: auto; }
.nav-list { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-weight: 500; font-size: 0.9rem; }
.nav-link[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; }

/* 页脚 */
.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(23, 21, 35, 0.1);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
.footer-col a { display: block; padding: 0.25rem 0; font-size: 0.9rem; color: var(--text-muted); }
.footer-col a:hover { color: var(--color-brand); }
.footer-bottom {
  margin-top: var(--section-y);
  padding-top: var(--gap);
  border-top: 1px solid rgba(23, 21, 35, 0.1);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 首页布局：左侧索引 + 右侧内容 */
.main-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
  overflow-x: hidden;
}
.toc-nav {
  position: sticky;
  top: 80px;
  padding: 1rem;
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius-card);
  border: var(--card-border);
  overflow-wrap: break-word;
}
.toc-nav ul { display: flex; flex-direction: column; gap: 0.5rem; }
.toc-nav a {
  display: block;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 8px;
  color: var(--text-body);
  transition: background 0.2s;
}
.toc-nav a:hover, .toc-nav a.active { background: rgba(39, 20, 235, 0.08); color: var(--color-brand); font-weight: 600; }
.content-area { min-width: 0; }

/* 功能图文交错 */
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
  margin-bottom: var(--section-y);
}
.feature-row.reverse .feature-text { order: 2; }
.feature-row.reverse .feature-panel { order: 1; }
.feature-panel {
  aspect-ratio: 4/3;
  background: var(--bg-dark);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.feature-panel svg { width: 100%; height: auto; }

/* 表格 */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--gap) 0;
}
.spec-table th, .spec-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(23, 21, 35, 0.1);
  text-align: left;
  vertical-align: top;
}
.spec-table th { font-weight: 600; width: 35%; }
.spec-table td { color: var(--text-muted); }

/* FAQ */
.faq-item {
  border: var(--card-border);
  border-radius: 16px;
  margin-bottom: var(--gap);
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer { padding: 0 1.25rem 1rem; color: var(--text-muted); }

/* 时间线 */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(137, 237, 110, 0.3);
}
.timeline-step { position: relative; margin-bottom: var(--section-y); }
.timeline-step::before {
  content: attr(data-step);
  position: absolute;
  left: -2.75rem;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--color-accent);
  color: var(--bg-dark);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* 新闻卡片 */
.news-card {
  background: var(--bg-paper);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.news-card time { font-size: 0.8rem; color: var(--text-muted); }
.news-card p { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 0; }

/* SVG 动效类 */
.geo-spin { animation: geo-spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
.geo-align { animation: geo-align 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.path-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: path-draw 3s ease-in-out infinite alternate; }
@keyframes geo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes geo-align { 0%, 100% { transform: scale(0.96); opacity: 0.85; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes path-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .geo-spin, .geo-align, .path-flow { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* 响应式 */
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .toc-nav { position: static; margin-bottom: var(--gap); }
  .feature-row { grid-template-columns: 1fr; }
  .feature-row.reverse .feature-text { order: unset; }
  .feature-row.reverse .feature-panel { order: unset; }
  .mobile-toggle { display: block; background: none; border: none; cursor: pointer; }
  .nav-list { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-paper); flex-direction: column; padding: 1rem; border-bottom: 1px solid rgba(0,0,0,0.1); }
  .nav-list.open { display: flex; }
}
@media (min-width: 901px) {
  .mobile-toggle { display: none; }
}
.svg-container { width: 100%; height: auto; }
