/**
 * 基础层：重置、排版、辅助类、无障碍。
 */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--ink-800);
  /**
   * 页面底色走变量：glass.css 会把 --page-bg 覆盖为 transparent，
   * 让 body::before 的极光壁纸透上来。用变量而非硬编码，
   * 可避免样式表加载顺序变化导致壁纸被纯色盖住。
   */
  background: var(--page-bg, var(--surface));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-ready {
  /* 渲染完成后再允许动画，避免首屏闪烁 */
  opacity: 1;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 var(--sp-3);
  color: var(--ink-900);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-md); }

p {
  margin: 0 0 var(--sp-4);
  color: var(--ink-600);
}

p:last-child { margin-bottom: 0; }

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

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

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

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== 辅助类 ===== */
.muted { color: var(--ink-500); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-modal);
  padding: var(--sp-3) var(--sp-5);
  background: var(--brand);
  color: #fff;
  border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  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.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
