/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #271231;
  --color-paper: #F6F3F7;
  --color-text: #1F1523;
  --color-brand: #9E13DD;
  --color-accent: #ED6EC0;

  /* 主题变量（纸面默认） */
  --color-bg: var(--color-paper);
  --color-fg: var(--color-text);
  --color-hl: var(--color-brand);
  --color-link: var(--color-brand);
  --color-border: rgba(31, 21, 35, 0.12);

  /* 结构 Token */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(31, 21, 35, 0.3);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --border-thick: 1px;

  /* 字体栈 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 深色面覆盖 */
.bg-dark {
  --color-bg: var(--color-dark);
  --color-fg: var(--color-paper);
  --color-hl: var(--color-accent);
  --color-link: var(--color-accent);
  --color-border: rgba(246, 243, 247, 0.15);
}

/* 深色面内的浅色卡片恢复纸面取色 */
.bg-dark .card-light {
  --color-bg: var(--color-paper);
  --color-fg: var(--color-text);
  --color-hl: var(--color-brand);
  --color-link: var(--color-brand);
  --color-border: rgba(31, 21, 35, 0.12);
}

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-fg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--color-link); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.85; }
a:focus-visible { outline: 2px solid var(--color-hl); outline-offset: 2px; }

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* 排版 */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; max-width: 38em; }
ul, ol { padding-left: 1.25rem; margin-bottom: 1rem; }
li { margin-bottom: 0.5rem; }

/* 眉标 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-hl);
  margin-bottom: 0.75rem;
}
.eyebrow::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 2px;
  background: currentColor;
}

/* 高亮词 */
.hl { color: var(--color-hl); font-weight: 600; }

/* 组件：按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: var(--border-thick) solid transparent;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border-color: var(--color-accent);
}
.btn-primary:hover { background: #d95aad; border-color: #d95aad; transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--color-fg);
  border-color: var(--color-fg);
}
.btn-secondary:hover { background: rgba(31, 21, 35, 0.05); transform: translateY(-1px); }
.bg-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.bg-dark .btn-secondary:hover { background: rgba(246, 243, 247, 0.08); }

/* 组件：卡片 */
.card {
  background: var(--color-bg);
  border: var(--card-border) solid var(--color-border);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  border-radius: var(--radius-card);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: 0 14px 32px -12px rgba(31, 21, 35, 0.35); }

/* 组件：表格 */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.85rem 1rem;
  border-bottom: var(--border-thick) solid var(--color-border);
  text-align: left;
}
th { font-weight: 600; color: var(--color-hl); }
td:first-child { font-weight: 600; }

/* 组件：FAQ */
details {
  border: var(--border-thick) solid var(--color-border);
  margin-bottom: 0.75rem;
  border-radius: var(--radius-card);
}
summary {
  padding: 1rem;
  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-size: 1.25rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 1rem 1rem; margin: 0; }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: var(--border-thick) solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.site-header.scrolled {
  border-bottom-color: var(--color-border);
  background: rgba(246, 243, 247, 0.95);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; color: var(--color-fg); }
.brand img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { color: var(--color-fg); font-weight: 500; font-size: 0.95rem; }
.nav a[aria-current="page"] { color: var(--color-hl); }
@media (max-width: 768px) {
  .nav { display: none; }
}

/* 页脚 */
.site-footer {
  padding: 3rem 0;
  border-top: var(--border-thick) solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-fg);
  opacity: 0.85;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--color-link); }

/* SVG 基础与动效 */
.svg-panel { width: 100%; height: auto; }
svg { transform-box: fill-box; transform-origin: center; }

@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 6s linear infinite;
}

@keyframes gentle-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-float { animation: gentle-float 8s ease-in-out infinite; }

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.anim-pulse { animation: pulse-opacity 5s ease-in-out infinite; }

@keyframes slide-cycle {
  0%, 100% { transform: translateX(0); opacity: 0.8; }
  50% { transform: translateX(-4px); opacity: 1; }
}
.anim-slide { animation: slide-cycle 7s ease-in-out infinite; }

/* 减少动态效果 */
@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-float, .anim-pulse, .anim-slide { animation: none; }
}

/* 响应式网格 */
.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); }
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.text-right { text-align: right; }
@media (max-width: 768px) {
  .text-right { text-align: left; }
}
