/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --bg-dark: #140E25;
  --bg-paper: #FCFCFD;
  --bg-paper-light: #F4F4F6;
  --text-body: #191523;
  --brand: #5214EB;
  --accent: #6EEDD2;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --lh-body: 1.65;
  --heading-lh: 1.1;
  --heading-letter: -0.02em;
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  background: var(--bg-paper);
  color: var(--text-body);
  line-height: var(--lh-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 页面背景与取色上下文 */
.dark-surface {
  --fg: var(--bg-paper);
  --hl: var(--accent);
  --bg: var(--bg-dark);
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}
.paper-surface {
  --fg: var(--text-body);
  --hl: var(--brand);
  --bg: var(--bg-paper);
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}
.paper-light-surface {
  --fg: var(--text-body);
  --hl: var(--brand);
  --bg: var(--bg-paper-light);
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}
.paper-card {
  --fg: var(--text-body);
  --hl: var(--brand);
  --bg: var(--bg-paper);
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

/* 区块通用 */
.section {
  padding-block: var(--section-y);
}
.section-header {
  margin-bottom: var(--gap);
}
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--hl);
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: var(--heading-lh);
  letter-spacing: var(--heading-letter);
  margin-bottom: var(--gap);
}
.section-title .hl { color: var(--hl); }
.section-desc {
  max-width: 38em;
  font-size: 1.05rem;
  line-height: var(--lh-body);
  opacity: 0.9;
}

/* 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding-inline: 1.25rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid currentColor;
}
.btn-secondary:hover { background: rgba(128,128,128,0.1); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 网格与布局 */
.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; }
.text-left { text-align: left; }
.text-center { text-align: center; }

/* 卡片 */
.card {
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  background: var(--bg);
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(128,128,128,0.2);
}
.data-table th { font-weight: 700; }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ / Details */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  background: var(--bg);
  overflow: hidden;
}
summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--hl);
}
details[open] summary::after { content: "-"; }
.details-content { padding: 0 1rem 1rem; line-height: var(--lh-body); opacity: 0.9; }

/* 页头与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252,252,253,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dark-surface .site-header { background: rgba(20,14,37,0.9); border-bottom-color: rgba(255,255,255,0.05); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-size: 0.9rem; font-weight: 500; opacity: 0.8; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--hl); }
.nav-actions { display: flex; gap: 0.75rem; align-items: center; }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; }

.site-footer {
  padding-block: 3rem;
  border-top: 1px solid rgba(128,128,128,0.15);
  font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: 2rem; }
.footer-col h4 { font-weight: 700; margin-bottom: 0.75rem; color: var(--hl); }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col ul li a:hover { color: var(--hl); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; opacity: 0.7; font-size: 0.8rem; }

/* 响应式 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column-reverse !important; }
  .scenario-layout { flex-direction: column !important; }
}

/* =========================================
   SVG 动效
   ========================================= */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.svg-panel path, .svg-panel circle, .svg-panel rect, .svg-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s;
}

/* 卡片层叠漂浮 */
@keyframes float-layer {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-float { animation: float-layer 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-delay { animation: float-layer 5s ease-in-out infinite 1.5s; transform-box: fill-box; transform-origin: center; }
.anim-float-slow { animation: float-layer 6s ease-in-out infinite 0.5s; transform-box: fill-box; transform-origin: center; }

/* 消息气泡呼吸 */
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-breathe-delay { animation: breathe 3s ease-in-out infinite 1s; }
.anim-breathe-slow { animation: breathe 3s ease-in-out infinite 2s; }

/* 连线流动 */
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
.anim-draw { animation: dash-flow 4s linear infinite; }

/* 减少动态效果 */
@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;
  }
}
