/* === SafeW 全局样式 === */

/* --- 色板与变量 --- */
:root {
  /* 背景层 */
  --bg-dark: #2D1438;
  --bg-paper: #F6F3F7;
  
  /* 文字层 */
  --text-on-paper: #1F1523;
  --text-on-dark: #F6F3F7;
  
  /* 品牌色 */
  --brand: #9E13DD;
  
  /* 强调色 */
  --accent: #6EEDA8;
  
  /* 圆角 */
  --radius-card: 20px;
  --radius-btn: 12px;
  
  /* 卡片边界 */
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  
  /* 节奏 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  
  /* 最大宽度 */
  --content-max: 1120px;
  
  /* 字体 */
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

/* --- 深色面取色 --- */
.dark-surface {
  --text-primary: var(--text-on-dark);
  --text-secondary: rgba(246, 243, 247, 0.75);
  --brand-color: var(--accent);
  --accent-color: var(--accent);
  --link-color: var(--accent);
  --icon-color: var(--accent);
  --badge-color: var(--accent);
}

/* --- 浅色纸面取色（默认） --- */
.paper-surface {
  --text-primary: var(--text-on-paper);
  --text-secondary: rgba(31, 21, 35, 0.65);
  --brand-color: var(--brand);
  --accent-color: var(--brand);
  --link-color: var(--brand);
  --icon-color: var(--brand);
  --badge-color: var(--brand);
}

/* --- 卡片内恢复纸面取色 --- */
.card-light-on-dark {
  --text-primary: var(--text-on-paper);
  --text-secondary: rgba(31, 21, 35, 0.65);
  --brand-color: var(--brand);
  --accent-color: var(--brand);
  --link-color: var(--brand);
  --icon-color: var(--brand);
  --badge-color: var(--brand);
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-on-paper);
  background: var(--bg-paper);
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }

/* --- 容器 --- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- 区块通用 --- */
.section {
  padding: var(--section-y) 0;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 38em;
  margin-bottom: 32px;
}

/* 高亮词 */
.hl {
  font-weight: 800;
}

.paper-surface .hl { color: var(--brand); }
.dark-surface .hl { color: var(--accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid currentColor;
  color: inherit;
}

.paper-surface .btn-secondary {
  border-color: var(--text-on-paper);
  color: var(--text-on-paper);
}

.dark-surface .btn-secondary {
  border-color: var(--text-on-dark);
  color: var(--text-on-dark);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  opacity: 0.85;
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- 卡片 --- */
.card {
  background: var(--bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 28px;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}

th {
  font-weight: 700;
  background: rgba(31, 21, 35, 0.04);
}

td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child th,
tr:last-child td {
  border-bottom: none;
}

/* --- FAQ --- */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-item summary {
  padding: 20px 24px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background-color 0.2s;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::marker { display: none; content: ""; }

.faq-item summary:hover {
  background: rgba(31, 21, 35, 0.03);
}

.faq-item[open] summary {
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}

.faq-answer {
  padding: 20px 24px;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.faq-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--brand-color);
}

/* --- 提示框 --- */
.callout {
  border-left: 3px solid var(--brand-color);
  padding: 16px 20px;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  margin: 24px 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: rgba(158, 19, 221, 0.04);
}

/* --- 页头 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.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);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.header-brand img {
  height: 32px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.header-nav a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.2s;
  position: relative;
}

.header-nav a:hover,
.header-nav a[aria-current="page"] {
  color: var(--text-primary);
}

.header-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-color);
  border-radius: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- 页脚 --- */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 48px 0 32px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  color: var(--accent);
}

.footer-col a {
  display: block;
  font-size: 0.9rem;
  color: rgba(246, 243, 247, 0.65);
  padding: 4px 0;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid rgba(246, 243, 247, 0.1);
  padding-top: 24px;
  font-size: 0.85rem;
  color: rgba(246, 243, 247, 0.45);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* --- 响应式导航折叠 --- */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  
  .header-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-paper);
    flex-direction: column;
    padding: 20px var(--gap);
    border-bottom: 1px solid rgba(31, 21, 35, 0.08);
    gap: 16px;
  }
  
  .header-nav.open { display: flex; }
  
  .header-actions .btn { display: none; }
}

/* ========================================
   SVG 动效 — @keyframes 与工具类
   ======================================== */

/* 网格节点依次点亮 */
@keyframes gridNodePulse {
  0%, 100% { stroke-dashoffset: 1; opacity: 0.3; }
  15% { stroke-dashoffset: 1; opacity: 1; }
  30% { stroke-dashoffset: 0.6; opacity: 0.6; }
  45% { stroke-dashoffset: 1; opacity: 0.3; }
}

