/* SafeW 全站共享样式 */

:root {
  /* 色板 */
  --color-dark-bg: #1B1231;
  --color-paper: #F4F3F7;
  --color-paper-light: #E8E6ED; /* 浅一档纸面色，用于交替 */
  --color-text-main: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;
  
  /* 文字色继承逻辑 */
  --text-on-paper: var(--color-text-main);
  --text-on-dark: var(--color-paper);
  --highlight-on-paper: var(--color-brand);
  --highlight-on-dark: var(--color-accent);

  /* 设计 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  
  /* 字体 */
  --font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  
  /* 布局 */
  --header-height: 72px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-on-paper);
  background-color: var(--color-paper);
  overflow-x: hidden;
}

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 链接与文本 */
a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* 眉标 (Eyebrow) */
.eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--gap);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background-color: currentColor;
}

.paper-theme .eyebrow { color: var(--color-brand); }
.dark-theme .eyebrow { color: var(--color-accent); }

/* 标题 */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--section-y);
  position: relative;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.hl {
  color: var(--highlight-on-paper);
  font-weight: 800;
}

.dark-theme .hl {
  color: var(--highlight-on-dark);
}

/* 头部 */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(244, 243, 247, 0.9);
  backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.site-header.scrolled {
  border-bottom-color: rgba(0,0,0,0.05);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.logo img {
  height: 32px;
  width: auto;
  vertical-align: middle;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--color-brand);
}

.nav-links a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s, background-color 0.2s;
  border: none;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

.btn-primary:hover {
  background-color: #8A66DD;
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text-main);
  color: var(--color-text-main);
}

.dark-theme .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}

.btn-secondary:hover {
  background-color: rgba(0,0,0,0.05);
}

.dark-theme .btn-secondary:hover {
  background-color: rgba(255,255,255,0.1);
}

/* 区块通用 */
.section {
  padding: var(--section-y) 0;
  position: relative;
}

.paper-theme { background-color: var(--color-paper); color: var(--text-on-paper); }
.light-paper-theme { background-color: var(--color-paper-light); color: var(--text-on-paper); }
.dark-theme { background-color: var(--color-dark-bg); color: var(--text-on-dark); }

/* 卡片 */
.card {
  background-color: var(--color-paper);
  border-radius: var(--radius-card);
  padding: 24px;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

.dark-theme .card {
  background-color: rgba(255,255,255,0.05);
}

/* 网格布局 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--section-y);
  align-items: center;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .nav-links { display: none; } /* 简化：移动端隐藏导航，仅保留主按钮 */
}

/* 修复横向溢出：确保所有网格项不超出容器宽度 */
.grid-2 > *, .grid-3 > * {
  min-width: 0;
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
  background: var(--color-paper);
  padding: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
  font-weight: 700;
  color: var(--color-brand);
}

.dark-theme th {
  color: var(--color-accent);
}

/* FAQ Details */
details {
  border-bottom: 1px solid rgba(0,0,0,0.1);
  padding: 16px 0;
}

summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 24px;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 0;
  font-weight: 400;
}

details[open] summary::after {
  content: "-";
}

details p {
  margin-top: 12px;
  margin-left: 0;
  color: rgba(25, 21, 35, 0.8);
}

.dark-theme details p {
  color: rgba(244, 243, 247, 0.8);
}

/* SVG 动效基础 */
.svg-anim-container {
  width: 100%;
  overflow: hidden;
  position: relative;
}

svg {
  width: 100%;
  height: auto;
  display: block;
}

/* 数据点流动动画 */
.flow-dot {
  fill: var(--color-accent);
  animation: flowMove 4s linear infinite;
}

@keyframes flowMove {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}

/* 气泡浮现 */
.bubble-anim {
  opacity: 0;
  animation: bubbleIn 5s ease-in-out infinite;
}

.bubble-anim.delay-1 { animation-delay: 1s; }
.bubble-anim.delay-2 { animation-delay: 2s; }

@keyframes bubbleIn {
  0%, 10% { opacity: 0; transform: translateY(10px); }
  20%, 80% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; transform: translateY(-10px); }
}

/* 呼吸灯 */
.pulse-dot {
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 减少动态效果 */
@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;
  }
  .flow-dot, .bubble-anim, .pulse-dot {
    opacity: 1;
    transform: none;
    animation: none;
  }

  /* 修复横向溢出：禁止所有元素产生水平滚动条 */
  html, body { overflow-x: hidden; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
