/* =========================================
   SafeW 共享样式表
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-dark: #1B1231;
  --color-paper: #DBD4ED;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-tight: 1.15;
  --lh-body: 1.75;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

/* --- 表面层取色覆盖 --- */
.surface-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.surface-paper .hl { color: var(--color-brand); }
.surface-paper .badge { color: var(--color-brand); }
.surface-paper a:not(.btn) { color: var(--color-brand); }

.surface-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .badge { color: var(--color-accent); }
.surface-dark a:not(.btn) { color: var(--color-accent); }

/* 深色面内的浅色卡片恢复纸面取色 */
.card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.card-light .hl { color: var(--color-brand); }
.card-light .badge { color: var(--color-brand); }
.card-light a:not(.btn) { color: var(--color-brand); }

/* --- 布局容器 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}
.section-splitter {
  border-bottom: 1px solid rgba(25, 21, 35, 0.12);
}

/* --- 排版 --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
h1, h2, h3 {
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 1.25rem;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1.5rem;
}
h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
p { margin-bottom: 1rem; max-width: 38em; }
.text-balance { text-wrap: balance; }

/* --- 组件：按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.surface-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }

/* --- 组件：卡片 --- */
.card {
  background: rgba(255, 255, 255, 0.4);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
}
.surface-dark .card { background: rgba(27, 18, 49, 0.6); }
.card-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* --- 组件：表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  max-width: 100%;
  table-layout: auto;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.data-table th { font-weight: 600; }
.surface-dark .data-table th, .surface-dark .data-table td { border-color: rgba(219, 212, 237, 0.15); }

/* --- 组件：FAQ --- */
details.faq-item {
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  transition: background-color 0.2s;
}
.surface-dark details.faq-item { border-color: rgba(219, 212, 237, 0.15); }
details.faq-item[open] { background: rgba(255, 255, 255, 0.5); }
.surface-dark details.faq-item[open] { background: rgba(27, 18, 49, 0.4); }
summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::marker { display: none; }
summary::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
details.faq-item[open] summary::before { transform: rotate(45deg); }
.faq-answer { margin-top: 0.75rem; line-height: 1.7; }

/* --- 组件：步骤编号 --- */
.step-list { counter-reset: step; list-style: none; }
.step-list li {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 1.5rem;
}
.step-list li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 2.5rem; height: 2.5rem;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(219, 212, 237, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.surface-dark .site-header { background: rgba(27, 18, 49, 0.9); border-color: rgba(219, 212, 237, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  text-decoration: none;
  font-weight: 500;
  color: inherit;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { border-bottom-color: currentColor; }
.logo img { height: 28px; width: auto; vertical-align: middle; }

.site-footer {
  padding: 3rem 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* --- SVG 动效关键帧 --- */
@keyframes node-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; fill: var(--color-accent); }
}
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes slide-up {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 动效类绑定 */
.anim-node { animation: node-pulse 4s ease-in-out infinite; }
.anim-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 2s ease forwards;
}
.anim-dot { animation: breathe 3s ease-in-out infinite; }
.anim-float { animation: slide-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.anim-float:nth-child(2) { animation-delay: 0.15s; }
.anim-float:nth-child(3) { animation-delay: 0.3s; }
.anim-float:nth-child(4) { animation-delay: 0.45s; }

/* 旋转/缩放子元素中心修正 */
.anim-node, .anim-dot {
  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;
  }
  .anim-node, .anim-line, .anim-dot, .anim-float {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 768px) {
  .hero-layout { flex-direction: column; }
  .hero-visual { order: -1; width: 100%; max-width: 320px; margin: 0 auto; }
  .persona-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}
