/* =========================================
   SafeW 全站共享样式
   ========================================= */
:root {
  /* 色板 */
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-text: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;

  /* 结构 Token */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(21, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --body-lh: 1.65;

  /* 动态表面变量（由 .surface-dark / .surface-light 覆盖） */
  --surface-bg: var(--color-paper);
  --surface-text: var(--color-text);
  --surface-highlight: var(--color-brand);
}

/* 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: var(--body-lh);
  color: var(--surface-text);
  background: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--surface-highlight); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 容器与布局 */
.container { max-width: var(--content-max); margin-inline: auto; padding-inline: var(--gap); }
.section { padding-block: var(--section-y); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* 表面层颜色控制 */
.surface-dark {
  --surface-bg: var(--color-dark);
  --surface-text: var(--color-paper);
  --surface-highlight: var(--color-accent);
  background: var(--color-dark);
  color: var(--color-paper);
}
.surface-light {
  --surface-bg: var(--color-paper);
  --surface-text: var(--color-text);
  --surface-highlight: var(--color-brand);
  background: var(--color-paper);
  color: var(--color-text);
}
/* 深色面内的浅色卡片恢复纸面取色 */
.surface-light.card-inner {
  background: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
}
.surface-light.card-inner .hl { color: var(--color-brand); }

/* 标题系统 */
.label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.label::before { content: ""; display: inline-block; width: 1.2em; height: 2px; background: var(--surface-highlight); border-radius: 2px; }
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 0.6em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.5em;
  text-wrap: balance;
}
h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.4em;
}
p { margin-bottom: 1em; max-width: 38em; }
.hl { color: var(--surface-highlight); font-weight: 700; }

/* 按钮 */
.btn-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5em; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--surface-highlight); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  color: var(--surface-text);
  border: 1px solid var(--surface-text);
}
.btn-secondary:hover { background: rgba(0,0,0,0.05); transform: translateY(-1px); }
.surface-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.surface-dark .btn-secondary:hover { background: rgba(255,255,255,0.08); }

/* 卡片与面板 */
.card {
  background: var(--surface-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); }
.panel {
  background: var(--surface-bg);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  overflow: hidden;
}
.surface-dark .panel { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }

/* 表格 */
.table-wrap { overflow-x: auto; margin-top: 1em; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(128,128,128,0.2); }
th { font-weight: 700; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* FAQ / Details */
details {
  border: var(--card-border);
  border-radius: 12px;
  margin-bottom: 12px;
  background: var(--surface-bg);
  overflow: hidden;
}
summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; color: var(--surface-highlight); transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
.details-content { padding: 0 20px 16px; line-height: 1.6; }

/* 页头页脚 */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 240, 229, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background 0.3s, border-color 0.3s;
}
.surface-dark .site-header { background: rgba(16, 17, 45, 0.9); border-bottom-color: rgba(255,255,255,0.08); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--surface-text); text-decoration: none; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; }
.nav a[aria-current="page"], .nav a:hover { color: var(--surface-highlight); }
.site-footer { border-top: 1px solid rgba(128,128,128,0.2); padding: 48px 0 32px; background: var(--surface-bg); color: var(--surface-text); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; margin-bottom: 32px; }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; }
.footer-col a { display: block; margin-bottom: 8px; font-size: 0.9rem; }
.copyright { text-align: center; font-size: 0.8rem; opacity: 0.7; }

/* SVG 基础与动效类 */
.svg-anim { width: 100%; height: auto; }
.svg-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes drawLine { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
.anim-draw { animation: drawLine 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.anim-float { animation: floatY 4s ease-in-out infinite; }
.anim-float-delay { animation: floatY 4s ease-in-out infinite 1.2s; }

@keyframes pulseDot { 0%, 100% { opacity: 0.4; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
.anim-pulse { animation: pulseDot 2s ease-in-out infinite; }

@keyframes rotateShape { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.anim-rotate { animation: rotateShape 12s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-rotate-rev { animation: rotateShape 15s linear infinite reverse; transform-box: fill-box; transform-origin: center; }

@keyframes slideInX { 0% { transform: translateX(-12px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
.anim-slide { animation: slideInX 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-draw, .anim-float, .anim-float-delay, .anim-pulse, .anim-rotate, .anim-rotate-rev, .anim-slide {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .svg-draw { stroke-dashoffset: 0 !important; }
}

/* 响应式微调 */
@media (max-width: 768px) {
  .nav { display: none; } /* 移动端简化导航，实际项目可加汉堡菜单，此处按规则保持简洁 */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .btn-group { flex-direction: column; width: 100%; }
  .btn { width: 100%; }
}
