/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* 1. 设计变量与 Token */
:root {
  /* 色板 */
  --bg-dark: #141838;
  --bg-paper: #FCFCFD;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;

  /* 圆角 */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* 卡片边界与阴影 */
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  /* 节奏与密度 */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --line-height-body: 1.55;

  /* 内容宽度 */
  --content-max: 1280px;

  /* 字体栈 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-paper);
  color: var(--color-text);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }

/* 上下文取色覆盖 */
.section-dark { background: var(--bg-dark); color: var(--bg-paper); }
.section-dark .hl { color: var(--color-accent); }
.section-dark .eyebrow { color: var(--color-accent); }
.section-dark .card { background: var(--bg-paper); color: var(--color-text); border-color: var(--color-text); }
.section-dark .btn-secondary { color: var(--bg-paper); border-color: var(--bg-paper); }
.section-dark table { color: var(--bg-paper); }
.section-dark th, .section-dark td { border-bottom-color: rgba(252, 252, 253, 0.2); }

/* 布局容器 */
.container { width: min(var(--content-max), 100% - 2rem); margin-inline: auto; }
section { padding-block: var(--section-y); }
.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: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* 排版层级 */
h1, h2, h3 { line-height: 1.2; margin-bottom: var(--gap); font-weight: 700; letter-spacing: 0.02em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin-bottom: var(--gap); max-width: 38em; }
.eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.5rem; color: var(--color-brand); }

/* 组件：按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.875rem 1.5rem; font-weight: 600; font-size: 1rem;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.btn-primary { background: var(--color-accent); color: var(--bg-dark); }
.btn-primary:hover { background: #5a9ae0; }
.btn-secondary { background: transparent; border: 2px solid var(--color-text); color: var(--color-text); }
.btn-secondary:hover { background: rgba(21, 23, 35, 0.05); }
.section-dark .btn-primary { background: var(--color-accent); color: var(--bg-dark); }
.section-dark .btn-primary:hover { background: #5a9ae0; }
.section-dark .btn-secondary { border-color: var(--bg-paper); color: var(--bg-paper); }
.section-dark .btn-secondary:hover { background: rgba(252, 252, 253, 0.1); }

/* 组件：卡片 */
.card {
  background: var(--bg-paper); border: var(--card-border);
  border-radius: var(--radius-card); box-shadow: var(--card-shadow);
  padding: var(--gap); display: flex; flex-direction: column;
}
.card h3 { margin-top: 0; }

/* 组件：表格 */
table { width: 100%; border-collapse: collapse; margin-top: var(--gap); font-size: 0.95rem; }
th, td { padding: 0.85rem 1rem; border-bottom: 1px solid rgba(21, 23, 35, 0.15); text-align: left; vertical-align: top; }
th { font-weight: 700; width: 40%; }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* 组件：FAQ */
details {
  border: var(--card-border); border-radius: var(--radius-card);
  padding: var(--gap); margin-bottom: var(--gap); background: var(--bg-paper);
}
summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-left: 1.5rem; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; position: absolute; left: 0; color: var(--color-brand); font-weight: 700; }
details[open] summary::before { content: "-"; }
details p { margin-top: var(--gap); margin-bottom: 0; }

/* 页头与页脚 */
header { position: sticky; top: 0; z-index: 10; background: rgba(252, 252, 253, 0.95); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(21, 23, 35, 0.1); }
.section-dark header { background: rgba(20, 24, 56, 0.95); border-bottom-color: rgba(252, 252, 253, 0.1); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; padding-block: 1rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; }
.nav-links a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.section-dark .nav-links a[aria-current="page"] { color: var(--color-accent); }

footer { padding-block: var(--section-y); border-top: 1px solid currentColor; margin-top: var(--section-y); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--gap); }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-copy { font-size: 0.85rem; opacity: 0.8; }

/* 3. SVG 动效定义 */
.svg-wrap { width: 100%; height: auto; max-width: 100%; overflow: hidden; }
.anim-rotate { animation: geo-spin 10s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: geo-float 6s ease-in-out infinite alternate; }
.anim-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: geo-draw 5s ease-in-out infinite alternate; }
.anim-pulse { animation: geo-pulse 4s ease-in-out infinite; }

@keyframes geo-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes geo-float { 0% { transform: translateY(0); } 100% { transform: translateY(-8px); } }
@keyframes geo-draw { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes geo-pulse { 0%, 100% { opacity: 0.6; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.05); } }

/* 4. 无障碍与减少动态效果 */
@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 { stroke-dashoffset: 0 !important; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
