/* ==========================================================================
   base.css — reset / 排版 / 可访问性基线
   ========================================================================== */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* reset：figure 必须清 margin，否则 UA 的 1em 40px 会顶破窄屏 */
h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
blockquote,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

strong {
  font-weight: 600;
}

/* 筛选靠 el.hidden 时，组件的 display 会盖掉 UA 的 [hidden]，必须 !important */
[hidden] {
  display: none !important;
}

/* ---------- 焦点可见 ---------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 2px;
}

.on-dark :focus-visible,
.site-footer :focus-visible {
  outline-color: #ffd9db;
}

/* ---------- 跳转主内容 ---------- */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: top var(--duration) ease;
}

.skip-link:focus-visible {
  top: var(--sp-4);
}

/* ---------- 屏幕阅读器专用 ---------- */
.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;
}

/* ---------- 长文档位：唯一阅读宽度档 ---------- */
.prose {
  max-width: var(--w-prose);
}

.prose > * + * {
  margin-top: 1em;
}

.prose h2 {
  font-size: var(--fs-h3);
  line-height: 1.45;
  margin-top: 1.8em;
}

.prose h3 {
  font-size: 16px;
  line-height: 1.5;
  margin-top: 1.6em;
  color: var(--text);
}

.prose p,
.prose li {
  color: var(--text-body);
  font-size: var(--fs-body);
  line-height: 1.85;
}

.prose ul {
  list-style: disc;
  padding-left: 1.25em;
}

.prose ul li + li {
  margin-top: 0.45em;
}

.prose a {
  color: var(--brand-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
