/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  --bg-dark: #141838;
  --bg-paper: #FCFCFD;
  --text-body: #151723;
  --brand: #142CEB;
  --accent: #6EAFED;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(64px, 9vw, 120px);
  --gap: 32px;
  --content-max: 1280px;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-body);
  background-color: var(--bg-dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }

/* --- 表面层取色规则 --- */
.surface-dark { background: var(--bg-dark); color: var(--bg-paper); }
.surface-dark a, .surface-dark .hl, .surface-dark .badge { color: var(--accent); }
.surface-light { background: var(--bg-paper); color: var(--text-body); }
.surface-light a, .surface-light .hl, .surface-light .badge { color: var(--brand); }

/* --- 布局容器 --- */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.panel {
  background: var(--bg-paper);
  border-radius: var(--radius-card);
  padding: var(--gap);
  margin-bottom: var(--section-y);
  position: relative;
  overflow: hidden;
}
.surface-dark .panel { background: var(--bg-paper); color: var(--text-body); }
.surface-dark .panel a, .surface-dark .panel .hl, .surface-dark .panel .badge { color: var(--brand); }

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-center { text-align: center; }

/* --- 排版组件 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
strong { font-weight: 600; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-body);
  color: var(--text-body);
}
.surface-dark .btn-secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; margin: 1.5rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
th { font-weight: 600; }
td:first-child { font-weight: 600; width: 40%; }

/* --- FAQ --- */
details {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  padding: 1rem;
  transition: background 0.2s ease;
}
details[open] { background: rgba(20, 44, 235, 0.03); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::marker { display: none; }
details p { margin-top: 0.75rem; font-size: 0.95rem; }

/* --- 新闻卡片 --- */
.news-card {
  background: var(--bg-paper);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card time {
  font-size: 0.8rem;
  color: var(--brand);
  margin-bottom: 0.5rem;
  display: block;
}
.news-card h3 { font-size: 1.1rem; margin-top: 0; margin-bottom: 0.5rem; }
.news-card p { font-size: 0.9rem; margin-bottom: 0; color: #444; }

/* --- 导航与页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 0.75rem 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo-img { height: 32px; width: auto; display: block; }
nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
}
nav a { font-weight: 500; font-size: 0.95rem; padding: 0.25rem 0; }
nav a[aria-current="page"] { color: var(--brand); border-bottom: 2px solid var(--brand); }

/* --- 页脚 --- */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-top: 2rem;
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.footer-links { display: flex; gap: 1rem; list-style: none; }
.footer-links a { color: #666; }
.footer-links a:hover { color: var(--brand); }

/* --- SVG 动效基础 --- */
.svg-container { width: 100%; height: auto; }
svg { overflow: visible; }
.anim-stroke {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}
.anim-float {
  animation: floatDrift 6s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.anim-breathe {
  animation: breatheOpacity 4s ease-in-out infinite alternate;
}
.anim-star-twinkle {
  animation: starTwinkle 5s ease-in-out infinite alternate;
}
.anim-slide-in {
  animation: slideIn 4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite alternate;
}

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0.2; }
}
@keyframes floatDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(3px, -4px); }
}
@keyframes breatheOpacity {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}
@keyframes starTwinkle {
  0% { opacity: 0.3; }
  100% { opacity: 0.9; }
}
@keyframes slideIn {
  0% { transform: translateX(-8px); opacity: 0.8; }
  100% { transform: translateX(0); opacity: 1; }
}

/* --- 减少动态效果 --- */
@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;
  }
  html { scroll-behavior: auto; }
}

/* --- 响应式适配 --- */
@media (max-width: 768px) {
  .grid-auto { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.5rem 0; }
  nav ul { gap: 1rem; flex-wrap: wrap; }
  .panel { padding: 1.5rem; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
}
