/* SafeW 全站共享样式 */
:root {
  /* 色板 */
  --color-dark: #19102D;
  --color-paper: #F4F3F7;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;
  
  /* 结构性约束 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  /* 排版与节奏 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --lh-tight: 1.15;
  --lh-body: 1.75;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-paper);
  line-height: var(--lh-body);
  -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 {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 面与取色变量控制 */
.surface-paper { background: var(--color-paper); color: var(--color-text); }
.surface-dark { background: var(--color-dark); color: var(--color-paper); }
.surface-dark .hl { color: var(--color-accent); }
.surface-dark .subtext { color: rgba(244, 243, 247, 0.75); }
.surface-paper .hl { color: var(--color-brand); }
.surface-paper .subtext { color: var(--color-text); }

/* 标题系统 */
.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  display: inline-block;
}
.surface-paper .section-label { color: var(--color-brand); }
.surface-dark .section-label { color: var(--color-accent); }

h1, h2, h3, h4 { font-weight: 500; line-height: var(--lh-tight); letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 0.6em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 0.5em; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.4em; }
p { margin-bottom: 1em; max-width: 38em; }
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* 区块结构 */
.section {
  padding: var(--section-y) 0;
  position: relative;
}
.section + .section { margin-top: var(--gap); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
}
.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.surface-paper .btn-secondary { color: var(--color-text); border-color: var(--color-text); }

/* 卡片与面板 */
.card {
  background: rgba(0, 0, 0, 0.03);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: background 0.2s ease;
}
.surface-dark .card { background: rgba(255, 255, 255, 0.04); }
.card:hover { background: rgba(0, 0, 0, 0.06); }
.surface-dark .card:hover { background: rgba(255, 255, 255, 0.08); }

.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}
.surface-paper .panel { background: var(--color-dark); }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.surface-dark .data-table th, .surface-dark .data-table td { border-bottom-color: rgba(255,255,255,0.15); }
.data-table th { font-weight: 600; }
.surface-dark .data-table th { color: var(--color-accent); }

/* 列表与定义 */
.definition-list dt { font-weight: 600; margin-top: 1.2em; margin-bottom: 0.3em; color: var(--color-brand); }
.surface-dark .definition-list dt { color: var(--color-accent); }
.definition-list dd { margin-left: 0; margin-bottom: 0.8em; }

/* 步骤与编号 */
.step-item { display: flex; gap: 1.5em; margin-bottom: 1.5em; }
.step-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: var(--radius-card);
}

/* FAQ */
.faq details {
  margin-bottom: 1em;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-card);
  padding: 1em;
}
.surface-dark .faq details { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 2em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.faq details[open] summary::after { content: "-"; }
.faq p { margin-top: 0.8em; margin-bottom: 0; }

/* 网格 */
.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); }

/* 导航与页脚 */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.surface-dark .header { background: rgba(25, 16, 45, 0.9); border-bottom-color: rgba(255,255,255,0.1); }
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}
.brand { font-weight: 700; font-size: 1.2rem; display: flex; align-items: center; gap: 0.5em; }
.brand img { height: 28px; width: auto; }
.nav-links { display: flex; gap: 2em; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-brand); }
.surface-dark .nav-links a:hover, .surface-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

.footer {
  padding: 4em 0 2em;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-top: var(--gap);
}
.surface-dark .footer { border-top-color: rgba(255,255,255,0.1); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: 2em; }
.footer-col h4 { font-weight: 600; margin-bottom: 1em; }
.footer-col ul li { margin-bottom: 0.6em; }
.footer-col a { opacity: 0.8; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; }
.copyright { font-size: 0.85rem; opacity: 0.7; text-align: center; margin-top: 2em; }

/* SVG 动效类 */
.anim-float { animation: floatY 6s ease-in-out infinite; }
.anim-float-delay { animation: floatY 6s ease-in-out infinite 2s; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 4s ease forwards; }
.anim-breathe { animation: breathe 3s ease-in-out infinite; }
.anim-slide-in { animation: slideIn 5s ease forwards; }
.anim-opacity-loop { animation: fadeLoop 7s ease-in-out infinite; }

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes slideIn {
  0% { transform: translateX(40px); opacity: 0; }
  15% { transform: translateX(0); opacity: 1; }
  85% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(40px); opacity: 0; }
}
@keyframes fadeLoop {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 子元素旋转/缩放中心修正 */
.glow-group, .spin-group, .scale-group {
  transform-box: fill-box;
  transform-origin: center;
}

/* 减少动态效果 */
@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;
  }
  html { scroll-behavior: auto; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .step-item { flex-direction: column; gap: 0.8em; }
  .nav-links { gap: 1em; }
  .btn { width: 100%; justify-content: center; }
  
  /* 修复横向溢出：限制容器宽度并处理内部元素 */
  body { overflow-x: hidden; }
  .container { max-width: 100%; padding-left: 16px; padding-right: 16px; }
  section > .container { max-width: 100%; }
  
  /* 防止表格和长链接溢出 */
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  a { word-break: break-all; }
  
  /* 确保 Hero 区域 SVG 不溢出 */
  svg { max-width: 100%; height: auto; }
}
