/* ============================================================
 * base.css —— 重置 / 排版 / 焦点 / 降级动效 / 氛围层
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

h1, h2, h3 { line-height: 1.1; font-weight: 400; }

/* 展示字 */
.display {
  font-family: var(--font-display);
  letter-spacing: 0.02em;   /* 黄油体自带笔触，负字距会糊，改用微正字距 */
  line-height: 1.08;
}

/* 等宽数字 */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* 高亮词（config 里 *星号* 标记） */
.hl { color: var(--acid); }

/* 页面氛围：课表网格 + 渐变光斑 + 颗粒，全部 fixed 不参与布局 */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(56rem 40rem at 8% -12%, rgba(43, 70, 245, 0.30), transparent 62%),
    radial-gradient(44rem 32rem at 96% 4%, rgba(43, 70, 245, 0.16), transparent 58%),
    radial-gradient(30rem 24rem at 78% 88%, rgba(198, 242, 78, 0.07), transparent 60%);
}
.atmosphere::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(242, 239, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 239, 230, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(#000 0%, #000 55%, transparent 95%);
  -webkit-mask-image: linear-gradient(#000 0%, #000 55%, transparent 95%);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* 内容层全部位于氛围之上 */
nav, main, footer { position: relative; z-index: 2; }

/* 布局容器 */
.container { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--space-4); }

/* 焦点可见性 */
:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
  border-radius: 2px;
}

/* 选区 */
::selection { background: var(--acid); color: var(--ink-900); }

/* ---------- 滚动入场（JS 加 .in 触发） ---------- */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
/* 错峰：组内第 2~5 个依次延迟 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; }

/* 首屏加载序列（一次性编排，JS 在 DOMContentLoaded 后给 .boot 加 .go） */
.boot > * { opacity: 0; transform: translateY(28px); }
.boot.go > * {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.boot.go > *:nth-child(1) { transition-delay: 60ms; }
.boot.go > *:nth-child(2) { transition-delay: 160ms; }
.boot.go > *:nth-child(3) { transition-delay: 280ms; }
.boot.go > *:nth-child(4) { transition-delay: 420ms; }

/* 降级：用户偏好减少动效时，全部动效关闭、内容直接可见 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .boot > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
