/* Reset, element defaults and utilities. Values come from tokens.css. */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-block-start: calc(var(--header-h) + var(--space-4)); }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
  img, svg, canvas { display: block; max-inline-size: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
  [hidden] { display: none !important; }
}

@layer base {
  html { color-scheme: dark light; }
  :root[data-theme="dark"] { color-scheme: dark; }
  :root[data-theme="light"] { color-scheme: light; }

  body {
    min-block-size: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--surface-page);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: var(--fs-body-md);
    line-height: var(--leading-body);
    letter-spacing: var(--tracking-body);
    font-weight: var(--weight-regular);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  main { flex: 1 0 auto; }

  h1, h2, h3, h4 {
    color: var(--text-strong);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-heading);
    line-height: var(--leading-heading);
    text-wrap: balance;
  }
  h1 { font-size: var(--fs-h1); }
  h2 { font-size: var(--fs-h2); }
  h3 { font-size: var(--fs-h3); }
  h4 { font-size: var(--fs-h4); }
  p { text-wrap: pretty; }
  strong { font-weight: var(--weight-semibold); color: var(--text-strong); }

  a {
    color: var(--text-link);
    text-decoration-color: color-mix(in oklab, var(--text-link) 40%, transparent);
    text-underline-offset: 3px;
    transition: color var(--dur-fast) var(--ease-standard), text-decoration-color var(--dur-fast) var(--ease-standard);
  }
  a:hover { color: var(--text-link-hover); text-decoration-color: currentColor; }

  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
  code, kbd, pre, samp { font-family: var(--font-code); font-size: .9em; }
  ::selection { background: var(--accent-tint-strong); color: var(--text-strong); }

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

@layer utilities {
  .container { inline-size: 100%; max-inline-size: var(--container-max); margin-inline: auto; padding-inline: var(--gutter); }
  .container--narrow { max-inline-size: calc(var(--container-narrow) + 2 * var(--gutter)); }

  .visually-hidden {
    position: absolute !important;
    inline-size: 1px; block-size: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip-path: inset(50%);
    white-space: nowrap;
  }

  .skip-link {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: var(--z-modal);
    padding: var(--space-3) var(--space-5);
    background: var(--accent);
    color: var(--text-on-accent);
    border-radius: var(--radius-control);
    font-weight: var(--weight-medium);
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform var(--dur-base) var(--ease-out);
  }
  .skip-link:focus { transform: translateY(0); color: var(--text-on-accent); }
}