.grid-node {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.grid-node.animate {
  animation: gridNodePulse 6s ease-in-out infinite;
}

.grid-node:nth-child(1) { animation-delay: 0s; }
.grid-node:nth-child(2) { animation-delay: 0.5s; }
.grid-node:nth-child(3) { animation-delay: 1s; }
.grid-node:nth-child(4) { animation-delay: 1.5s; }
.grid-node:nth-child(5) { animation-delay: 2s; }
.grid-node:nth-child(6) { animation-delay: 2.5s; }
.grid-node:nth-child(7) { animation-delay: 3s; }
.grid-node:nth-child(8) { animation-delay: 3.5s; }
.grid-node:nth-child(9) { animation-delay: 4s; }

/* 连接线流动 */
@keyframes flowLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1; }
}

.flow-line {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.flow-line.animate {
  animation: flowLine 3s linear infinite;
}

/* 气泡浮现后漂浮 */
@keyframes bubbleIn {
  0% { opacity: 0; transform: translateY(12px); }
  20% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

.bubble-in {
  opacity: 1;
  transform: translateY(0);
}

.bubble-in.animate {
  animation: bubbleIn 5s ease-in-out infinite;
}

.bubble-in:nth-child(odd) { animation-duration: 6s; }

/* 呼吸点 */
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.breathe-dot {
  animation: breathe 2s ease-in-out infinite;
}

.breathe-dot:nth-child(2) { animation-delay: 0.3s; }
.breathe-dot:nth-child(3) { animation-delay: 0.6s; }

/* 通知卡片滑入 */
@keyframes slideIn {
  0% { opacity: 0; transform: translateX(20px); }
  15% { opacity: 1; transform: translateX(0); }
  85% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-10px); }
}

.slide-in {
  opacity: 1;
  transform: translateX(0);
}

.slide-in.animate {
  animation: slideIn 7s ease-in-out infinite;
}

/* 时间轴绘制 */
@keyframes drawAxis {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

.draw-axis {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.draw-axis.animate {
  animation: drawAxis 4s ease-out forwards;
}

/* 面板浮动 */
@keyframes panelFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.panel-float {
  animation: panelFloat 6s ease-in-out infinite;
}

.panel-float-delayed {
  animation: panelFloat 6s ease-in-out infinite;
  animation-delay: 1.5s;
}

/* 缩放旋转（需要 transform-box） */
.rotate-center {
  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;
  }
  
  .grid-node.animate,
  .flow-line.animate,
  .bubble-in.animate,
  .slide-in.animate,
  .draw-axis.animate,
  .panel-float,
  .panel-float-delayed {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- 辅助类 --- */
.text-center { text-align: center; }
.mt-sm { margin-top: 16px; }
.mt-md { margin-top: 32px; }
.mt-lg { margin-top: 48px; }
.mb-sm { margin-bottom: 16px; }
.mb-md { margin-bottom: 32px; }

.flex-row {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}

.gap-sm { gap: 12px; }
.gap-md { gap: 24px; }
.gap-lg { gap: 32px; }

/* --- 步骤条 --- */
.steps-container {
  display: flex;
  gap: 24px;
  counter-reset: step-counter;
}

.step-item {
  flex: 1;
  min-width: 0;
  counter-increment: step-counter;
  position: relative;
  padding-top: 48px;
}

.step-number {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: var(--bg-dark);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.step-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- 胶囊标签 --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(158, 19, 221, 0.08);
  color: var(--brand);
}

/* --- 两列布局 --- */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

/* --- 新闻卡片 --- */
.news-card {
  background: var(--bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s ease;
}

.news-card:hover {
  transform: translateY(-2px);
}

.news-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.news-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
}

.news-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- 时间轴 --- */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--brand-color);
  opacity: 0.2;
}

.timeline-item {
  position: relative;
  padding-bottom: 32px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -40px;
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-paper);
  border: 2px solid var(--brand-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-color);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.timeline-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.timeline-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- 特性列表 --- */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.feature-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-color);
  flex-shrink: 0;
  margin-top: 9px;
}

/* --- 焦点可见 --- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- 响应式调整 --- */
@media (max-width: 768px) {
  .flex-row {
    flex-direction: column;
  }
  
  .steps-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .step-item {
    padding-top: 0;
  }
  
  .step-number {
    position: static;
    margin-bottom: 12px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  :root {
    --section-y: clamp(3.5rem, 12vw, 6rem);
    --gap: clamp(1rem, 4vw, 1.5rem);
  }
  
  .card {
    padding: 20px;
  }
}
