/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  --color-accent-text: var(--color-dark);
  --color-light-text: var(--color-paper);
  --color-light-accent: var(--color-accent);
  --color-light-brand: var(--color-accent);

  /* 结构 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: 1280px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-body: 1.55;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 布局容器 */
.container {
  width: min(100% - 32px, var(--content-max));
  margin-inline: auto;
  overflow-x: hidden;
}
.section {
  padding-block: var(--section-y);
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* 响应式 SVG 通用类 */
.svg-responsive {
  width: 100%;
  height: auto;
}

/* 排版层级 */
h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--color-text);
}
h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  margin-bottom: var(--gap);
}
h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  margin-bottom: 0.5em;
  letter-spacing: 0.02em;
}
p { margin-bottom: 1em; max-width: 38em; }
mark, .hl {
  color: var(--color-brand);
  font-weight: 700;
}
.dark-mode .hl, .dark-mode mark { color: var(--color-light-accent); }
.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode p, .dark-mode li, .dark-mode td, .dark-mode th {
  color: var(--color-light-text);
}
.dark-mode a:not(.btn) { color: var(--color-light-accent); }

/* 眉标 */
.breadcrumb-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.5em;
}
.dark-mode .breadcrumb-label { color: var(--color-light-accent); }

/* 深色背景上的浅色文字（用于非 dark-mode 类包裹的深色区块） */
.section-dark h1, .section-dark h2, .section-dark h3, .section-dark p, .section-dark span.breadcrumb-label, .section-dark span.hl, .section-dark a.btn-secondary {
  color: var(--color-light-text);
}
.section-dark a.btn-secondary {
  border-color: var(--color-light-text);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-accent-text);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(200, 237, 110, 0.25); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text);
  color: var(--color-text);
}
.dark-mode .btn-secondary { border-color: var(--color-light-text); color: var(--color-light-text); }
.btn-secondary:hover { background: rgba(0,0,0,0.05); }
.dark-mode .btn-secondary:hover { background: rgba(255,255,255,0.08); }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 240, 229, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
  padding: 12px 0;
}
.dark-mode .site-header { background: rgba(20, 14, 37, 0.9); border-color: rgba(245, 240, 229, 0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-weight: 500; transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.dark-mode .nav-links a:hover, .dark-mode .nav-links a[aria-current="page"] { color: var(--color-light-accent); }

/* 页脚 */
.site-footer {
  padding: 48px 0;
  border-top: 1px solid rgba(25, 21, 35, 0.08);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(25, 21, 35, 0.6);
}
.dark-mode .site-footer { border-color: rgba(245, 240, 229, 0.1); color: rgba(245, 240, 229, 0.6); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.footer-links a { transition: color 0.2s; }
.footer-links a:hover { color: var(--color-brand); }
.dark-mode .footer-links a:hover { color: var(--color-light-accent); }

/* 卡片与面板 */
.card {
  background: #fff;
  border-radius: var(--radius-card);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.35); }
.panel {
  background: var(--color-dark);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-block: var(--gap);
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}
.dark-mode .data-table th, .dark-mode .data-table td { border-color: rgba(245, 240, 229, 0.1); }
.data-table th { font-weight: 600; width: 40%; }

/* FAQ Details */
details.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 16px 0;
}
.dark-mode details.faq-item { border-color: rgba(245, 240, 229, 0.1); }
details.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::marker { display: none; content: ""; }
details.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background: var(--color-brand);
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>') center/contain no-repeat;
  transition: transform 0.2s;
}
details[open] summary::before { transform: rotate(180deg); }
details.faq-item p { margin-top: 12px; color: rgba(25, 21, 35, 0.8); }
.dark-mode details.faq-item p { color: rgba(245, 240, 229, 0.8); }

/* 时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(25, 21, 35, 0.15);
}
.timeline-step { position: relative; margin-bottom: 32px; }
.timeline-step::before {
  content: attr(data-num);
  position: absolute;
  left: -24px;
  top: 0;
  width: 16px;
  height: 16px;
  background: var(--color-accent);
  color: var(--color-dark);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dark-mode .timeline-step::before { background: var(--color-light-accent); color: var(--color-dark); }

/* 流程条 */
.flow-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.flow-node {
  background: rgba(25, 21, 35, 0.05);
  padding: 12px 16px;
  border-radius: var(--radius-card);
  font-weight: 600;
}
.dark-mode .flow-node { background: rgba(245, 240, 229, 0.08); }
.flow-arrow {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* 棋盘式交错布局 */
.alternate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--gap) * 2);
  align-items: center;
}
.alternate-row:nth-child(even) .col-text { order: 2; }
.alternate-row:nth-child(even) .col-visual { order: 1; }

/* SVG 动效关键帧 */
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  50%, 80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes breath {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slide-in-right {
  0% { transform: translateX(100%); opacity: 0; }
  10%, 90% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.6; }
}

/* 动效应用类 */
.anim-float-slow { animation: float-slow 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-fast { animation: float-fast 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 4s ease-in-out infinite; }
.anim-breath { animation: breath 2.5s ease-in-out infinite; }
.anim-slide { animation: slide-in-right 8s ease-in-out infinite; }
.anim-pulse { animation: pulse-ring 3s ease-in-out infinite; 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;
    scroll-behavior: auto !important;
  }
  .anim-float-slow, .anim-float-fast, .anim-draw, .anim-breath, .anim-slide, .anim-pulse {
    animation: none !important;
  }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .alternate-row { grid-template-columns: 1fr; }
  .alternate-row:nth-child(even) .col-text,
  .alternate-row:nth-child(even) .col-visual { order: unset; }
  .nav-links { display: none; }
  h1 { font-size: 2.2rem; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-auto { grid-template-columns: repeat(2, 1fr); }
}
