/* =========================================
   SafeW 全局样式与设计系统
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --color-dark: #13102D;
  --color-paper: #F7F5F3;
  --color-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* 派生取色（遵循面规则） */
  --text-primary: var(--color-body);
  --text-secondary: rgba(23, 21, 35, 0.72);
  --link-color: var(--color-brand);
  --highlight-color: var(--color-brand);
  --border-color: rgba(23, 21, 35, 0.16);
  --bg-surface: var(--color-paper);

  /* 结构参数 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid var(--border-color);
  --card-shadow: none;

  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.55;
  --line-height-title: 1.25;
}

/* 深色面覆盖变量 */
.bg-dark {
  --text-primary: var(--color-paper);
  --text-secondary: rgba(247, 245, 243, 0.8);
  --link-color: var(--color-accent);
  --highlight-color: var(--color-accent);
  --border-color: rgba(247, 245, 243, 0.2);
  --bg-surface: var(--color-dark);
}

/* 浅色卡片在深色面上恢复纸面取色 */
.card-light-on-dark {
  --text-primary: var(--color-body);
  --text-secondary: rgba(23, 21, 35, 0.72);
  --link-color: var(--color-brand);
  --highlight-color: var(--color-brand);
  --border-color: rgba(23, 21, 35, 0.16);
  --bg-surface: var(--color-paper);
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-surface);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--highlight-color); outline-offset: 2px; border-radius: 2px; }
ul, ol { list-style: none; }

/* 布局容器 */
.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding: var(--section-y) 0; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }

/* 排版组件 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--highlight-color);
  margin-bottom: 0.5em;
}
h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: var(--line-height-title);
  letter-spacing: 0;
  margin-bottom: 1em;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: var(--line-height-title);
  margin-bottom: 1em;
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: var(--line-height-title);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--highlight-color); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.5em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { background: #7de063; }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { border-color: var(--text-primary); }

/* 卡片与面板 */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.panel .card-light-on-dark {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 300px;
}
th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
th { font-weight: 600; }
td:last-child { text-align: right; }

/* 定义列表 */
dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5em 1.5em; margin-bottom: 1em; }
dt { font-weight: 600; color: var(--highlight-color); }
dd { margin-bottom: 0.5em; }

/* FAQ */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--bg-surface);
}
summary {
  padding: 1em 1.25em;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.25rem;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
details .faq-content { padding: 0 1.25em 1em; color: var(--text-secondary); }

/* 新闻卡片 */
.news-card { display: flex; flex-direction: column; gap: 0.5em; }
.news-date { font-size: 0.85rem; color: var(--text-secondary); }

/* 页头页脚 */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.75em; font-weight: 700; color: var(--text-primary); }
.brand img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5em; }
.nav a { color: var(--text-primary); font-weight: 500; }
.nav a:hover { color: var(--highlight-color); }
.footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 3rem 0;
  margin-top: var(--section-y);
}
.footer-inner { display: flex; flex-direction: column; gap: 1.5em; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 1.5em; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--color-paper); opacity: 0.8; }
.footer-links a:hover { opacity: 1; }

/* SVG 动效 Keyframes */
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes draw-path {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes slide-in-right {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

.anim-float { animation: float-y 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-delay { animation: float-y 6s ease-in-out 1.5s infinite; transform-box: fill-box; transform-origin: center; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-path 3s ease forwards; }
.anim-pulse { animation: pulse-opacity 4s ease-in-out infinite; }
.anim-slide { animation: slide-in-right 0.8s ease forwards; }

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  .anim-float, .anim-float-delay, .anim-draw, .anim-pulse, .anim-slide {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.75em 0; }
  .nav { order: 3; width: 100%; justify-content: center; padding-top: 0.5em; }
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
  .grid-2 { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; }
}
