/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #2D1438;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #6EEDA8;
  --color-white: #FFFFFF;
  --color-light-border: rgba(31, 21, 35, 0.08);
  --color-dark-text: #F6F3F7;
  --color-dark-accent: #6EEDA8;

  /* 结构 token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  --header-h: 64px;

  /* 字体 */
  --font-body: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  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; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-block: var(--section-y);
  border-bottom: 1px solid var(--color-light-border);
}
.section:last-child { border-bottom: none; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* 标题系统 */
.heading-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.5rem;
}
.bg-dark .heading-label { color: var(--color-dark-accent); }
h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.75rem;
}
p {
  max-width: 38em;
  margin-bottom: 1rem;
}
span.hl { color: var(--color-brand); }
.bg-dark span.hl { color: var(--color-dark-accent); }

/* 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}
.btn-primary:hover { background-color: #5bd894; }
.btn-secondary {
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.btn-secondary:hover { background-color: rgba(31, 21, 35, 0.05); }
.bg-dark .btn-secondary { border-color: var(--color-dark-text); color: var(--color-dark-text); }
.bg-dark .btn-secondary:hover { background-color: rgba(246, 243, 247, 0.1); }
.btn svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* 组件：卡片 */
.card {
  background: var(--color-paper);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.35); }
.bg-dark .card { background: rgba(255, 255, 255, 0.08); }

/* 组件：表格 */
.table-spec {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.table-spec th, .table-spec td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-light-border);
  text-align: left;
}
.table-spec th { font-weight: 600; color: var(--color-text); }
.table-spec td { color: var(--color-text); }
.table-spec a { color: var(--color-brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.bg-dark .table-spec th, .bg-dark .table-spec td { color: var(--color-dark-text); border-color: rgba(246, 243, 247, 0.15); }
.bg-dark .table-spec a { color: var(--color-dark-accent); }

/* 组件：FAQ */
.faq-item details {
  border: 1px solid var(--color-light-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  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;
  font-weight: 400;
  transition: transform 0.2s ease;
}
.faq-item details[open] summary::after { transform: rotate(45deg); }
.faq-item .answer {
  padding: 0 1.25rem 1rem;
  color: var(--color-text);
  line-height: 1.6;
}
.bg-dark .faq-item details { border-color: rgba(246, 243, 247, 0.15); }
.bg-dark .faq-item summary { color: var(--color-dark-text); }
.bg-dark .faq-item .answer { color: rgba(246, 243, 247, 0.85); }

/* 组件：时间轴与编号 */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-light-border);
}
.timeline-step { position: relative; margin-bottom: 2rem; padding-left: 1.5rem; }
.step-num {
  position: absolute;
  left: -2.25rem;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  border-radius: 8px;
  font-size: 0.9rem;
}
.bg-dark .step-num { background: var(--color-dark-accent); color: var(--color-dark); }

/* 头部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid var(--color-light-border);
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.logo-group { display: flex; align-items: center; gap: 0.75rem; }
.logo-img { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.main-nav { display: flex; gap: 1.5rem; }
.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}
.main-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-brand);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after { transform: scaleX(1); }
.main-nav a[aria-current="page"] { color: var(--color-brand); font-weight: 600; }

/* 页脚 */
.site-footer {
  background: var(--color-dark);
  color: var(--color-dark-text);
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(246, 243, 247, 0.1);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.footer-col h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--color-dark-accent); }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a { opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.footer-bottom {
  border-top: 1px solid rgba(246, 243, 247, 0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* SVG 动效 Keyframes */
@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes slideNotify {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50% { transform: translateX(6px); opacity: 0.7; }
}
@keyframes rotateJoin {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(12deg); }
}

.anim-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 6s ease-in-out infinite;
}
.anim-float { animation: floatSoft 5s ease-in-out infinite; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-slide { animation: slideNotify 7s ease-in-out infinite; }
.anim-rotate {
  animation: rotateJoin 10s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* 响应式与无障碍 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.75rem var(--gap); }
  .main-nav { order: 3; width: 100%; justify-content: center; margin-top: 0.5rem; flex-wrap: wrap; }
  .btn-wrap { margin-left: auto; }
}

@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-line, .anim-float, .anim-breathe, .anim-slide, .anim-rotate {
    animation: none !important;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
