/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与 Token */
:root {
  /* 色彩系统 */
  --color-dark: #271231;
  --color-paper: #F5F0E5;
  --color-body: #1F1523;
  --color-brand: #9B12D8;
  --color-accent: #ED6EC0;
  
  /* 取色映射（默认纸面） */
  --text-primary: var(--color-body);
  --text-secondary: #4A3B52;
  --text-highlight: var(--color-brand);
  --icon-color: var(--color-brand);
  --border-color: rgba(31, 21, 35, 0.12);
  --bg-surface: var(--color-paper);
  
  /* 结构 Token */
  --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: 1280px;
  
  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 深色面取色覆盖 */
:root .surface-dark {
  --text-primary: var(--color-paper);
  --text-secondary: #D8CCE6;
  --text-highlight: var(--color-accent);
  --icon-color: var(--color-accent);
  --border-color: rgba(245, 240, 229, 0.15);
  --bg-surface: var(--color-dark);
}

/* 浅色卡片在深色面上恢复纸面取色 */
.surface-dark .card-light {
  --text-primary: var(--color-body);
  --text-secondary: #4A3B52;
  --text-highlight: var(--color-brand);
  --icon-color: var(--color-brand);
  --border-color: rgba(31, 21, 35, 0.12);
  --bg-surface: var(--color-paper);
}

/* 2. 基础重置与排版 */
*, *::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);
  background: var(--bg-surface);
  color: var(--text-primary);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }

/* 容器 */
.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);
  background: var(--bg-surface);
}
.section + .section { margin-top: 0; }

/* 标题系统 */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-highlight);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
h1, h2, h3 {
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: anywhere;
  word-break: break-word;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.5rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
.text-muted { color: var(--text-secondary); font-size: 0.95rem; }

/* 高亮关键词 */
.hl { color: var(--text-highlight); font-weight: 600; }

/* 3. 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  min-height: 48px;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--text-highlight); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  box-shadow: 0 4px 12px rgba(237, 110, 192, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(237, 110, 192, 0.4); }
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--text-primary);
  color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(31, 21, 35, 0.05); }
.surface-dark .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.surface-dark .btn-secondary:hover { background: rgba(245, 240, 229, 0.1); }

/* 4. 组件：卡片 */
.card {
  background: var(--bg-surface);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  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); }

/* 5. 组件：表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1rem 0 2rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
}
.data-table th { font-weight: 600; color: var(--text-secondary); width: 35%; }
.data-table tr:last-child td { border-bottom: none; }

/* 6. 组件：FAQ / Details */
.faq-item { border-bottom: 1px solid var(--border-color); }
.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq-item .answer { padding: 0 0 1.5rem 0; color: var(--text-secondary); line-height: 1.7; }

/* 7. 组件：步骤条 */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
  counter-reset: step;
}
.step-card { counter-increment: step; position: relative; padding-left: 3.5rem; }
.step-card::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  width: 2.5rem; height: 2.5rem;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
}
.surface-dark .step-card::before { background: var(--color-accent); color: var(--color-dark); }

/* 8. 导航与页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.nav-list { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-size: 0.95rem; font-weight: 500; }
.nav-link[aria-current="page"] { color: var(--text-highlight); }
@media (max-width: 768px) {
  .nav-list { display: none; }
  .mobile-toggle { display: block; }
}

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h4 { font-weight: 600; margin-bottom: 1rem; color: var(--text-primary); }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a:hover { color: var(--text-highlight); }

/* 9. SVG 动效体系 */
.svg-responsive { width: 100%; height: auto; max-width: 100%; overflow: visible; }
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawPath 4s ease-in-out infinite alternate;
}
@keyframes drawPath {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.anim-float {
  animation: floatY 3.5s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes floatY {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}
.anim-breathe {
  animation: breatheOpacity 2.8s ease-in-out infinite alternate;
}
@keyframes breatheOpacity {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}
.anim-slide-in {
  animation: slideIn 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  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;
  }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
