/* =========================================
   SafeW 全局样式与动效系统
   ========================================= */

:root {
  /* 基础色板 */
  --color-dark: #271334;
  --color-paper: #E9E8EA;
  --color-text: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;

  /* 上下文取色变量（默认纸面） */
  --ctx-text: var(--color-text);
  --ctx-brand: var(--color-brand);
  --ctx-accent: var(--color-accent);

  /* 结构与尺寸 */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--ctx-text);
  --card-shadow: 4px 4px 0 var(--ctx-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

/* 重置与基础 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--color-paper);
  color: var(--ctx-text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--ctx-brand); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.8; }
ul, ol { padding-left: 1.2em; margin: 0; }
li { margin-bottom: 0.5em; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section { padding-block: var(--section-y); }

/* 背景上下文切换 */
.bg-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.bg-dark .ctx-text { color: var(--color-paper); }
.bg-dark .ctx-brand { color: var(--color-accent); }
.bg-dark .ctx-accent { color: var(--color-accent); }
.bg-dark a { color: var(--color-accent); }
.bg-dark .hl { color: var(--color-accent); }

/* 浅色卡片在深色背景下的取色重置 */
.card-light {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}
.card-light a { color: var(--color-brand); }
.card-light .hl { color: var(--color-brand); }

/* 标题系统 */
h1, h2, h3, h4 { line-height: 1.15; font-weight: 500; margin-top: 0; margin-bottom: 0.8em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-block: 0.6em 0.4em; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-block: 0.5em 0.3em; }
p { margin-bottom: 1em; max-width: 38em; }
mark { background: transparent; color: inherit; font-weight: 600; }

/* 眉标 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6em;
  color: var(--ctx-brand);
}
.bg-dark .eyebrow { color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 1.5em;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border: none;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-secondary { background: transparent; border: 2px solid var(--ctx-text); color: var(--ctx-text); }
.bg-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn-secondary:hover { opacity: 0.85; transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }
.btn-icon { width: 20px; height: 20px; stroke-width: 2; }

/* 网格与图文交错 */
.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); }
.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) {
  .row-reverse { flex-direction: row-reverse; }
}

/* 表格 */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 0; table-layout: auto; }
th, td { padding: 0.8em 1em; text-align: left; border-bottom: 1px solid var(--ctx-text); word-break: break-all; overflow-wrap: anywhere; }
th { font-weight: 600; }
.bg-dark th, .bg-dark td { border-bottom-color: rgba(233, 232, 234, 0.2); }
td:first-child { font-weight: 600; white-space: nowrap; }

/* 步骤条 */
.steps-bar { display: flex; flex-wrap: wrap; gap: var(--gap); counter-reset: step; }
.step-item { flex: 1 1 200px; position: relative; padding-left: 3rem; }
.step-item::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute; left: 0; top: 0;
  width: 2.4rem; height: 2.4rem;
  background: var(--color-accent); color: var(--color-dark);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.bg-dark .step-item::before { background: var(--color-accent); color: var(--color-dark); }

/* FAQ */
details { margin-bottom: 1em; border: var(--card-border); border-radius: var(--radius-card); padding: 1em; background: var(--color-paper); }
.bg-dark details { background: rgba(233, 232, 234, 0.08); border-color: rgba(233, 232, 234, 0.2); }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5em; }
summary::-webkit-details-marker { display: none; }
summary::marker { display: none; }
details[open] summary { margin-bottom: 0.5em; }
details p { margin-top: 0.5em; margin-bottom: 0; }

/* 新闻卡片 */
.news-card { background: var(--color-paper); border: var(--card-border); border-radius: var(--radius-card); padding: 1.2em; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 0.6em; }
.news-card time { font-size: 0.8rem; color: var(--ctx-brand); font-weight: 600; }
.bg-dark .news-card { background: rgba(233, 232, 234, 0.05); border-color: rgba(233, 232, 234, 0.15); box-shadow: none; }
.bg-dark .news-card time { color: var(--color-accent); }

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(29, 21, 35, 0.1);
}
.bg-dark .site-header { background: rgba(39, 19, 52, 0.9); border-bottom-color: rgba(233, 232, 234, 0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo-img { height: 32px; width: auto; object-fit: contain; }
.nav-list { display: flex; gap: 1.5em; list-style: none; margin: 0; padding: 0; }
.nav-link { font-weight: 500; color: var(--ctx-text); }
.nav-link:hover { opacity: 0.7; }
.nav-link[aria-current="page"] { color: var(--ctx-brand); font-weight: 700; }
.bg-dark .nav-link { color: var(--color-paper); }
.bg-dark .nav-link[aria-current="page"] { color: var(--color-accent); }
.site-footer { padding-block: 2em; border-top: 1px solid rgba(29, 21, 35, 0.1); font-size: 0.9rem; }
.bg-dark .site-footer { border-top-color: rgba(233, 232, 234, 0.1); }
.footer-links { display: flex; gap: 1.5em; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--ctx-text); }
.bg-dark .footer-links a { color: var(--color-paper); }

/* =========================================
   SVG 动效系统
   ========================================= */
.ui-svg { width: 100%; height: auto; max-width: 100%; }
.svg-anim-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s ease-in-out infinite alternate;
}
@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.svg-anim-float {
  animation: floatBubbles 6s ease-in-out infinite alternate;
}
@keyframes floatBubbles {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}
.svg-anim-pulse {
  animation: pulseDot 3s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.svg-anim-slide {
  animation: slideCard 5s ease-in-out infinite alternate;
}
@keyframes slideCard {
  from { transform: translateX(-8px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}
.svg-anim-rotate {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinSlow 12s linear infinite;
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .svg-anim-line, .svg-anim-float, .svg-anim-pulse, .svg-anim-slide, .svg-anim-rotate {
    animation: none !important;
  }
}

/* 焦点可见性 */
*:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }
a:focus-visible { border-radius: 4px; }
