/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #F5F0E5;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  /* 结构变量 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid rgba(25, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --sidebar-w: 260px;
  
  /* 排版 */
  --font-title-weight: 600;
  --line-height-title: 1.25;
  --h1-size: clamp(2rem, 4.6vw, 3.4rem);
  --h2-size: clamp(1.6rem, 3vw, 2.4rem);
  --base-size: 16px;
  --base-line: 1.75;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--base-size);
  line-height: var(--base-line);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

/* 布局：宽屏左栏右内容，窄屏顶部导航 */
.layout-grid {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
@media (max-width: 768px) {
  .layout-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 100;
    background: var(--color-dark);
    padding: 1rem;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .sidebar nav { display: none; }
  .mobile-nav { display: flex; gap: 1rem; }
  .content { padding-top: 0; }
}
.sidebar {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 2rem 1.5rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2rem;
}
.brand-logo {
  display: flex; align-items: center; gap: 0.75rem;
  font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em;
}
.brand-logo img { width: 32px; height: 32px; object-fit: contain; }
.sidebar nav ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar nav a {
  color: rgba(245, 240, 229, 0.7); text-decoration: none;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-btn);
  transition: color 0.2s, background 0.2s;
}
.sidebar nav a:hover, .sidebar nav a[aria-current="page"] {
  color: var(--color-accent); background: rgba(200, 237, 110, 0.1);
}
.mobile-nav a {
  color: var(--color-paper); text-decoration: none;
  font-weight: 600; font-size: 0.9rem;
}

.content { padding: var(--section-y) 0; }
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }

/* 面与取色系统 */
.bg-dark { background: var(--color-dark); color: var(--color-paper); }
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .subtle { color: rgba(245, 240, 229, 0.8); }
.bg-paper { background: var(--color-paper); color: var(--color-text); }
.bg-paper .hl { color: var(--color-brand); }
.bg-paper .subtle { color: rgba(25, 21, 35, 0.7); }

/* 区块通用 */
.section { padding: var(--section-y) 0; position: relative; }
.section + .section { border-top: 1px solid rgba(25, 21, 35, 0.12); }
.bg-dark .section + .section { border-top-color: rgba(245, 240, 229, 0.15); }

/* 标题与眉标 */
.badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 0.75rem;
}
.badge span { display: inline-block; width: 1.5ch; height: 1px; background: currentColor; }
h1 { font-size: var(--h1-size); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 1rem; text-wrap: balance; }
h2 { font-size: var(--h2-size); font-weight: var(--font-title-weight); line-height: var(--line-height-title); margin-bottom: 1.5rem; text-wrap: balance; }
h3 { font-size: 1.15rem; font-weight: var(--font-title-weight); line-height: 1.35; margin: 1.5rem 0 0.5rem; }
p { max-width: 38em; margin-bottom: 1rem; }
.lead { font-size: 1.1rem; line-height: 1.6; margin-bottom: 2rem; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.5rem; border-radius: var(--radius-btn);
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  border: none; font-size: 1rem;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent); color: var(--color-dark);
}
.btn-primary:hover { transform: translateY(-1px); background: #d4f58a; }
.btn-secondary {
  background: transparent; border: 1px solid currentColor; color: inherit;
}
.bg-paper .btn-secondary { border-color: var(--color-text); color: var(--color-text); }
.bg-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn-secondary:hover { opacity: 0.85; }

/* 卡片与网格 */
.card {
  background: var(--color-paper); border: var(--card-border);
  border-radius: var(--radius-card); padding: 1.5rem;
  box-shadow: var(--card-shadow);
}
.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); }

/* 定义列表（功能项） */
.def-list { display: grid; gap: 1.5rem; }
.def-item dt { font-weight: 700; margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.5rem; }
.def-item dd { margin-left: 0; padding-left: 1.5rem; position: relative; color: var(--subtle, var(--color-text)); }
.def-item dd::before { content: ""; position: absolute; left: 0; top: 0.4em; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

/* 流程条 */
.flow-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 1.5rem 0; }
.flow-node {
  flex: 1; min-width: 140px; padding: 1rem; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-card);
  text-align: center; font-weight: 600;
}
.flow-arrow { width: 24px; height: 24px; flex-shrink: 0; opacity: 0.6; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; }
.data-table th, .data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(25,21,35,0.1); text-align: left; }
.data-table th { font-weight: 700; width: 40%; }
.bg-dark .data-table th, .bg-dark .data-table td { border-color: rgba(245,240,229,0.15); }

/* FAQ */
.faq-item { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); overflow: hidden; }
.faq-item summary {
  padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-weight: 400; opacity: 0.6; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 1.25rem 1rem; margin: 0; font-size: 0.95rem; line-height: 1.65; }

/* 步骤 */
.step-list { counter-reset: step; list-style: none; display: flex; flex-direction: column; gap: 1.25rem; }
.step-list li { position: relative; padding-left: 3rem; }
.step-list li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem; border-radius: 4px;
  background: var(--color-accent); color: var(--color-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.bg-paper .step-list li::before { background: var(--color-brand); color: var(--color-paper); }

/* SVG 基础 */
svg { display: block; width: 100%; height: auto; max-width: 100%; }
svg[aria-hidden="true"] { pointer-events: none; }

/* SVG 动效：网格节点依次点亮 */
@keyframes node-glow {
  0%, 100% { opacity: 0.15; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}
.node { animation: node-glow 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.node-1 { animation-delay: 0s; }
.node-2 { animation-delay: 0.5s; }
.node-3 { animation-delay: 1.0s; }
.node-4 { animation-delay: 1.5s; }
.node-5 { animation-delay: 2.0s; }
.node-6 { animation-delay: 2.5s; }
.node-7 { animation-delay: 3.0s; }
.node-8 { animation-delay: 3.5s; }

/* SVG 动效：描边流动 */
@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.dash-path {
  pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: dash-flow 2.5s ease-in-out infinite alternate;
}

/* SVG 动效：气泡呼吸 */
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-6px); opacity: 1; }
}
.bubble { animation: bubble-float 3.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.bubble-2 { animation-delay: 0.8s; }
.bubble-3 { animation-delay: 1.6s; }

/* 减少动态效果 */
@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;
  }
  .node, .dash-path, .bubble { animation: none !important; }
}

/* 兜底：裁掉横向溢出 */
div.layout-grid {
  overflow-x: clip;
}
