@layer base {
  /* Surface context. The page is built on --ink-950, so dark is the default;
     put .surface-light on a light band. Type roles, the flourish and rules read
     these --ca-* values instead of hard-coding a colour, so one role class works
     on either surface. They only alias tokens, they add no values. */
  :root,
  .surface-dark {
    --ca-heading: var(--text-on-dark);
    --ca-body: var(--text-on-dark-muted);
    --ca-muted: var(--text-on-dark-muted);
    --ca-accent: var(--gold-400);
    --ca-label: var(--gold-400);
    --ca-micro: var(--text-on-dark);
    --ca-eyebrow: var(--gold-200);
    --ca-script: var(--gold-200);
    --ca-hairline: var(--gold-hairline);
    --ca-focus: var(--gold-400);
  }

  .surface-light {
    --ca-heading: var(--text-on-light);
    --ca-body: var(--text-on-light-body);
    --ca-muted: var(--text-on-light-muted);
    --ca-accent: var(--gold-600);
    --ca-label: var(--text-on-light);
    --ca-micro: var(--text-on-light-muted);
    --ca-eyebrow: var(--text-on-light-body);
    --ca-script: var(--gold-600);
    --ca-hairline: var(--sand-300);
    --ca-focus: var(--gold-400);
  }

  .surface-dark,
  .surface-light {
    color: var(--ca-heading);
  }

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

  body {
    background-color: var(--ink-950);
    color: var(--text-on-dark);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Keyboard focus: 2px gold ring, 3px off the element (spec §2 Components). */
  :focus-visible {
    outline: 2px solid var(--ca-focus);
    outline-offset: 3px;
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  @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;
    }
  }
}
