/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 色板 */
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-body: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(21, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;

  /* 排版 Token */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --title-lh: 1.1;
  --body-lh: 1.65;
}

/* --- 基础重置 --- */
*, *::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: var(--body-lh);
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- 容器与布局 --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.section {
  padding-block: var(--section-y);
}
.grid-2 {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- 面色系统（通过类名切换取色变量） --- */
.paper-bg {
  background-color: var(--color-paper);
  --text-primary: var(--color-body);
  --text-secondary: rgba(21, 21, 35, 0.7);
  --brand: var(--color-brand);
  --accent: var(--color-accent);
  --card-border-color: rgba(21, 21, 35, 0.16);
}
.dark-bg {
  background-color: var(--color-dark);
  --text-primary: var(--color-paper);
  --text-secondary: rgba(245, 240, 229, 0.8);
  --brand: var(--color-accent);
  --accent: var(--color-accent);
  --card-border-color: rgba(245, 240, 229, 0.15);
}
/* 深色背景内的浅色卡片恢复纸面取色 */
.dark-bg .card-light {
  background-color: var(--color-paper);
  --text-primary: var(--color-body);
  --text-secondary: rgba(21, 21, 35, 0.7);
  --brand: var(--color-brand);
  --card-border-color: rgba(21, 21, 35, 0.16);
}

/* --- 排版组件 --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand);
  margin-bottom: 0.75rem;
}
.badge::before {
  content: "";
  display: block;
  width: 12px;
  height: 2px;
  background-color: currentColor;
  border-radius: 1px;
}
h1, h2, h3 {
  font-weight: 800;
  line-height: var(--title-lh);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.75rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.5rem; }
p { color: var(--text-secondary); margin-bottom: 1rem; max-width: 38em; }
.text-highlight { color: var(--brand); }
.dark-bg .text-highlight { color: var(--accent); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding-inline: 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  border: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background-color: var(--accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 2px solid var(--text-primary);
  color: var(--text-primary);
}
.dark-bg .btn-secondary { border-color: var(--text-primary); color: var(--text-primary); }
.btn-icon { width: 20px; height: 20px; stroke-width: 2; }

/* --- 卡片与面板 --- */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.panel {
  background-color: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4/3;
}

/* --- 表格 --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border-color);
  text-align: left;
}
th { font-weight: 700; color: var(--text-primary); }
td { color: var(--text-secondary); }

/* --- FAQ --- */
.faq-item {
  border-bottom: 1px solid var(--card-border-color);
  margin-bottom: 1rem;
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 0;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: 0.5rem; font-size: 0.95rem; }

/* --- 步骤条 --- */
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  counter-reset: step;
}
.step {
  flex: 1 1 180px;
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  position: relative;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--color-dark);
  font-weight: 800;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.step h4 { margin-bottom: 0.4rem; color: var(--text-primary); font-size: 1rem; }
.step p { font-size: 0.9rem; margin-bottom: 0; }

/* --- 资讯卡片 --- */
.news-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.news-card article {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.news-card time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.news-card h4 {
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.news-card p { font-size: 0.9rem; margin-bottom: 0; }

/* --- 场景标签 --- */
.scene-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(20, 22, 235, 0.08);
  color: var(--brand);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.dark-bg .scene-tag { background: rgba(137, 237, 110, 0.15); color: var(--accent); }

/* --- SVG 动效 --- */
.svg-visual { width: 100%; height: auto; }
.svg-visual svg { width: 100%; height: auto; display: block; }

/* 几何旋转拼合 */
.geo-group {
  transform-box: fill-box;
  transform-origin: center;
  animation: geoRotate 12s linear infinite alternate;
}
.geo-group-alt {
  transform-box: fill-box;
  transform-origin: center;
  animation: geoRotateAlt 14s linear infinite alternate-reverse;
}
@keyframes geoRotate {
  0% { transform: rotate(-6deg) scale(0.98); }
  100% { transform: rotate(6deg) scale(1.02); }
}
@keyframes geoRotateAlt {
  0% { transform: rotate(5deg) translateX(-2px); }
  100% { transform: rotate(-5deg) translateX(2px); }
}

/* 描边流动 */
.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawFlow 6s ease-in-out infinite alternate;
}
@keyframes drawFlow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 呼吸点 */
.breath-dot {
  animation: breathPulse 3s ease-in-out infinite alternate;
}
@keyframes breathPulse {
  0% { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* 浮动气泡 */
.float-bubble {
  animation: floatUp 5s ease-in-out infinite alternate;
}
@keyframes floatUp {
  0% { transform: translateY(0); opacity: 0.8; }
  100% { transform: translateY(-8px); opacity: 1; }
}

/* 滑入通知 */
.slide-in {
  animation: slideInCard 7s ease-in-out infinite alternate;
}
@keyframes slideInCard {
  0% { transform: translateX(12px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* --- 响应式微调 --- */
@media (max-width: 767px) {
  .hero-layout { flex-direction: column-reverse; }
  .split-row { flex-direction: column; }
  .steps { flex-direction: column; }
}
@media (min-width: 768px) {
  .hero-layout { display: flex; gap: var(--gap); align-items: center; }
  .hero-text { flex: 1; }
  .hero-visual { flex: 1; max-width: 480px; }
  .split-row { display: flex; gap: var(--gap); align-items: center; }
  .split-row.reverse { flex-direction: row-reverse; }
  .split-text { flex: 1; }
  .split-visual { flex: 1; max-width: 480px; }
}
