/* Reset + element defaults. Values come from tokens.css only. */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: none; text-size-adjust: none; }
  body { min-height: 100svh; }
  img, picture, svg, video { display: block; max-width: 100%; }
  img { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  p, h1, h2, h3, h4, li, dd { overflow-wrap: break-word; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
  summary { cursor: pointer; }
  [hidden] { display: none !important; }
}

@layer base {
  html {
    background: var(--color-bg);
    scroll-behavior: smooth;
    /* Keeps focused/anchored content clear of the sticky header and the mobile action bar. */
    scroll-padding-top: calc(var(--header-h) + var(--space-16));
    scroll-padding-bottom: calc(var(--action-bar-h) + var(--space-16));
  }

  body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: var(--weight-body);
    line-height: var(--leading-body);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--weight-display);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-display);
    text-wrap: balance;
  }
  h1 { font-size: var(--step-6); line-height: var(--leading-display); }
  h2 { font-size: var(--step-4); }
  h3 { font-size: var(--step-2); }
  h4 { font-size: var(--step-1); }

  p, li { text-wrap: pretty; }
  p { max-width: var(--measure); }
  strong, b { font-weight: var(--weight-strong); }

  a { color: var(--color-link); text-underline-offset: 0.2em; text-decoration-thickness: var(--line-hair); }
  a:hover { color: var(--color-link); text-decoration-thickness: var(--line-glow); }

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

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

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