/* ============================================
   SafeW — 全局共享样式
   ============================================ */

/* ---------- 设计变量 ---------- */
:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-body: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;

  /* 结构 token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  /* 取色（纸面默认） */
  --text-primary: var(--color-body);
  --text-secondary: var(--color-body);
  --link-color: var(--color-brand);
  --eyebrow-color: var(--color-brand);
  --accent-on-dark: var(--color-accent);
  --bg-main: var(--color-paper);
  --bg-dark: var(--color-dark);
  --border-color: rgba(31, 21, 35, 0.16);
}

/* 深色面覆盖 */
.surface-dark {
  --text-primary: var(--color-paper);
  --text-secondary: var(--color-paper);
  --link-color: var(--color-accent);
  --eyebrow-color: var(--color-accent);
  --accent-on-dark: var(--color-accent);
  --bg-main: var(--color-dark);
  --border-color: rgba(245, 240, 229, 0.12);
}

/* 深色面内的浅色卡片恢复纸面取色 */
.surface-dark .card-light {
  --text-primary: var(--color-body);
  --text-secondary: var(--color-body);
  --link-color: var(--color-brand);
  --eyebrow-color: var(--color-brand);
  --accent-on-dark: var(--color-accent);
  --bg-main: var(--color-paper);
  --border-color: rgba(31, 21, 35, 0.16);
}

/* ---------- 基础排版 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-main);
  overflow-x: hidden;
}

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.8; }
a:focus-visible { outline: 2px solid var(--link-color); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 2.8vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }

p { max-width: 38em; }

::selection { background: var(--color-brand); color: #fff; }

/* ---------- 容器 ---------- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ---------- 眉标 ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eyebrow-color);
  margin-bottom: var(--gap);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  background: currentColor;
}

/* ---------- 高亮词 ---------- */
.hl {
  color: var(--color-brand);
  font-weight: 700;
}
.surface-dark .hl {
  color: var(--color-accent);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s, background-color 0.2s, opacity 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background: #d45aa8; }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
}
.surface-dark .btn-outline {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-outline:hover { opacity: 0.85; }

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  transition: box-shadow 0.3s;
}
.site-header.scrolled { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}
.site-logo img { width: 28px; height: 28px; }

.nav { display: flex; align-items: center; gap: 24px; }
.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
  position: relative;
}
.nav a:hover { color: var(--text-primary); }
.nav a[aria-current="page"] { color: var(--link-color); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--link-color);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
}

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); }
.footer-copy { margin-top: 16px; font-size: 0.8rem; }

/* ---------- 区块通用 ---------- */
.section {
  padding: var(--section-y) 0;
}
.section-dark {
  background: var(--color-dark);
  color: var(--color-paper);
}
.section-light {
  background: var(--color-paper);
}
.section-head {
  margin-bottom: var(--gap);
}
.section-desc {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 44em;
  margin-top: var(--gap);
  color: var(--text-secondary);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-main);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
}

/* ---------- 网格 ---------- */
.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);
}

/* ---------- 图文交错行 ---------- */
.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.split-row.reverse .split-text { order: 2; }
.split-row.reverse .split-visual { order: 1; }

.visual-panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 280px;
}
.visual-panel svg { width: 100%; height: 100%; }

/* ---------- 表格 ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  font-weight: 600;
  color: var(--text-primary);
  width: 40%;
}
.data-table tr:last-child td { border-bottom: none; }

/* ---------- 定义列表 ---------- */
.def-list {
  display: grid;
  gap: var(--gap);
}
.def-item dt {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.def-item dd {
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ---------- FAQ ---------- */
.faq-list {
  display: grid;
  gap: 12px;
}
.faq-item details {
  border: var(--card-border);
  background: var(--bg-main);
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-secondary);
  transition: transform 0.2s;
}
.faq-item details[open] summary::after {
  content: "−";
}
.faq-item summary:hover { background: rgba(0,0,0,0.02); }
.faq-item .faq-answer {
  padding: 0 20px 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---------- 步骤条 ---------- */
.steps-bar {
  display: flex;
  gap: 0;
  counter-reset: step;
}
.step-item {
  flex: 1;
  counter-increment: step;
  position: relative;
  padding: 24px 20px 24px 56px;
  border-right: 1px solid var(--border-color);
}
.step-item:last-child { border-right: none; }
.step-item::before {
  content: "0" counter(step);
  position: absolute;
  left: 16px;
  top: 24px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-dark);
  font-size: 0.8rem;
  font-weight: 700;
}
.step-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---------- 新闻卡片 ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}
.news-card {
  border: var(--card-border);
  background: var(--bg-main);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.news-card time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.news-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.news-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

/* ---------- 提示框 ---------- */
.callout {
  border-left: 3px solid var(--color-brand);
  padding: 12px 16px;
  margin: 16px 0;
  background: rgba(155, 18, 216, 0.04);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.surface-dark .callout {
  border-left-color: var(--color-accent);
  background: rgba(237, 110, 192, 0.08);
}

/* ---------- SVG 动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 卡片层叠漂浮 */
@keyframes card-float-1 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes card-float-2 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes card-float-3 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes card-float-4 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.anim-float-1 { animation: card-float-1 6s ease-in-out infinite; }
.anim-float-2 { animation: card-float-2 8s ease-in-out infinite; }
.anim-float-3 { animation: card-float-3 5s ease-in-out infinite; }
.anim-float-4 { animation: card-float-4 7s ease-in-out infinite; }

/* 气泡依次浮现后轻微漂浮 */
@keyframes bubble-in {
  0%, 100% { opacity: 0.3; transform: translateY(4px); }
  10%, 90% { opacity: 1; transform: translateY(0); }
}
.bubble-anim-1 { animation: bubble-in 5s ease-in-out 0s infinite; }
.bubble-anim-2 { animation: bubble-in 5s ease-in-out 0.8s infinite; }
.bubble-anim-3 { animation: bubble-in 5s ease-in-out 1.6s infinite; }

/* 输入三点呼吸 */
@keyframes dot-breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.dot-1 { animation: dot-breathe 2s ease-in-out 0s infinite; }
.dot-2 { animation: dot-breathe 2s ease-in-out 0.3s infinite; }
.dot-3 { animation: dot-breathe 2s ease-in-out 0.6s infinite; }

/* 通知卡片滑入 */
@keyframes slide-in-right {
  0%, 100% { transform: translateX(0); opacity: 1; }
  15% { transform: translateX(8px); opacity: 0.7; }
  25% { transform: translateX(0); opacity: 1; }
}
.slide-in-anim { animation: slide-in-right 6s ease-in-out 2s infinite; }

/* 连接线流动 */
@keyframes dash-flow {
  to { stroke-dashoffset: -1; }
}
.flow-line {
  stroke-dasharray: 1;
  animation: dash-flow 3s linear infinite;
}

/* 设置面板元素呼吸 */
@keyframes panel-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.panel-glow-anim { animation: panel-glow 4s ease-in-out infinite; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .split-row {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .split-row.reverse .split-text { order: 1; }
  .split-row.reverse .split-visual { order: 2; }
}

@media (max-width: 640px) {
  .nav { display: none; }
  .mobile-toggle { display: block; }
  .steps-bar { flex-direction: column; }
  .step-item { border-right: none; border-bottom: 1px solid var(--border-color); }
  .step-item:last-child { border-bottom: none; }
  .footer-inner { flex-direction: column; }
  .btn-group { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

/* 长文本溢出处理 */
.long-text { overflow-wrap: anywhere; }
.flex-narrow { min-width: 0; }
