/* ==========================================================================
   base.css — reset + 基础排版 + 无障碍基线
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--f-body);
  line-height: 1.7;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* figure 不在浏览器默认 reset 里，带着 1em 40px 的 margin，窄屏直接顶破布局 */
h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd, ul, ol, pre {
  margin: 0;
}

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

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

img {
  height: auto;
}

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

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

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

/* 组件的 display 会盖掉 UA 的 [hidden]，这条必须带 !important */
[hidden] {
  display: none !important;
}

/* 焦点可见：不摘掉默认焦点，只把它做得更像设计的一部分 */
:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--brand-surface);
  color: var(--brand-ink);
}

.skip-link {
  position: absolute;
  top: -64px;
  left: 16px;
  z-index: 99;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  font-size: var(--f-sm);
  transition: top 0.18s var(--ease);
}

.skip-link:focus {
  top: 14px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 锚点跳转要给固定站头让位，否则目标标题被压在栏下 --------------------- */
:target {
  scroll-margin-top: 96px;
}
