/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --c-dark: #2D1438;
  --c-paper: #F6F3F7;
  --c-body: #1F1523;
  --c-brand: #9E13DD;
  --c-accent: #6EEDA8;

  /* 设计 Token */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 1px solid rgba(31, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-base: 1.75;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--c-body);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* 上下文取色覆盖 */
.dark-surface { background: var(--c-dark); color: var(--c-paper); }
.dark-surface h1, .dark-surface h2, .dark-surface h3, .dark-surface p, .dark-surface li { color: var(--c-paper); }
.dark-surface .hl { color: var(--c-accent); }
.dark-surface a:not(.btn-primary):not(.btn-secondary) { color: var(--c-accent); }
.dark-surface .badge { color: var(--c-accent); }

.card-light {
  background: var(--c-paper);
  color: var(--c-body);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
}
.card-light h1, .card-light h2, .card-light h3, .card-light p, .card-light li { color: var(--c-body); }
.card-light .hl { color: var(--c-brand); }
.card-light a:not(.btn-primary):not(.btn-secondary) { color: var(--c-brand); }

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }

/* 眉标 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
}
.badge::before {
  content: "";
  display: inline-block;
  width: 1.2em;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* 标题 */
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1rem;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.6rem;
}
.text-block {
  max-width: 38em;
  margin-bottom: var(--gap);
}

/* 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 1.2rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

.btn-primary {
  background: var(--c-accent);
  color: var(--c-dark);
}
.btn-primary:hover { background: #5bd893; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--c-body);
  color: var(--c-body);
}
.dark-surface .btn-secondary {
  border-color: var(--c-paper);
  color: var(--c-paper);
}
.dark-surface .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* 网格布局 */
.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); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* 特性交错行 */
.feature-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: center;
  margin-bottom: var(--section-y);
}
@media (min-width: 840px) {
  .feature-row { grid-template-columns: 1fr 1fr; }
  .feature-row.reverse .visual-panel { order: -1; }
}
.visual-panel {
  background: var(--c-dark);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.visual-panel svg { width: 100%; height: auto; }

/* 时间轴 */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid rgba(31, 21, 35, 0.15);
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px dashed rgba(31, 21, 35, 0.1);
}
.timeline-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.4rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  background: var(--c-brand);
  border-radius: 50%;
  border: 2px solid var(--c-paper);
}
.time-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-brand);
  margin-bottom: 0.3rem;
}

/* 卡片 */
.news-card {
  padding: 1.5rem;
  border-radius: var(--radius-card);
  border: var(--card-border);
  background: var(--c-paper);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.news-meta { font-size: 0.8rem; color: rgba(31, 21, 35, 0.6); }
.news-title { font-weight: 600; line-height: 1.4; }
.news-excerpt { font-size: 0.95rem; color: rgba(31, 21, 35, 0.8); }

/* 表格 */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  text-align: left;
}
th { font-weight: 600; background: rgba(31, 21, 35, 0.04); }
td a { color: var(--c-brand); word-break: break-all; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 1rem; }
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: 1rem 1.2rem;
  background: var(--c-paper);
  cursor: pointer;
}
summary {
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 0.8rem; color: rgba(31, 21, 35, 0.85); }

/* 步骤徽标 */
.step-grid { display: grid; gap: var(--gap); }
@media (min-width: 768px) { .step-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card {
  padding: 1.5rem;
  border-radius: var(--radius-card);
  border: var(--card-border);
  background: var(--c-paper);
  position: relative;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--c-accent);
  color: var(--c-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 21, 35, 0.08);
}
.dark-surface .site-header { background: rgba(45, 20, 56, 0.9); border-bottom-color: rgba(255,255,255,0.1); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 28px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--c-brand); }
.dark-surface .nav-links a:hover, .dark-surface .nav-links a[aria-current="page"] { color: var(--c-accent); }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; }
@media (max-width: 768px) {
  .mobile-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--c-paper); padding: 1rem; flex-direction: column; border-bottom: 1px solid rgba(0,0,0,0.1); }
  .nav-links.open { display: flex; }
}
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(31, 21, 35, 0.1);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(31, 21, 35, 0.7);
}
.dark-surface .site-footer { border-top-color: rgba(255,255,255,0.1); color: rgba(246, 243, 247, 0.7); }
.footer-nav { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1rem; flex-wrap: wrap; }

/* SVG 动效基础 */
svg { width: 100%; height: auto; }
.anim-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-dot { r: 3; fill: currentColor; }
.anim-float { animation: safewFloat 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-breathe { animation: safewBreathe 3s ease-in-out infinite; }
.anim-flow { animation: safewFlow 4s linear infinite; }
.anim-draw { animation: safewDraw 5s ease-in-out infinite alternate; }

@keyframes safewFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes safewBreathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@keyframes safewFlow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes safewDraw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
