/* ============================================================
   拾句 · 基础层
   重置、排版、焦点可见、降级动效、无障碍工具类。
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 兜住任何逃逸出栅格的装饰元素（光斑、水印），
     防止它们把文档撑宽产生横向滚动条 */
  overflow-x: clip;
  /* 主题切换时底色平滑过渡，避免切换瞬间闪一下 */
  transition: background-color var(--dur-slow) var(--ease-soft),
              color var(--dur-slow) var(--ease-soft);
}

/* 滚动条也跟随主题：暗色下系统默认的浅色滚动条会非常刺眼 */
:root { scrollbar-color: var(--text-faint) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--text-faint);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: content-box; }

/* 表单控件与画布跟随主题的默认字形色 */
::selection { background: var(--accent-soft); color: var(--text); }

/* 滚动锁定：打开详情弹层时使用 */
body.is-locked { overflow: hidden; }

h1, h2, h3, p, blockquote, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  /* 触摸目标 ≥ 44×44 */
  min-height: 44px;
}

/* ---------- 焦点可见：2px 描边 + 2px 偏移 ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
/* 鼠标点击不显示焦点圈 */
:focus:not(:focus-visible) { outline: none; }

/* ---------- 屏幕阅读器专用 ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 跳转到主内容（键盘用户） ---------- */
.skip-link {
  position: absolute;
  top: var(--sp-3); left: var(--sp-3);
  z-index: 200;
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--r-full);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ---------- 数字统一等宽 ---------- */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   降级动效：尊重系统"减少动态效果"设置
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  .orb, .bg-aurora, .bg-stars, .watermark, .marquee__track { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
