/*
 * Base: a small reset and the defaults for plain HTML elements.
 * Reads tokens only; no class selectors except the skip link.
 */

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

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

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }
  }

  body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  h1,
  h2,
  h3,
  p,
  ol,
  ul,
  figure,
  blockquote {
    margin: 0;
  }

  h1,
  h2,
  h3 {
    font-weight: var(--weight-black);
    letter-spacing: var(--tracking-heading);
    line-height: var(--leading-tight);
    text-wrap: balance;
  }

  p {
    text-wrap: pretty;
  }

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

  a {
    color: var(--color-link);
    text-underline-offset: 0.15em;
  }

  :focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: var(--focus-offset);
    border-radius: var(--radius);
  }

  code,
  pre {
    font-family: var(--font-mono);
    font-size: 0.95em;
  }

  ::selection {
    background: var(--color-highlight);
    color: var(--color-on-highlight);
  }

  [hidden] {
    display: none !important;
  }

  /* Lets keyboard users jump past the header straight to the content. */
  .skip-link {
    position: absolute;
    left: var(--gutter);
    top: var(--space-2);
    z-index: 10;
    padding: var(--space-2) var(--space-4);
    background: var(--color-action-bg);
    color: var(--color-action-text);
    font-weight: var(--weight-semibold);
    transform: translateY(-200%);
  }

  .skip-link:focus {
    transform: none;
  }
}
