/* ============================================================
   base.css — reset + 基础排版 + 可访问性
   ============================================================ */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 关键：组件的 display 会盖掉 UA 的 [hidden]，必须 !important */
[hidden] { display: none !important; }

h1, h2, h3, h4, p, ul, ol, dl, dd, blockquote {
  margin: 0;
  padding: 0;
}

/* figure 不在 reset 里就会带 UA 的 1em 40px，窄屏直接横向溢出 */
figure { margin: 0; }

ul, ol { list-style: none; }

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

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

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

/* ---------- 标题：衬线 + 米纸色 ---------- */
h1, h2, h3 {
  color: var(--text-1);
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0.01em;
  /* 标题变长后避免末行只剩两三个字 */
  text-wrap: balance;
}

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

/* ---------- 跳转链接 ---------- */
.skip {
  position: absolute;
  left: 50%;
  top: -60px;
  z-index: 99;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs-sm);
  transition: top 0.18s ease;
}
.skip:focus { top: 12px; }

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

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

.prose p + p { margin-top: var(--sp-4); }

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