/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-light-paper: #F4F3F5;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  /* 字体与排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --line-height-base: 1.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--color-body);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   布局容器与分节
   ========================================= */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

section {
  padding-block: var(--section-y);
  position: relative;
}

.bg-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .eyebrow { color: var(--color-accent); }
.bg-dark .link-accent { color: var(--color-accent); }

.bg-paper {
  background: var(--color-paper);
  color: var(--color-body);
}

.bg-light-paper {
  background: var(--color-light-paper);
  color: var(--color-body);
}

/* 深色区块内的浅色卡片恢复纸面取色 */
.theme-card {
  background: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* =========================================
   排版系统
   ========================================= */
.h1-hero {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin-bottom: var(--gap);
}

.h2-section {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin-bottom: var(--gap);
}

.h3-sub {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  margin-bottom: calc(var(--gap) * 0.5);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: calc(var(--gap) * 0.5);
  color: var(--color-brand);
}

.hl {
  font-weight: 800;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* =========================================
   组件：按钮
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding-inline: 20px;
  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;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); background: #e0855f; }
.btn-primary:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

.btn-secondary {
  background: transparent;
  color: var(--color-body);
  border-color: var(--color-body);
}
.bg-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-secondary:hover { transform: translateY(-2px); opacity: 0.85; }
.btn-secondary:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }

/* =========================================
   组件：卡片网格
   ========================================= */
.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);
}

.card {
  background: var(--color-paper);
  color: var(--color-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
}

/* =========================================
   组件：表格
   ========================================= */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: var(--card-border);
  background: var(--color-paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

th {
  font-weight: 700;
  background: rgba(25, 21, 35, 0.04);
}

td:first-child { font-weight: 600; }

/* =========================================
   组件：FAQ
   ========================================= */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

details {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: background 0.2s;
}

summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
  flex-shrink: 0;
}

details[open] summary::before {
  background: currentColor;
}

details p {
  margin-top: var(--gap);
  color: rgba(25, 21, 35, 0.8);
}

/* =========================================
   组件：页头与页脚
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  padding: 12px 0;
}

.bg-dark ~ .site-header,
.section-dark .site-header {
  background: rgba(33, 22, 60, 0.95);
  border-bottom-color: rgba(233, 232, 234, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.logo-wrap img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-links a {
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}

.bg-dark .nav-links a { color: var(--color-paper); }
.bg-dark .nav-links a:hover,
.bg-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding: 32px 0;
  border-top: 1px solid rgba(25, 21, 35, 0.1);
  font-size: 0.9rem;
  opacity: 0.9;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================================
   时间轴组件
   ========================================= */
.timeline {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid currentColor;
  opacity: 0.6;
  margin-left: 8px;
}

.timeline-item {
  position: relative;
  margin-bottom: var(--gap);
  padding-bottom: var(--gap);
  border-bottom: 1px dashed rgba(25, 21, 35, 0.15);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -39px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 3px solid var(--color-paper);
  box-shadow: 0 0 0 2px var(--color-brand);
}

.bg-dark .timeline-item::before {
  background: var(--color-accent);
  border-color: var(--color-dark);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.time-tag {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 8px;
  background: rgba(25, 21, 35, 0.06);
  border-radius: 6px;
  margin-bottom: 8px;
}

.bg-dark .time-tag {
  background: rgba(233, 232, 234, 0.1);
  color: var(--color-accent);
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: hidden;
}

.svg-container svg {
  width: 100%;
  height: auto;
}

/* 描边绘制动画 */
.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawStroke 6s ease-in-out infinite;
}

@keyframes drawStroke {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}

/* 网格节点依次点亮 */
.node {
  animation: nodePulse 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.node:nth-child(1) { animation-delay: 0s; }
.node:nth-child(2) { animation-delay: 0.5s; }
.node:nth-child(3) { animation-delay: 1s; }
.node:nth-child(4) { animation-delay: 1.5s; }
.node:nth-child(5) { animation-delay: 2s; }
.node:nth-child(6) { animation-delay: 2.5s; }

@keyframes nodePulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* 气泡浮动 */
.bubble {
  animation: floatBubble 6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.bubble:nth-child(odd) { animation-delay: 0.2s; }
.bubble:nth-child(even) { animation-delay: 0.8s; }

@keyframes floatBubble {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-6px); opacity: 1; }
}

/* 呼吸点 */
.breath-dot {
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 减少动态效果 */
@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;
  }
}

/* =========================================
   响应式适配
   ========================================= */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1, h2 { text-wrap: balance; }
  .hero-layout { flex-direction: column; }
}
