/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色彩系统 */
  --color-dark: #13102D;
  --color-paper: #D6D4ED;
  --color-text: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;
  
  /* 几何与间距 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  
  /* 排版 */
  --font-title: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  --font-body: 'Noto Sans SC', system-ui, sans-serif;
  --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-body);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 面与卡片层级 */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark a:not(.btn) { color: var(--color-accent); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .badge { color: var(--color-accent); }

.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.surface-paper a:not(.btn) { color: var(--color-brand); }
.surface-paper .hl { color: var(--color-brand); }
.surface-paper .badge { color: var(--color-brand); }

.card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
.card-light a { color: var(--color-brand); }
.card-light .hl { color: var(--color-brand); }

/* 标题与眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
}
h1 {
  font-family: var(--font-title);
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
  margin-bottom: 1.5em;
}
h2 {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
  margin-bottom: 1.2em;
}
h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.8em;
}
p { margin-bottom: 1em; max-width: 38em; }
.hl { font-weight: 600; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding-inline: 1.5em;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  border: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 4px; }
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background-color: #7ae05d; }
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
}
.surface-paper .btn-secondary { color: var(--color-text); border-color: var(--color-text); }
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { background-color: rgba(128,128,128,0.1); }

/* 网格与布局 */
.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); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }
@media (min-width: 768px) {
  .grid-2-desktop { grid-template-columns: 1fr 1fr; }
  .flex-row-alternate > div:nth-child(even) { order: 1; }
}

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
th { font-weight: 600; white-space: nowrap; }
td { min-width: 0; }
tr:last-child td { border-bottom: none; }

/* FAQ / Details */
details {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  margin-bottom: 0.8em;
  padding: 1em 1.2em;
  border: 1px solid rgba(128,128,128,0.15);
}
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 1.5em;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 0.5em; height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transition: transform 0.2s ease;
}
details[open] summary::before { transform: translateY(-50%) rotate(135deg); }
details p { margin-top: 0.8em; margin-bottom: 0; font-size: 0.95rem; }

/* 导航与页脚 */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(214, 212, 237, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}
.surface-dark header { background: rgba(19, 16, 45, 0.9); border-color: rgba(214, 212, 237, 0.1); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6em; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
nav ul { display: flex; gap: 1.5em; }
nav a { font-weight: 500; font-size: 0.95rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
.surface-dark nav a:hover, .surface-dark nav a[aria-current="page"] { color: var(--color-accent); }
footer {
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(128,128,128,0.15);
  margin-top: var(--section-y);
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2em; }
.footer-links { display: flex; gap: 1.5em; flex-wrap: wrap; }

/* SVG 动效基类 */
svg { width: 100%; height: auto; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 4s ease-in-out infinite alternate; }
.anim-float { animation: float 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-blink { animation: blink 3s ease-in-out infinite; }
.anim-pulse { animation: pulseDot 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-draw, .anim-float, .anim-blink, .anim-pulse {
    animation: none !important;
  }
}
