/* ============================================================
   知之书屋 · 基础层：重置、排版、焦点、降级动效
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400; /* 楷体用常规字重，靠字号与留白立层级 */
  line-height: 1.15;
}

h1 { font-size: var(--fs-hero); letter-spacing: -0.01em; line-height: 1.18; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { max-width: 62ch; }

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

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

/* 键盘焦点：2px 描边 + 2px 偏移，不吞没楷体轮廓 */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--color-tape); }

/* 滚动触发入场：只动 opacity 与 translateY */
.reveal {
  opacity: 0;
  transform: translateY(24px);
}
.reveal.in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
/* 入场错峰：组间隔 80ms */
.reveal.in:nth-child(2) { transition-delay: 80ms; }
.reveal.in:nth-child(3) { transition-delay: 160ms; }
.reveal.in:nth-child(4) { transition-delay: 240ms; }
.reveal.in:nth-child(5) { transition-delay: 320ms; }

/* 降级：偏好减弱动效时全部关闭 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
