/* ============================================================
   base.css — reset + 排版 + 焦点可见
   ============================================================ */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* figure 不进 reset 会带 UA 默认 margin: 1em 40px，窄视口直接横向溢出 */
figure { margin: 0; }

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

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-hero); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p, ul, ol, dl, blockquote, pre { margin: 0; }

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

a {
  color: var(--brand-ink-deep);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

a:hover { color: var(--brand-soft); }

strong, b { color: var(--text); font-weight: 600; }

code, kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.42em;
  color: var(--brand-soft);
}

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

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

/* [hidden] 必须带 !important —— .qa{display:flex} 会盖掉 UA 的 [hidden]{display:none} */
[hidden] { display: none !important; }

::selection {
  background: var(--brand);
  color: var(--text-invert);
}

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

/* ---- 跳转链接 ---- */
.skip-link {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -160%);
  z-index: 200;
  background: var(--brand);
  color: var(--text-invert);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
  color: var(--text-invert);
}

/* ---- 屏幕阅读器专用 ---- */
.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: var(--sp-4); }

.prose h2 {
  font-size: var(--fs-xl);
  margin-top: var(--sp-7);
}

.prose h3 {
  font-size: var(--fs-lg);
  margin-top: var(--sp-6);
  color: var(--brand-soft);
}

.prose p { color: var(--text-body); }

.prose ul { display: grid; gap: var(--sp-2); }

.prose ul li {
  position: relative;
  padding-left: var(--sp-5);
  color: var(--text-body);
}

.prose ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.prose blockquote {
  border-left: 3px solid var(--brand);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-body);
  font-size: var(--fs-sm);
}

/* 移动端字号整体降档 —— 改一处全站生效 */
@media (max-width: 720px) {
  :root {
    --fs-md:  16px;
    --fs-lg:  18px;
    --fs-xl:  22px;
    --fs-2xl: 27px;
    --lh-body: 1.75;
  }
}

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