/* =========================================================================
   base.css — reset、排版基线、可访问性基础
   ========================================================================= */

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

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

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

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

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

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

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

img {
  height: auto;
}

svg {
  flex: none;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-weak);
  color: var(--fg-primary);
}

/* ---------- 焦点 ---------- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- 通用工具 ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-pad);
}

.section--bordered {
  border-top: 1px solid var(--bd-subtle);
}

.section__head {
  max-width: 62ch;
  margin-bottom: var(--space-7);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  color: var(--fg-muted);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.section__lead {
  margin-top: var(--space-4);
  color: var(--fg-muted);
  max-width: 58ch;
}

.lede {
  color: var(--fg-secondary);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: calc(var(--z-toast) + 1);
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--fg-primary);
  color: var(--bg-page);
  font-size: var(--fs-sm);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 滚动进度条 ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-progress);
  height: 2px;
  pointer-events: none;
}

.progress__bar {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

/* ---------- 滚动渐入（仅在 JS 可用时启用初态） ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- 尊重减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 滚动条（不影响功能，仅收紧观感） ---------- */
@supports (scrollbar-width: thin) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--bd-strong) transparent;
  }
}

/* ---------- 打印时不隐藏内容（细节见 print.css） ---------- */
@media print {
  .js .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
