@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: calc(var(--header-h) + 1rem);
  }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    min-height: 100dvh;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-serif);
    font-size: var(--step-0);
    line-height: 1.65;
    font-optical-sizing: auto;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
  }
  body > main { flex: 1; }

  img, svg, picture { display: block; max-width: 100%; }
  a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

  :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 1px; }
  ::selection { background: var(--gold-300); color: var(--plum-900); }

  h1, h2, h3, h4 { font-weight: 500; line-height: 1.12; text-wrap: balance; }
  p { text-wrap: pretty; max-width: 62ch; }

  .sr-only {
    position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .skip-link {
    position: absolute; inset-block-start: 0; inset-inline-start: 1rem; z-index: 100;
    translate: 0 -150%; padding: 0.6rem 1rem; background: var(--plum-800); color: var(--cream-50);
    font-family: var(--font-label); font-size: var(--step--1); letter-spacing: var(--track-wide);
    transition: translate var(--dur-1) var(--ease-out);
  }
  .skip-link:focus { translate: 0 0; }

  /* Cross-document page transitions: header stays put, content softly cross-fades */
  @media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    .site-header { view-transition-name: site-header; }
    ::view-transition-old(root) { animation: 320ms var(--ease-in-out) both vt-out; }
    ::view-transition-new(root) { animation: 640ms var(--ease-out) both vt-in; }
    ::view-transition-group(site-header) { animation-duration: 0s; }
    @keyframes vt-out { to { opacity: 0; } }
    @keyframes vt-in { from { opacity: 0; translate: 0 10px; } }
  }
}
