/* ==========================================================================
   base.css — reset · 排版 · 无障碍工具类
   依赖：tokens.css
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 禁下拉刷新，避免误触丢失滚动位置 */
  overscroll-behavior-y: contain;
}

body {
  margin: 0;
  background: var(--bg-1);
  color: var(--txt-1);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* 移动端底部 Tab 栏占位（桌面端由 layout.css 复位） */
  padding-bottom: calc(var(--h-tabbar) + env(safe-area-inset-bottom) + var(--sp-4));
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
figure { margin: 0; }             /* UA 默认 margin:1em 40px 会顶破移动端 */

a { color: inherit; text-decoration: none; }
a:hover { color: var(--acc-400); }

img, svg, video {
  max-width: 100%;
  display: block;
}
img { height: auto; background: var(--bg-4); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; }

strong, b { font-weight: 700; }

table { border-collapse: collapse; border-spacing: 0; }

/* hidden 必须压过组件的 display（筛选/折叠全靠它） */
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   排版尺度（中文只用 400 / 500 / 700；800/900 仅数字与拉丁）
   -------------------------------------------------------------------------- */
.h1, h1 { font-size: 26px; line-height: 1.30; font-weight: 700; }
.h2, h2 { font-size: 21px; line-height: 1.30; font-weight: 700; }
.h3, h3 { font-size: 17px; line-height: 1.40; font-weight: 700; }
.label {
  font-size: 12px;
  line-height: 1.20;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* 长文阅读块：全站唯一阅读宽度档，一个元素只挂这一个宽度类 */
.prose {
  max-width: var(--w-prose);
  color: var(--txt-2);
  line-height: 1.9;
}
.prose p { margin-bottom: var(--sp-3); }
.prose p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   焦点可见（P0：现网缺口最大的一项）
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--acc-400);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------------------
   无障碍工具类
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  z-index: var(--z-toast);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--acc-400);
  color: var(--acc-ink);
  font-weight: 700;
  transition: top var(--dur-3) var(--ease-out);
}
.skip-link:focus { top: var(--sp-3); }

/* --------------------------------------------------------------------------
   图片失败占位：尺寸不变（防 CLS），用首字兜底
   -------------------------------------------------------------------------- */
.img-failed {
  background: linear-gradient(135deg, var(--bg-5), var(--bg-3));
  position: relative;
  overflow: hidden;
}
.img-failed::after {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--txt-3);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   横滑容器：右缘渐隐提示还有内容
   -------------------------------------------------------------------------- */
.scroller {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
