/* =========================================
   SafeW 全站共享样式 (Design Tokens & Base)
   ========================================= */

:root {
  /* 色板 */
  --color-dark-bg: #140E25;
  --color-paper-bg: #F7F5F3;
  --color-body-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 圆角与阴影 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);

  /* 节奏与间距 */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  /* 字体 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  line-height: 1.65;
  color: var(--color-body-text);
  background-color: var(--color-paper-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
svg { width: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
ul, ol { list-style: none; }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 颜色上下文类 */
.bg-dark {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
}
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .brand-link { color: var(--color-accent); }
.bg-paper {
  background-color: var(--color-paper-bg);
  color: var(--color-body-text);
}
.bg-paper .hl { color: var(--color-brand); }
.bg-paper .brand-link { color: var(--color-brand); }

/* 眉标与标题 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.bg-dark .section-label { color: var(--color-accent); }
.bg-paper .section-label { color: var(--color-brand); }

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }

/* 对比度修复：浅色卡片背景上的深色文字 */
.bg-paper .card h3,
.bg-paper .card p {
  color: var(--color-body-text);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  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;
  border: none;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(200, 237, 110, 0.25);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.bg-dark .btn-secondary { color: var(--color-paper-bg); }
.bg-paper .btn-secondary { color: var(--color-body-text); }
.btn-secondary:hover { background-color: rgba(128, 128, 128, 0.1); }

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* 卡片与面板 */
.card {
  background: var(--color-paper-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  border: var(--card-border) solid transparent;
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 12px 32px -12px rgba(25, 21, 35, 0.4); }

.panel {
  background-color: var(--color-dark-bg);
  border-radius: var(--radius-card);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  box-sizing: border-box;
  max-width: 100%;
  table-layout: fixed;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.data-table th { font-weight: 600; }
.bg-dark .data-table th { color: var(--color-paper-bg); }
.bg-dark .data-table td { color: var(--color-paper-bg); }

/* FAQ Details */
details {
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  padding: 1rem 0;
}
summary {
  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;
}
details[open] summary::after { content: "-"; }
details p { margin-top: 0.75rem; color: inherit; opacity: 0.9; }

/* 导航栏 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.bg-dark .header { background-color: rgba(20, 14, 37, 0.9); border-bottom-color: rgba(255,255,255,0.1); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.bg-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

/* 页脚 */
.footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* 网格布局辅助 */
.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); }

/* 响应式调整 */
@media (max-width: 768px) {
  .nav-links { display: none; } /* 简化移动端，实际项目可加汉堡菜单 */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* =========================================
   SVG 动效 (CSS Keyframes)
   ========================================= */

/* 卡片层叠漂浮 */
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes float-medium {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

.anim-float-1 { animation: float-slow 6s ease-in-out infinite; }
.anim-float-2 { animation: float-medium 5s ease-in-out infinite 0.5s; }
.anim-float-3 { animation: float-fast 7s ease-in-out infinite 1s; }

/* 描边绘制动画 */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 2s ease forwards;
}

/* 呼吸效果 */
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.anim-breathe { animation: breathe 3s ease-in-out infinite; }

/* 减少动态效果偏好 */
@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;
  }
}
