/* =========================================
   SafeW 全站共享样式 / Design Tokens
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --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.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   布局容器与区块
   ========================================= */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.section--paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* 面内取色重置 */
.section--dark .text-default { color: var(--color-paper); }
.section--dark .text-brand { color: var(--color-accent); }
.section--dark .text-hl { color: var(--color-accent); }

.section--paper .text-default { color: var(--color-text); }
.section--paper .text-brand { color: var(--color-brand); }
.section--paper .text-hl { color: var(--color-brand); }

/* 分隔线节奏 */
.section-divider {
  width: 100%;
  height: 1px;
  background-color: rgba(25, 21, 35, 0.12);
  border: none;
}

.section--dark .section-divider {
  background-color: rgba(245, 240, 229, 0.1);
}

/* =========================================
   排版组件
   ========================================= */
.h-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.section--paper .h-badge { color: var(--color-brand); }
.section--dark .h-badge { color: var(--color-accent); }

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-top: 1.5rem; margin-bottom: 0.75rem; }

.text-hl {
  font-weight: 600;
}
.section--paper .text-hl { color: var(--color-brand); }
.section--dark .text-hl { color: var(--color-accent); }

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* =========================================
   按钮与交互
   ========================================= */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(200, 237, 110, 0.25);
}

.btn-outline {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.section--paper .btn-outline { color: var(--color-text); border-color: var(--color-text); }
.section--dark .btn-outline { color: var(--color-paper); border-color: var(--color-paper); }
.btn-outline:hover {
  background-color: rgba(25, 21, 35, 0.06);
  transform: translateY(-1px);
}
.section--dark .btn-outline:hover {
  background-color: rgba(245, 240, 229, 0.08);
}

/* =========================================
   卡片与面板
   ========================================= */
.card {
  background-color: var(--color-paper);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: box-shadow 0.25s ease;
}
.card:hover {
  box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35);
}

/* 深色背景上的浅色卡片需重置取色 */
.card--light-on-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
}
.card--light-on-dark .text-brand { color: var(--color-brand); }
.card--light-on-dark .text-hl { color: var(--color-brand); }
.card--light-on-dark .h-badge { color: var(--color-brand); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}

/* =========================================
   表格与列表
   ========================================= */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: 1px solid rgba(25, 21, 35, 0.1);
}
.table-responsive table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.table-responsive th, .table-responsive td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.table-responsive th {
  font-weight: 600;
  background-color: rgba(25, 21, 35, 0.03);
}
.table-responsive tr:last-child td {
  border-bottom: none;
}

.step-list {
  counter-reset: step;
}
.step-list li {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 1.25rem;
}
.step-list li::before {
  counter-increment: step;
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 2rem;
  height: 2rem;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.section--dark .step-list li::before {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

/* =========================================
   FAQ
   ========================================= */
.faq details {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 1rem 0;
}
.section--dark .faq details {
  border-bottom-color: rgba(245, 240, 229, 0.1);
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  font-weight: 400;
  opacity: 0.6;
}
.faq details[open] summary::before {
  content: "−";
}
.faq p {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* =========================================
   SVG 动效系统
   ========================================= */
.svg-visual {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* 网格节点依次点亮 */
@keyframes grid-pulse {
  0%, 100% { stroke-dashoffset: 1; opacity: 0.25; transform: scale(0.85); }
  40%, 60% { stroke-dashoffset: 0; opacity: 1; transform: scale(1.1); }
}
.node-glow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: grid-pulse 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.node-glow.d1 { animation-delay: 0s; }
.node-glow.d2 { animation-delay: 0.6s; }
.node-glow.d3 { animation-delay: 1.2s; }
.node-glow.d4 { animation-delay: 1.8s; }
.node-glow.d5 { animation-delay: 2.4s; }

/* 连接线流动 */
@keyframes flow-line {
  0% { stroke-dashoffset: 1; opacity: 0.3; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 1; opacity: 0.3; }
}
.line-flow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: flow-line 4s linear infinite;
}

/* 呼吸输入点 */
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.dot-breathe {
  animation: breathe 2.4s ease-in-out infinite;
}
.dot-breathe:nth-child(2) { animation-delay: 0.3s; }
.dot-breathe:nth-child(3) { animation-delay: 0.6s; }

/* 通知卡片滑入 */
@keyframes slide-in {
  0%, 100% { transform: translateY(8px); opacity: 0.6; }
  20%, 80% { transform: translateY(0); opacity: 1; }
}
.card-slide {
  animation: slide-in 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.card-slide.delay-1 { animation-delay: 1.5s; }
.card-slide.delay-2 { animation-delay: 3s; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
}

/* =========================================
   页头与页脚
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 229, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}
.brand img {
  height: 28px;
  width: auto;
}
.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}
.section--dark .nav-links a { color: var(--color-paper); }
.section--dark .nav-links a:hover, .section--dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(25, 21, 35, 0.08);
  font-size: 0.9rem;
  opacity: 0.85;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  text-align: center;
}
.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================================
   响应式微调
   ========================================= */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .feature-row:nth-child(even) .text-col { order: 2; }
  .feature-row:nth-child(even) .visual-col { order: 1; }
  .nav-links { display: none; } /* 简化处理，实际可加汉堡菜单，此处保持静态符合规则 */
}
