/* =========================================
   SafeW 全站共享样式
   ========================================= */

:root {
  /* 色板 */
  --color-dark: #140E25;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;

  /* 结构 Token */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --header-h: 64px;

  /* 排版 */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 布局容器 */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section-wrap {
  padding-block: var(--section-y);
}
.section-wrap.dark { background: var(--color-dark); }
.section-wrap.paper { background: var(--color-paper); }

/* 页头 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(252, 252, 253, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.section-wrap.dark ~ .site-header,
.site-header.dark {
  background: rgba(20, 14, 37, 0.9);
  border-bottom-color: rgba(252, 252, 253, 0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand img { height: 32px; width: auto; display: block; }
.brand span { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.nav-list {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  text-decoration: none;
  color: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
.nav-list a:hover,
.nav-list a[aria-current="page"] {
  border-bottom-color: var(--color-brand);
}
.section-wrap.dark .nav-list a { color: var(--color-paper); }
.section-wrap.dark .nav-list a:hover,
.section-wrap.dark .nav-list a[aria-current="page"] { border-bottom-color: var(--color-accent); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}
.section-wrap.dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn-secondary:hover { background: rgba(25, 21, 35, 0.05); }
.section-wrap.dark .btn-secondary:hover { background: rgba(252, 252, 253, 0.08); }

/* 眉标与标题 */
.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--color-brand);
}
.section-wrap.dark .tag { color: var(--color-accent); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: 0.02em; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 24px; }
h3 { font-size: 1.25rem; margin-top: 24px; margin-bottom: 12px; }
.hl { color: var(--color-brand); }
.section-wrap.dark .hl { color: var(--color-accent); }

/* 卡片与网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: var(--gap);
}
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-2px); }
.section-wrap.dark .card { background: var(--color-paper); color: var(--color-text); }

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  text-align: left;
}
.data-table th { font-weight: 700; color: var(--color-brand); }
.section-wrap.dark .data-table th { color: var(--color-accent); }
.data-table tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  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-size: 1.2rem; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 20px 16px; line-height: 1.7; }

/* 杂志式长文布局 */
.magazine-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--gap);
  align-items: start;
}
.toc-nav {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  background: rgba(25, 21, 35, 0.03);
  border: 1px solid rgba(25, 21, 35, 0.08);
  border-radius: var(--radius-card);
  padding: 16px;
}
.toc-nav ul { list-style: none; padding: 0; margin: 0; }
.toc-nav li { margin-bottom: 8px; }
.toc-nav a {
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.9rem;
  display: block;
  padding: 4px 0;
  border-left: 2px solid transparent;
  padding-left: 8px;
  transition: border-color 0.2s;
}
.toc-nav a:hover { border-left-color: var(--color-brand); }
.section-wrap.dark .toc-nav { background: rgba(252, 252, 253, 0.05); border-color: rgba(252, 252, 253, 0.1); }
.section-wrap.dark .toc-nav a { color: var(--color-paper); }
.section-wrap.dark .toc-nav a:hover { border-left-color: var(--color-accent); }

/* 定义列表风格功能块 */
.feature-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.feature-name { font-weight: 700; font-size: 1.1rem; }
.feature-desc { color: rgba(25, 21, 35, 0.85); }
.section-wrap.dark .feature-row { border-bottom-color: rgba(252, 252, 253, 0.1); }
.section-wrap.dark .feature-desc { color: rgba(252, 252, 253, 0.85); }

/* SVG 容器 */
.svg-panel {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}
.svg-panel svg { width: 100%; height: auto; display: block; }

/* 动效类 */
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 5s ease-in-out infinite;
}
.anim-float {
  animation: floatUp 6s ease-in-out infinite;
}
.anim-float-delay-1 { animation-delay: -1.5s; }
.anim-float-delay-2 { animation-delay: -3s; }
.anim-node {
  animation: nodeLight 4s ease-in-out infinite;
}
.anim-node:nth-child(odd) { animation-duration: 5s; animation-delay: 0.2s; }
.anim-node:nth-child(even) { animation-duration: 4.5s; animation-delay: 0.8s; }

@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}
@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes nodeLight {
  0%, 100% { opacity: 0.2; r: 3; }
  50% { opacity: 1; r: 4.5; }
}

@media (prefers-reduced-motion: reduce) {
  .anim-draw, .anim-float, .anim-float-delay-1, .anim-float-delay-2, .anim-node {
    animation: none !important;
  }
  .magazine-layout { grid-template-columns: 1fr; }
  .toc-nav { position: static; margin-bottom: 24px; }
}

@media (max-width: 768px) {
  .magazine-layout { grid-template-columns: 1fr; }
  .toc-nav { position: static; margin-bottom: 24px; }
  .feature-row { grid-template-columns: 1fr; gap: 8px; }
  .nav-list { display: none; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
