/* =========================================
   SafeW 全站共享样式
   设计系统 · 排版 · 组件 · SVG 动效
   ========================================= */

/* --- 变量定义 --- */
:root {
  /* 色板 */
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  
  /* 文字颜色（跟随所在面） */
  --text-primary: var(--color-body);
  --text-secondary: #3a354d;
  --text-on-dark: var(--color-paper);
  --text-on-dark-secondary: #cfcfe0;
  --text-highlight: var(--color-brand);
  --text-highlight-dark: var(--color-accent);

  /* 结构参数 */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  
  --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;
  --lh-body: 1.65;
  --lh-tight: 1.15;
  --lh-heading: 1.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);
  font-size: 18px;
  line-height: var(--lh-body);
  color: var(--text-primary);
  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; }

/* 容器 */
.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);
}
.section--dark {
  background-color: var(--color-dark);
  color: var(--text-on-dark);
}
.section--dark .text-highlight { color: var(--text-highlight-dark); }
.section--dark .eyebrow { color: var(--text-highlight-dark); }
.section--dark .link-accent { color: var(--text-highlight-dark); }
.section--dark table th, .section--dark table td { border-color: rgba(255,255,255,0.15); }
.section--dark .card-light {
  background: var(--color-paper);
  color: var(--text-primary);
  border: 1px solid #e5e5ea;
}

/* 眉标 */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-highlight);
  margin-bottom: 0.5em;
}

/* 标题 */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: var(--lh-heading);
  color: inherit;
}
h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.6em;
}
h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  margin-bottom: 0.8em;
}
h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5em;
}
p { margin-bottom: 1em; max-width: 38em; }
.text-highlight { color: var(--text-highlight); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 1.25em;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border-radius: var(--radius-btn);
}
.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn--primary:hover { transform: translateY(-2px); background-color: #c95be6; border-color: #c95be6; }
.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--text-primary);
}
.section--dark .btn--secondary { color: var(--text-on-dark); border-color: var(--text-on-dark); }
.btn--secondary:hover { opacity: 0.85; transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* 卡片与面板 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5em;
  position: relative;
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2em;
  position: relative;
  overflow: hidden;
}
.section--dark .panel { background: #231840; }

/* 网格与布局辅助 */
.grid { display: grid; gap: var(--gap); }
.grid--cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.grid--cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-md { gap: var(--gap); }
.mt-lg { margin-top: var(--section-y); }
.mb-md { margin-bottom: var(--gap); }
.w-full { width: 100%; }

/* 表格 */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 1.5em;
}
th, td {
  text-align: left;
  padding: 0.75em 1em;
  border-bottom: 1px solid #e5e5ea;
  vertical-align: top;
}
th { font-weight: 600; color: var(--text-primary); }
td { color: var(--text-secondary); }
.section--dark table th, .section--dark table td { border-color: rgba(255,255,255,0.15); }

/* FAQ details */
details {
  border-bottom: 1px solid #e5e5ea;
  padding: 1em 0;
}
.summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
}
.summary::-webkit-details-marker { display: none; }
.summary::after { content: "+"; font-size: 1.2rem; font-weight: 400; color: var(--text-secondary); transition: transform 0.2s; }
details[open] .summary::after { transform: rotate(45deg); }
.details-content { margin-top: 0.75em; color: var(--text-secondary); line-height: 1.7; }

/* 步骤徽标 */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 0.6em;
  flex-shrink: 0;
}

/* 标签胶囊 */
.tag {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: #f0eff4;
  color: var(--text-secondary);
  margin-bottom: 0.5em;
}
.section--dark .tag { background: rgba(255,255,255,0.1); color: var(--text-on-dark-secondary); }

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e5e5ea;
}
.section--dark ~ .site-header, .site-header.light-bg { background: rgba(252, 252, 253, 0.95); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5em; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text-primary); }

.site-footer {
  padding: var(--section-y) 0;
  border-top: 1px solid #e5e5ea;
  margin-top: var(--section-y);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--gap); }
.footer-col h4 { font-weight: 600; margin-bottom: 0.5em; color: var(--text-primary); }
.footer-col ul li { margin-bottom: 0.4em; }
.footer-col a:hover { color: var(--text-primary); }

/* SVG 动效关键帧 */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes float-delayed {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes dash-flow {
  0% { stroke-dashoffset: 0.5; }
  100% { stroke-dashoffset: 0; }
}
@keyframes bubble-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 动效类 */
.draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 3s ease-in-out infinite alternate; }
.float { animation: float-slow 4s ease-in-out infinite; }
.float-alt { animation: float-delayed 5s ease-in-out infinite 0.5s; }
.pulse { animation: pulse-opacity 3s ease-in-out infinite; }
.flow { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: dash-flow 2s linear infinite; }
.bubble-in { animation: bubble-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.bubble-in.delay-1 { animation-delay: 0.2s; opacity: 0; }
.bubble-in.delay-2 { animation-delay: 0.4s; opacity: 0; }
.bubble-in.delay-3 { animation-delay: 0.6s; opacity: 0; }

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
  .draw, .flow { stroke-dashoffset: 0 !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid--cols-2, .grid--cols-3 { grid-template-columns: 1fr; }
  .nav-links { display: none; } /* 移动端简化处理，实际项目可加汉堡菜单，此处保持静态简洁 */
  h1 { font-size: clamp(2.2rem, 8vw, 3.2rem); }
  h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
}
