/* 层序声明：tokens.css 已先声明 tokens 层，这里补齐其余层的顺序 */
@layer tokens, base, layout, components, pages, utilities;

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
    font-synthesis: none;
    color-scheme: dark;
    background: var(--bg);
  }
  html[data-surface="paper"] { color-scheme: light; }
  body {
    min-height: 100dvh;
    font-family: var(--font-cjk);
    font-size: var(--t-base);
    line-height: var(--lh-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
  }
  img, picture, video, canvas, svg { display: block; max-width: 100%; }
  img, video { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; padding: 0; cursor: pointer; }
  p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
  ul, ol { padding-inline-start: 1.25em; }
  a { color: var(--cyan-ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
  a:hover { text-decoration-thickness: 2px; }
  :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
  ::selection { background: var(--cyan); color: var(--btn-ink); }
  hr { border: 0; border-top: 1px solid var(--line); }
  code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }
  table { border-collapse: collapse; }
  summary { cursor: pointer; }
  [hidden] { display: none; }

  /* 展示字体只用于标题/数字/版本（设计 §6.3） */
  h1, h2, .display, .metric, .version, .table-num {
    font-family: var(--font-display);
    letter-spacing: -.01em;
    font-weight: 700;
    line-height: var(--lh-tight);
  }
  .version, .table-num, .metric { font-variant-numeric: tabular-nums; }
  h1 { font-size: var(--t-2xl); text-wrap: balance; }
  h2 { font-size: var(--t-xl); text-wrap: balance; }
  h3 { font-size: var(--t-lg); line-height: var(--lh-snug); font-weight: 600; text-wrap: balance; }
  h4 { font-size: var(--t-base); line-height: var(--lh-snug); font-weight: 600; }
  .mono { font-family: var(--font-mono); font-size: var(--t-sm); letter-spacing: .02em; }
  .muted { color: var(--muted); }
  .small { font-size: var(--t-sm); }
  .lead { font-size: var(--t-lg); line-height: var(--lh-snug); color: var(--muted); text-wrap: pretty; }
  .eyebrow {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--cyan-ink);
  }
  .amber { color: var(--amber); }

  .icon { width: 24px; height: 24px; flex: none; fill: none; }
  .icon-sm { width: 16px; height: 16px; }
  .icon-lg { width: 32px; height: 32px; }

  .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; inset-inline-start: var(--s-4); top: -100px; z-index: calc(var(--z-nav) + 1);
    padding: var(--s-2) var(--s-4); background: var(--cyan); color: var(--btn-ink);
    border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
  }
  .skip-link:focus-visible { top: var(--s-4); }

  /* 滚动显现：仅在 JS 可用时隐藏，IntersectionObserver 加 is-in */
  html.js .reveal { opacity: 0; transform: translateY(14px); }
  html.js .reveal.is-in { opacity: 1; transform: none; transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
  html.js .reveal[data-delay="1"].is-in { transition-delay: 80ms; }
  html.js .reveal[data-delay="2"].is-in { transition-delay: 160ms; }
  html.js .reveal[data-delay="3"].is-in { transition-delay: 240ms; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html.js .reveal { opacity: 1; transform: none; }
    *, *::before, *::after { animation-duration: .01ms; animation-iteration-count: 1; transition-duration: .01ms; }
  }
}
