/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与 Token --- */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 默认取色（纸面模式） */
  --bg-color: var(--color-paper);
  --text-color: var(--color-body);
  --heading-color: var(--color-body);
  --link-color: var(--color-brand);
  --border-color: rgba(25, 21, 35, 0.12);

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.75;
}

/* 表面覆盖类：深色面 */
.surface-dark {
  --bg-color: var(--color-dark);
  --text-color: var(--color-paper);
  --heading-color: var(--color-paper);
  --link-color: var(--color-accent);
  --border-color: rgba(252, 252, 253, 0.15);
}

/* 表面覆盖类：浅色卡片（继承自深色容器时恢复纸面取色） */
.card-light {
  --bg-color: var(--color-paper);
  --text-color: var(--color-body);
  --heading-color: var(--color-body);
  --link-color: var(--color-brand);
  --border-color: rgba(25, 21, 35, 0.12);
}

/* --- 基础重置与全局 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--text-color);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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(--link-color); outline-offset: 3px; border-radius: 2px; }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
  border-bottom: 1px solid var(--border-color);
}
.section:last-child { border-bottom: none; }

/* --- 排版层级 --- */
.mark {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--link-color);
  margin-bottom: 0.5em;
}
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--heading-color);
  text-wrap: balance;
  margin-bottom: 1rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--heading-color);
  margin-bottom: calc(var(--gap) / 1.5);
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--heading-color);
  margin-bottom: 0.6em;
}
p { margin-bottom: 1em; max-width: 38em; }
strong { font-weight: 600; }

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding-inline: 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, box-shadow 0.2s ease;
  text-decoration: none;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  background-color: #5bdcc0;
}
.btn-secondary {
  background-color: transparent;
  color: var(--text-color);
  border: 2px solid var(--text-color);
}
.btn-secondary:hover {
  background-color: rgba(128, 128, 128, 0.08);
  transform: translateY(-1px);
}

/* --- 卡片与面板 --- */
.card {
  background-color: var(--bg-color);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* --- 表格 --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 0;
}
th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}
th { font-weight: 600; color: var(--heading-color); }
td { color: var(--text-color); overflow-wrap: anywhere; }
tr:last-child td { border-bottom: none; }

/* --- FAQ (Details/Summary) --- */
.faq-list { list-style: none; }
.faq-item {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}
.faq-item summary {
  padding: 1em 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2rem;
  color: var(--heading-color);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
}
.faq-item[open] summary::after { content: "-"; }
.faq-item p { margin-top: 0.5em; margin-bottom: 1.5em; color: var(--text-color); }

/* --- 页头与导航 --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  -webkit-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.6em;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--heading-color);
  text-decoration: none;
}
.brand img { height: 28px; width: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
  padding: 0.4em 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--link-color);
  border-bottom-color: var(--link-color);
}

/* --- 页脚 --- */
.footer {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.85;
}
.footer-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1em;
  flex-wrap: wrap;
}
.footer-nav a { color: var(--link-color); }

/* --- SVG 动效系统 --- */
.svg-grid-node {
  fill: var(--link-color);
  opacity: 0.2;
  transform: scale(0.8);
  transform-box: fill-box;
  transform-origin: center;
  animation: gridNodePulse 6s ease-in-out infinite;
  animation-delay: var(--delay);
}
@keyframes gridNodePulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.svg-bubble {
  fill: var(--link-color);
  opacity: 0;
  transform: translateY(8px);
  transform-box: fill-box;
  transform-origin: center;
  animation: bubbleFloat 5s ease-in-out infinite;
  animation-delay: var(--delay);
}
@keyframes bubbleFloat {
  0%, 100% { opacity: 0; transform: translateY(8px); }
  20%, 80% { opacity: 0.85; transform: translateY(0); }
}

.svg-draw-line {
  stroke: var(--link-color);
  stroke-width: 2;
  fill: none;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s linear infinite;
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; opacity: 0.3; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -1; opacity: 0.3; }
}

.hero-svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .nav { display: none; } /* 简化移动端头部，实际项目可加汉堡菜单 */
  h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
  .hero-layout { flex-direction: column; }
}

@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;
  }
  .svg-grid-node, .svg-bubble, .svg-draw-line {
    animation: none !important;
    opacity: 0.6;
    transform: scale(1);
  }
}
