/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计 Token --- */
:root {
  --bg-dark: #271231;
  --bg-paper: #F5F0E5;
  --text-body: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  --line-height-base: 1.65;
  --line-height-head: 1.25;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--text-body);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }

/* --- 容器与网格 --- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.grid-auto {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }
.min-w-zero { min-width: 0; }

/* --- 主题层变量覆盖 --- */
.paper-surface {
  --surface-bg: var(--bg-paper);
  --text-main: var(--text-body);
  --text-muted: rgba(31, 21, 35, 0.75);
  --brand-color: var(--color-brand);
  --accent-color: var(--color-accent);
}
.dark-surface {
  --surface-bg: var(--bg-dark);
  --text-main: var(--bg-paper);
  --text-muted: rgba(245, 240, 229, 0.8);
  --brand-color: var(--color-accent);
  --accent-color: var(--color-accent);
}

/* --- 区块通用 --- */
.section {
  padding-block: var(--section-y);
  background-color: var(--surface-bg);
  color: var(--text-main);
  position: relative;
}
.section-header {
  margin-bottom: var(--gap);
}
.section-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand-color);
  margin-bottom: 0.75em;
  text-transform: uppercase;
}
.section-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: var(--line-height-head);
  letter-spacing: 0;
  margin-bottom: 0.5em;
}
.section-header p {
  max-width: 38em;
  color: var(--text-muted);
  font-size: 1.05rem;
}
.text-hl { color: var(--brand-color); }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding-inline: 1.5em;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.btn-primary {
  background-color: var(--accent-color);
  color: var(--bg-dark);
}
.btn-primary:hover { background-color: #d95aae; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-main);
  color: var(--text-main);
}
.btn-secondary:hover { background: rgba(128, 128, 128, 0.1); }
.btn-icon { width: 20px; height: 20px; stroke-width: 2; }

/* --- 卡片与面板 --- */
.card {
  background: var(--surface-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  border-radius: var(--radius-card);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 12px 32px -12px rgba(31, 21, 35, 0.4); }
.panel {
  background: var(--surface-bg);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}

/* --- 表格 --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--text-muted);
}
.data-table th { font-weight: 600; color: var(--brand-color); }
.data-table tr:last-child td { border-bottom: none; }

/* --- 步骤条 --- */
.step-list { counter-reset: step-counter; }
.step-item {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3.5em;
  margin-bottom: 1.5em;
}
.step-item::before {
  content: counter(step-counter, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 2.2em; height: 2.2em;
  background: var(--accent-color);
  color: var(--bg-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
}
.step-title { font-weight: 600; margin-bottom: 0.3em; color: var(--text-main); }
.step-desc { color: var(--text-muted); font-size: 0.95rem; }

/* --- FAQ --- */
.faq-item {
  border-bottom: 1px solid var(--text-muted);
  padding: 1em 0;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 1em;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2em;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-answer {
  margin-top: 0.8em;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 1px solid rgba(31, 21, 35, 0.1);
  backdrop-filter: blur(8px);
  transition: box-shadow 0.2s ease;
}
.site-header.scrolled { box-shadow: 0 2px 12px rgba(0,0,0,0.05); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand-link { display: flex; align-items: center; gap: 0.6em; font-weight: 700; font-size: 1.1rem; }
.brand-img { width: 28px; height: 28px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; opacity: 0.85; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; color: var(--color-brand); }
.site-footer {
  padding: var(--section-y) 0;
  background: var(--bg-dark);
  color: var(--bg-paper);
  border-top: 1px solid rgba(245, 240, 229, 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-weight: 600; margin-bottom: 0.8em; color: var(--color-accent); }
.footer-col ul li { margin-bottom: 0.5em; }
.footer-col a { opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.footer-bottom {
  padding-top: var(--gap);
  border-top: 1px solid rgba(245, 240, 229, 0.1);
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- 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; }
  100% { stroke-dashoffset: 0; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes slide-in-right {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

/* --- SVG 动效类 --- */
.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 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.anim-pulse { animation: pulse-dot 2.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-slide-in { animation: slide-in-right 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.anim-flow { stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 3s linear infinite; }

/* --- 响应式与无障碍 --- */
@media (max-width: 768px) {
  .flex-row { flex-direction: column; align-items: stretch; }
  .nav-links { gap: 1em; }
  .btn { width: 100%; }
}
@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-pulse, .anim-slide-in, .anim-flow {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}

/* 兜底：裁掉横向溢出 */
div.container.header-inner {
  overflow-x: clip;
}
