/* =========================================
   SafeW 全局样式与设计 Token
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #121531;
  --color-paper: #E8E9EA;
  --color-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #ED7D6E;
  
  /* 上下文衍生色 */
  --color-dark-text: #E8E9EA;
  --color-paper-text: #151723;
  --color-separator: rgba(21, 23, 35, 0.10);
  --color-card-surface: #F5F6F7;
  --color-card-surface-dark: #1A1D3A;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  /* 排版 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --lh-body: 1.65;
  --lh-tight: 1.1;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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;
}

.section + .section {
  border-top: 1px solid var(--color-separator);
}

.section-header {
  margin-bottom: calc(var(--gap) * 2);
}

.masthead {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
}

.bg-dark .hl {
  color: var(--color-accent);
}

/* =========================================
   页头与页脚
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-separator);
}

.bg-dark .site-header {
  background: rgba(18, 21, 49, 0.9);
  border-bottom-color: rgba(232, 233, 234, 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: 700;
  font-size: 1.1rem;
}

.brand img {
  width: 28px;
  height: 28px;
}

nav ul {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}

nav a:hover, nav a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}

.bg-dark nav a {
  color: var(--color-dark-text);
}

.bg-dark nav a:hover, .bg-dark nav a[aria-current="page"] {
  color: var(--color-accent);
}

/* =========================================
   按钮组件
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}

.btn:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  border-color: currentColor;
  color: var(--color-body);
}

.bg-dark .btn-secondary {
  border-color: var(--color-dark-text);
  color: var(--color-dark-text);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  opacity: 0.85;
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* =========================================
   卡片与面板
   ========================================= */
.card {
  background-color: var(--color-card-surface);
  border: var(--card-border) solid transparent;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}

.panel-dark {
  background-color: var(--color-card-surface-dark);
  color: var(--color-dark-text);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--gap);
}

/* =========================================
   表格
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1.5rem;
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-separator);
}

th {
  font-weight: 700;
  background: rgba(0,0,0,0.03);
}

td:first-child {
  font-weight: 600;
}

a.link-accent {
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bg-dark a.link-accent {
  color: var(--color-accent);
}

/* =========================================
   FAQ / Details
   ========================================= */
details {
  background: var(--color-card-surface);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

summary {
  padding: 1.25rem 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;
  opacity: 0.6;
}

details[open] summary::after {
  content: "-";
}

details p {
  padding: 0 1.5rem 1.25rem;
  color: var(--color-body);
  opacity: 0.9;
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-anim-node {
  animation: node-pulse 6s infinite ease-in-out;
  transform-origin: center;
  transform-box: fill-box;
}

.svg-anim-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-flow 8s infinite linear;
}

@keyframes node-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes draw-flow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* 延迟错开 */
.delay-1 { animation-delay: 0s; }
.delay-2 { animation-delay: 1.2s; }
.delay-3 { animation-delay: 2.4s; }
.delay-4 { animation-delay: 3.6s; }
.delay-5 { animation-delay: 4.8s; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  .svg-anim-node, .svg-anim-line {
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
    transform: none !important;
  }
}

/* =========================================
   响应式微调
   ========================================= */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  header nav { display: none; } /* 移动端简化导航，保留主按钮 */
  .hero-layout { flex-direction: column; }
  .hero-visual { margin-top: 2rem; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
