/* ============================================================================
 * 萌学园 · 基础层（重置 + 页面骨架）
 * 只依赖 tokens.css。学科页可以直接用 .page / .page-head / .page-body 这套骨架。
 * ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

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

/* 键盘可达性：统一焦点环（不要用 outline:none 抹掉） */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-btn);
}

/* 无障碍：只给读屏用的文字 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 跳过导航（键盘用户） */
.skip-link {
  position: absolute; left: var(--s4); top: -60px;
  z-index: 100; padding: var(--s2) var(--s4);
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--r-btn);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s4); }

/* ---------------------------------------------------------------- 页面骨架 */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.page-body {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s6) var(--s5) var(--s8);
}

.page-foot {
  padding: var(--s5);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
  border-top: 1px solid var(--line);
}

/* 小屏收敛（iPad / 学习机是主要设备，手机也要能用） */
@media (max-width: 720px) {
  :root { --fs-hero: 26px; --fs-h1: 21px; }
  .page-head { padding: var(--s3) var(--s4); }
  .page-body { padding: var(--s5) var(--s4) var(--s7); }
}
