/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 基础设计 Token */
:root {
  --c-dark: #10112D;
  --c-paper: #F5F0E5;
  --c-text: #151523;
  --c-brand: #1416EB;
  --c-accent: #89ED6E;
  
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(21, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  
  --fw-title: 800;
  --ls-title: -0.02em;
  --lh-title: 1.1;
  --lh-body: 1.75;
}

/* 重置与基础排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 表面层颜色系统（严格遵循取色规则） */
.surface-dark {
  --bg: var(--c-dark);
  --fg: var(--c-paper);
  --link: var(--c-accent);
  --hl: var(--c-accent);
  --border: rgba(245, 240, 229, 0.15);
  background: var(--bg);
  color: var(--fg);
}
.surface-paper {
  --bg: var(--c-paper);
  --fg: var(--c-text);
  --link: var(--c-brand);
  --hl: var(--c-brand);
  --border: rgba(21, 21, 35, 0.12);
  background: var(--bg);
  color: var(--fg);
}
.card-light {
  --bg: var(--c-paper);
  --fg: var(--c-text);
  --link: var(--c-brand);
  --hl: var(--c-brand);
  --border: rgba(21, 21, 35, 0.12);
  background: var(--bg);
  color: var(--fg);
}

/* 通用组件：按钮 */
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 24px; height: 52px;
  background: var(--c-accent); color: var(--c-dark);
  font-weight: 700; font-size: 16px; border-radius: var(--radius-btn);
  border: none; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(137, 237, 110, 0.4); }
.btn-primary:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 3px; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 24px; height: 52px;
  background: transparent; color: var(--fg);
  font-weight: 600; font-size: 16px; border-radius: var(--radius-btn);
  border: 1.5px solid currentColor; cursor: pointer; transition: background 0.2s ease;
}
.btn-secondary:hover { background: rgba(128, 128, 128, 0.1); }
.btn-secondary:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

/* 通用组件：卡片与面板 */
.card {
  background: var(--bg);
  border: var(--card-border) solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(21, 21, 35, 0.35); }
.panel {
  background: var(--bg);
  border: var(--card-border) solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* 通用组件：排版辅助 */
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 12px; color: var(--link);
}
.hl { color: var(--hl); }
.text-body { max-width: 38em; line-height: var(--lh-body); }
.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-row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: var(--gap); }

/* 标题系统 */
h1, h2, h3 { font-weight: var(--fw-title); letter-spacing: var(--ls-title); line-height: var(--lh-title); text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 24px; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 20px; }
h3 { font-size: 1.25rem; margin-bottom: 12px; }
p { margin-bottom: 16px; }
ul.list-disc { list-style-type: disc; padding-left: 20px; margin-bottom: 16px; }
ul.list-disc li { margin-bottom: 8px; position: relative; padding-left: 12px; }
ul.list-disc li::marker { color: var(--link); }

/* 表格样式 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 320px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); }
th { font-weight: 700; }
td a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* FAQ 样式 */
details {
  background: var(--bg);
  border: var(--card-border) solid var(--border);
  border-radius: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s ease;
}
details[open] { box-shadow: var(--card-shadow); }
summary {
  padding: 18px 20px; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
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 > div { padding: 0 20px 20px; }

/* 页头与页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.site-header.scrolled { background: rgba(245, 240, 229, 0.92); backdrop-filter: blur(8px); }
.surface-dark .site-header.scrolled { background: rgba(16, 17, 45, 0.92); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 var(--gap);
}
.nav-list { display: flex; gap: 24px; align-items: center; }
.nav-link { font-weight: 600; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
.nav-link:hover, .nav-link[aria-current="page"] { border-bottom-color: var(--link); }
.footer {
  padding: 48px var(--gap);
  border-top: 1px solid var(--border);
  text-align: center; font-size: 14px; opacity: 0.8;
}

/* SVG 动效基础 */
.svg-anim { width: 100%; height: auto; }
.svg-path-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.anim-draw { animation: drawLine 3s ease forwards; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-slide-up { animation: slideUp 1.2s ease forwards; }
.anim-float { animation: float 5s ease-in-out infinite; }
.transform-box-fill { transform-box: fill-box; transform-origin: center; }

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.75; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.03); }
}
@keyframes slideUp {
  0% { transform: translateY(8px); opacity: 0.85; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 减少动态效果适配 */
@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-draw, .anim-breathe, .anim-slide-up, .anim-float {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .flex-row { flex-direction: column; align-items: flex-start; }
  .scene-split { flex-direction: column; }
}
