/* ==========================================================================
   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;
  background: var(--paper);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

img {
  height: auto;
}

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

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

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

h1, h2, h3 {
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0.01em;
}

strong {
  color: var(--text);
  font-weight: 700;
}

/* [hidden] 必须能压住组件的 display */
[hidden] {
  display: none !important;
}

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

/* 屏幕阅读器专用 */
.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: -100px;
  left: var(--sp-4);
  z-index: 100;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--text-invert);
  border-radius: var(--r-sm);
  font-size: var(--fs-meta);
  font-weight: 600;
}

.skip-link:focus {
  top: var(--sp-4);
  color: var(--text-invert);
}

/* 锚点定位时给固定站头留出空间 */
[id] {
  scroll-margin-block-start: 96px;
}
