/* ============================================================
   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: 960px;
  --header-h: 64px;

  /* 排版 */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  font-size: 17px;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); transition: color 0.2s ease; }
a:hover { color: #3a0fb8; }

/* 标题与眉标 */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--color-text); }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.25; margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-brand);
  margin-bottom: 0.5rem;
}
.hl { color: var(--color-brand); }
.dark-surface .hl, .dark-surface .badge, .dark-surface a { color: var(--color-accent); }
.dark-surface h1, .dark-surface h2, .dark-surface h3, .dark-surface p, .dark-surface li { color: var(--color-paper); }

/* 容器与区块 */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding: var(--section-y) 0; }
.dark-surface { background: var(--color-dark); }

/* 页头页脚 */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--color-text); text-decoration: none; }
.brand img { height: 32px; width: auto; }
nav ul { display: flex; list-style: none; gap: 24px; }
nav a { color: var(--color-text); font-weight: 500; }
nav a[aria-current="page"] { color: var(--color-brand); border-bottom: 2px solid var(--color-brand); }
footer { background: var(--color-dark); color: var(--color-paper); padding: 64px 0 32px; }
footer .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
footer a { color: var(--color-accent); }
footer p { opacity: 0.8; font-size: 0.9rem; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 28px; font-weight: 600; font-size: 1rem;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #0a5c47; }
.btn-secondary { background: transparent; border: 2px solid var(--color-text); color: var(--color-text); }
.dark-surface .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }

/* 卡片与面板 */
.paper-card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

/* 棋盘布局 */
.chess-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; margin-bottom: var(--gap); }
.chess-row.reverse .text-col { order: 2; }
.chess-row.reverse .visual-col { order: 1; }
@media (max-width: 768px) {
  .chess-row, .chess-row.reverse { grid-template-columns: 1fr; }
  .chess-row.reverse .text-col { order: 1; }
  .chess-row.reverse .visual-col { order: 2; }
}

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.1); }
th { font-weight: 600; }
td:first-child { font-weight: 500; }

/* 步骤条 */
.steps { display: flex; gap: 24px; flex-wrap: wrap; }
.step { flex: 1 1 200px; position: relative; padding-left: 32px; }
.step::before {
  content: attr(data-step);
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px;
  background: var(--color-accent); color: var(--color-dark);
  font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
@media (max-width: 640px) { .steps { flex-direction: column; } }

/* 新闻网格 */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.news-card { background: var(--color-paper); border: var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--radius-card); padding: var(--gap); display: flex; flex-direction: column; }
.news-card time { font-size: 0.85rem; color: var(--color-brand); margin-bottom: 8px; display: block; font-weight: 600; }
.news-card h3 { margin-top: 0; font-size: 1.1rem; }
.news-card p { font-size: 0.95rem; color: #3a3545; margin-bottom: 0; }

/* FAQ */
details { margin-bottom: 1rem; border: var(--card-border); border-radius: var(--radius-card); background: var(--color-paper); }
summary { padding: 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::after { content: "+"; font-size: 1.5rem; font-weight: 400; }
details[open] summary::after { content: "-"; }
details[open] summary { border-bottom: 1px solid rgba(25, 21, 35, 0.1); }
details p { padding: 16px; margin: 0; font-size: 0.95rem; }

/* SVG 动效基类 */
svg { width: 100%; height: auto; }
.svg-group { transform-box: fill-box; transform-origin: center; }
.anim-fade { animation: fadeLoop 6s ease-in-out infinite; }
.anim-slide { animation: slideIn 8s ease-in-out infinite; }
.anim-breathe { animation: breathe 4s ease-in-out infinite; }
.anim-flow {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawFlow 10s linear infinite;
}
@keyframes fadeLoop { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes slideIn { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes drawFlow { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* 减少动态效果 */
@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-fade, .anim-slide, .anim-breathe, .anim-flow { animation: none !important; opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; }
}

/* 焦点与响应式微调 */
:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }
@media (max-width: 768px) {
  nav ul { gap: 16px; }
  .chess-row { gap: 24px; }
}

/* 兜底：裁掉横向溢出 */
#platform-support {
  overflow-x: clip;
}
