/* =========================================
   SafeW 全站共享样式
   Tokens & Design System
   ========================================= */
:root {
  /* 色板 */
  --bg-dark: #271334;
  --bg-paper: #E9E8EA;
  --text-body: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;

  /* 结构 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;

  /* 排版 Token */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --lh-tight: 1.15;
  --lh-normal: 1.55;
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 17px;
  line-height: var(--lh-normal);
  color: var(--text-body);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 容器与网格 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.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; }

/* 排版层级 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.badge::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
}
.paper-theme .badge { color: var(--color-brand); }
.paper-theme .badge::before { background: var(--color-brand); }
.dark-theme .badge { color: var(--color-accent); }
.dark-theme .badge::before { background: var(--color-accent); }

h1, h2, h3 { font-weight: 500; line-height: var(--lh-tight); margin: 0 0 0.8rem; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin-top: 0.5rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-top: 0.4rem; }
p { margin: 0 0 1rem; max-width: 38em; }
strong { font-weight: 600; }
.text-muted { opacity: 0.8; }

/* 深色主题下文字对比度增强 */
.dark-theme h1 { color: #FFFFFF !important; }
.dark-theme .text-muted { color: rgba(233, 232, 234, 0.9) !important; }

/* 主题覆盖 */
.dark-theme {
  --bg-surface: var(--bg-dark);
  --text-primary: var(--bg-paper);
  --text-secondary: rgba(233, 232, 234, 0.85);
  --accent-color: var(--color-accent);
  --link-color: var(--color-accent);
}
.paper-theme {
  --bg-surface: var(--bg-paper);
  --text-primary: var(--text-body);
  --text-secondary: #5A5260;
  --accent-color: var(--color-brand);
  --link-color: var(--color-brand);
}
.paper-card {
  --bg-surface: #FFFFFF;
  --text-primary: var(--text-body);
  --text-secondary: #5A5260;
  --accent-color: var(--color-brand);
  --link-color: var(--color-brand);
  border-radius: var(--radius-card);
  padding: var(--gap);
  background: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease;
  border: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--bg-dark);
}
.btn-primary:hover { filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid currentColor;
}
.btn-secondary:hover { background: rgba(0,0,0,0.04); }
.dark-theme .btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--text-primary); }
.dark-theme .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* 卡片与面板 */
.card-panel {
  border-radius: var(--radius-card);
  padding: var(--gap);
  background: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.hero-visual {
  position: relative;
  border-radius: var(--radius-card);
  background: var(--bg-dark);
  padding: 24px;
  aspect-ratio: 4/3;
  overflow: hidden;
}

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.08); }
.dark-theme .data-table th, .dark-theme .data-table td { border-bottom-color: rgba(255,255,255,0.1); }
.data-table th { font-weight: 600; width: 35%; }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ */
details { margin-bottom: 1rem; border-radius: var(--radius-card); background: var(--bg-surface); border: var(--card-border); }
summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 40px;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: transform 0.2s;
}
details[open] summary::after { content: "−"; transform: translateY(-50%) rotate(180deg); }
.details-content { padding: 0 20px 16px; line-height: 1.6; }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 12px 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 28px; width: auto; }
nav ul { display: flex; gap: 24px; }
nav a { font-weight: 500; font-size: 0.95rem; position: relative; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
nav a[aria-current="page"]::after { content: ""; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--color-brand); }
.site-footer { background: var(--bg-dark); color: var(--bg-paper); padding: 48px 0 24px; margin-top: 48px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
.footer-col h4 { color: var(--color-accent); margin: 0 0 12px; font-size: 0.95rem; }
.footer-col a { display: block; color: rgba(233,232,234,0.8); margin-bottom: 8px; font-size: 0.9rem; }
.footer-col a:hover { color: var(--color-accent); }
.copyright { text-align: center; margin-top: 32px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; color: rgba(233,232,234,0.6); }

/* SVG 动效基础 */
.svg-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.animated-svg { width: 100%; height: auto; }
svg.animated-svg path, svg.animated-svg rect, svg.animated-svg circle, svg.animated-svg line { transition: all 0.3s ease; }

/* 关键帧定义 */
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes blink-dot {
  0%, 100% { opacity: 0.3; r: 2; }
  50% { opacity: 1; r: 3.5; }
}

/* 动效类绑定 */
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate; }
.anim-float { animation: float-y 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse-opacity 3s ease-in-out infinite; }
.anim-slide { animation: slide-in-right 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; }
.anim-blink { animation: blink-dot 2.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* 减少动态效果 */
@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;
    transition: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 12px; }
  nav ul { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .hero-layout { grid-template-columns: 1fr; }
  .scenario-layout { grid-template-columns: 1fr; }
  .feature-group { grid-template-columns: 1fr; }
  p { max-width: 100%; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
