@layer reset, theme, defaults;

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

  body {
    margin: 0;
  }

  img,
  svg {
    display: block;
    block-size: auto;
    max-inline-size: 100%;
  }

  input,
  textarea,
  select,
  button {
    color: inherit;
    font: inherit;
  }

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

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

@layer theme {
  :root {
    --light: oklch(0.9 0 0);
    --dark: oklch(0.25 0 0);

    --bg: light-dark(var(--light), var(--dark));
    --fg: light-dark(var(--dark), var(--light));

    --font-primary: system-ui;
  }

  html {
    color-scheme: light dark;
  }

  body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-primary), sans-serif;
  }

  @media (prefers-color-scheme: dark) {
    html {
      color-scheme: dark;
    }
  }
}

@layer defaults {
  body {
    line-height: 1.5;
  }

  p {
    text-wrap: pretty;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    text-wrap: balance;
  }

  a {
    text-underline-offset: 0.25rem;
  }

  img {
    font-style: italic;
  }

  table {
    border-collapse: collapse;
  }

  th {
    text-align: start;
  }
}
