/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #D6D4ED;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 排版 Token */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 基础重置 */
*, *::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: 1.75;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 容器与布局 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.section {
  padding-block: var(--section-y);
  position: relative;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* 取色上下文：浅色面（默认） */
.surface-light { background-color: var(--color-paper); color: var(--color-text); }
.surface-light h1, .surface-light h2, .surface-light h3, .surface-light p, .surface-light li { color: var(--color-text); }
.surface-light .hl, .surface-light .badge, .surface-light a.link-brand { color: var(--color-brand); }
.surface-light .card { background: var(--color-paper); border: var(--card-border); color: var(--color-text); }
.surface-light .card .hl, .surface-light .card .badge, .surface-light .card a.link-brand { color: var(--color-brand); }

/* 取色上下文：深色面 */
.surface-dark { background-color: var(--color-dark); color: var(--color-paper); }
.surface-dark h1, .surface-dark h2, .surface-dark h3, .surface-dark p, .surface-dark li { color: var(--color-paper); }
.surface-dark .hl, .surface-dark .badge, .surface-dark a.link-accent { color: var(--color-accent); }
.surface-dark .card { background: var(--color-paper); border: var(--card-border); color: var(--color-text); }
.surface-dark .card .hl, .surface-dark .card .badge, .surface-dark .card a.link-brand { color: var(--color-brand); }
.surface-dark .table-wrap th, .surface-dark .table-wrap td { color: var(--color-text); }
.surface-dark .table-wrap th { background: transparent; }

/* 标题系统 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
.badge::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
}
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
.hl { font-weight: 700; }

/* 按钮系统 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding-inline: 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  border: none;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.surface-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* 卡片与面板 */
.card {
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: inherit;
}
.visual-panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: clamp(1.5rem, 3vw, 2rem);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.surface-dark .visual-panel { background-color: #1A173A; }

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); border: var(--card-border); }
table { width: 100%; border-collapse: collapse; background: var(--color-paper); }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(23, 21, 35, 0.1); }
th { font-weight: 700; background: rgba(39, 20, 235, 0.05); }
td:first-child { font-weight: 600; white-space: nowrap; }

/* FAQ / Details */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background: var(--color-paper);
  overflow: hidden;
}
summary {
  padding: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details .faq-body { padding: 0 1.25rem 1.25rem; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(214, 212, 237, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}
.surface-dark .site-header { background: rgba(19, 16, 45, 0.9); border-bottom-color: rgba(214, 212, 237, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.1rem; }
.nav { display: flex; gap: 1.5rem; }
.nav a { font-weight: 500; opacity: 0.8; transition: opacity 0.2s; }
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.surface-dark .nav a { color: var(--color-paper); }
.surface-dark .nav a:hover, .surface-dark .nav a[aria-current="page"] { color: var(--color-accent); }
.site-footer {
  padding-block: 3rem;
  border-top: 1px solid rgba(23, 21, 35, 0.1);
  font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { margin-bottom: 1rem; font-weight: 700; }
.footer-col ul li { margin-bottom: 0.6rem; }
.footer-col a:hover { text-decoration: underline; }

/* SVG 动效体系 */
.svg-visual { width: 100%; height: auto; max-width: 100%; }
.draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.flow-dot { fill: var(--color-accent); }
.surface-dark .flow-dot { fill: var(--color-accent); }

@keyframes dash-flow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe-opacity {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.anim-draw { animation: dash-flow 6s linear infinite; }
.anim-float { animation: float-y 5s ease-in-out infinite; }
.anim-breathe { animation: breathe-opacity 3s ease-in-out infinite; }
.anim-slide { animation: slide-in-right 4s ease-out forwards; }

/* 减少动态效果适配 */
@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;
  }
  .anim-draw, .anim-float, .anim-breathe, .anim-slide { animation: none !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav { display: none; } /* 简化移动端导航，实际项目可加汉堡菜单，此处保持静态纯净 */
  h1 { font-size: clamp(2rem, 8vw, 3.5rem); }
}
