/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 布局与节奏 */
  --content-max: 1280px;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --container-pad: 1.5rem;

  /* 圆角与边界 */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  /* 排版 */
  --font-main: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --lh-body: 1.65;
  --lh-heading: 1.1;
  --ls-heading: -0.02em;

  /* 默认取色变量（纸面模式） */
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(25, 21, 35, 0.7);
  --link-color: var(--color-brand);
  --accent-color: var(--color-brand);
}

/* 深色面覆盖 */
.bg-dark {
  --bg-surface: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(244, 243, 247, 0.75);
  --link-color: var(--color-accent);
  --accent-color: var(--color-accent);
}

/* 深色面内的浅色卡片恢复纸面取色 */
.card-light {
  --bg-surface: var(--color-paper);
  --text-primary: var(--color-text);
  --text-secondary: rgba(25, 21, 35, 0.7);
  --link-color: var(--color-brand);
  --accent-color: var(--color-brand);
  border-color: var(--color-text);
  background: var(--color-paper);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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; }
button, [role="button"] { cursor: pointer; font-family: inherit; }

/* 容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(128,128,128,0.15);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--text-secondary); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--link-color); }
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent-color);
  color: var(--color-dark);
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: none;
  font-size: 0.95rem;
  transition: transform 0.2s, filter 0.2s;
}
.header-cta:hover { transform: translateY(-1px); filter: brightness(1.05); }
.header-cta:focus-visible { outline: 3px solid var(--link-color); outline-offset: 2px; }

/* 页脚 */
.site-footer {
  padding: 48px 0 32px;
  border-top: 1px solid rgba(128,128,128,0.2);
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-secondary); font-size: 0.9rem; }
.footer-copy { text-align: center; color: var(--text-secondary); font-size: 0.85rem; }

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  border: 2px solid transparent;
  transition: transform 0.2s, filter 0.2s, background 0.2s, color 0.2s;
}
.btn:focus-visible { outline: 3px solid var(--link-color); outline-offset: 2px; }
.btn-primary {
  background: var(--accent-color);
  color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(128,128,128,0.08); }
.icon-svg { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.8; fill: none; }

/* 眉标 */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--link-color);
  margin-bottom: 12px;
  padding: 4px 12px;
  background: rgba(128,128,128,0.08);
  border-radius: 99px;
}

/* 标题系统 */
h1, h2, h3, h4 { line-height: var(--lh-heading); letter-spacing: var(--ls-heading); font-weight: 800; color: var(--text-primary); }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 16px; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 24px; }
h3 { font-size: 1.25rem; margin-bottom: 12px; }
.section-desc { color: var(--text-secondary); font-size: 1.05rem; max-width: 65ch; margin-bottom: 32px; }
.hl { color: var(--link-color); }

/* 卡片 */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
.data-table th { font-weight: 600; color: var(--text-primary); width: 40%; }
.data-table td { color: var(--text-secondary); }

/* FAQ */
.faq-item { border-bottom: 1px solid rgba(128,128,128,0.2); margin-bottom: 16px; }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--link-color); transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { color: var(--text-secondary); margin-top: 8px; padding-bottom: 16px; line-height: 1.7; }

/* 步骤徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent-color);
  color: var(--color-dark);
  font-weight: 700;
  border-radius: 8px;
  margin-right: 12px;
  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); }

/* 响应式 */
@media (max-width: 960px) {
  .nav-links { display: none; } /* 简化移动端导航，实际项目可加汉堡菜单 */
  h1 { font-size: clamp(2rem, 8vw, 3.2rem); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .btn { width: 100%; }
}

/* =========================================
   SVG 动效 (CSS Keyframes)
   ========================================= */
/* 基础描边动画：pathLength="1" 的路径默认 stroke-dasharray:1; stroke-dashoffset:0 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.animate-draw {
  animation: drawStroke 4s ease-in-out infinite alternate;
}
@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  50%, 100% { stroke-dashoffset: 0; }
}

/* 卡片层叠漂浮 */
.float-layer { transform-box: fill-box; transform-origin: center; }
.anim-float-1 { animation: floatY 6s ease-in-out infinite alternate; }
.anim-float-2 { animation: floatY 7.5s ease-in-out infinite alternate-reverse; }
.anim-float-3 { animation: floatY 8s ease-in-out infinite alternate; }
@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-12px); }
}

/* 消息气泡浮现 */
.bubble-pop { transform-box: fill-box; transform-origin: center; }
.anim-bubble { animation: popIn 5s ease-in-out infinite alternate; }
@keyframes popIn {
  0%, 20% { transform: scale(0.95); opacity: 0.6; }
  40%, 80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.98); opacity: 0.85; }
}

/* 输入点呼吸 */
.dot-breathe { transform-box: fill-box; transform-origin: center; }
.anim-breathe { animation: breathe 3s ease-in-out infinite alternate; }
@keyframes breathe {
  0% { opacity: 0.4; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* 通知滑入 */
.slide-in { transform-box: fill-box; transform-origin: center; }
.anim-slide { animation: slideIn 8s ease-out infinite alternate; }
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  15%, 85% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(20px); opacity: 0; }
}

/* 连接线流动 */
.flow-line { stroke-dasharray: 8 4; animation: flowDash 2s linear infinite; }
@keyframes flowDash {
  to { stroke-dashoffset: -12; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-name: none !important;
    transition: none !important;
  }
}
