/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #240F29;
  --color-paper: #F6F3F7;
  --color-text: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;
  --color-white: #FFFFFF;

  /* 结构与尺寸 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --header-h: 64px;

  /* 字体 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* 面层次变量覆盖 */
.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .brand-icon, .surface-dark .badge, .surface-dark .text-link { color: var(--color-accent); }

.surface-light {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.surface-light .hl { color: var(--color-brand); }
.surface-light .brand-icon, .surface-light .badge, .surface-light .text-link { color: var(--color-brand); }

/* 卡片在深色面上的取色修正 */
.surface-dark .card {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
  box-shadow: var(--card-shadow);
}
.surface-dark .card .hl { color: var(--color-brand); }
.surface-dark .card .brand-icon, .surface-dark .card .badge, .surface-dark .card .text-link { color: var(--color-brand); }

/* 容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 排版 */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; letter-spacing: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.lead { font-size: clamp(1rem, 1.5vw, 1.125rem); line-height: 1.7; margin-bottom: 2rem; max-width: 42em; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* 网格与布局 */
.grid-auto {
  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; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split-layout { display: flex; flex-wrap: wrap; gap: var(--gap); }
  .split-layout > .col-text { flex: 1 1 45%; min-width: 0; }
  .split-layout > .col-visual { flex: 1 1 50%; min-width: 0; }
}

/* 组件：卡片 */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  position: relative;
}

/* 组件：表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid currentColor;
}
.data-table th { font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }

/* 组件：FAQ */
details {
  border: var(--card-border);
  background-color: var(--color-paper);
  margin-bottom: 0.75rem;
}
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-size: 1.25rem;
  font-weight: 400;
}
details[open] summary::after { content: "-"; }
.details-content { padding: 0 1rem 1rem; line-height: 1.7; }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(32, 21, 35, 0.1);
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.surface-dark .site-header { background-color: var(--color-dark); border-bottom-color: rgba(246, 243, 247, 0.1); }
.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-img { height: 32px; width: auto; }
nav ul { display: flex; gap: 1.5rem; align-items: center; }
nav a { font-weight: 500; font-size: 0.95rem; }
nav a[aria-current="page"] { font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 1rem; }
@media (max-width: 640px) {
  nav ul { display: none; }
}

/* 页脚 */
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid currentColor;
  margin-top: var(--section-y);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-copy { font-size: 0.85rem; opacity: 0.8; }

/* SVG 动效基础 */
svg.svg-visual { width: 100%; height: auto; overflow: visible; }
svg.svg-visual path, svg.svg-visual circle, svg.svg-visual rect { vector-effect: non-scaling-stroke; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 3s ease-in-out infinite; }
.anim-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: flowPath 4s linear infinite; }
.anim-float { animation: floatBubble 5s ease-in-out infinite; }
.anim-pulse { animation: pulseDot 2.5s ease-in-out infinite; }
.anim-slide { animation: slideIn 4s ease-out infinite; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }

@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 1; }
}
@keyframes flowPath {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
@keyframes slideIn {
  0%, 10% { transform: translateX(-20px); opacity: 0; }
  15%, 85% { transform: translateX(0); opacity: 1; }
  90%, 100% { transform: translateX(20px); opacity: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 动效子元素变换中心 */
.anim-group { 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;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
