@layer reset {
  *:not(dialog) {
    margin: 0;
    padding: 0;
  }

  html {
    /* Preserve space for the scrollbar so 100vw won't overflow */
    scrollbar-gutter: stable;

    @media (prefers-reduced-motion: no-preference) {
      scroll-behavior: smooth;
      /* Enable intrinsic size transitions */
      interpolate-size: allow-keywords;
    }
  }

  body {
    min-height: 100vh;
    line-height: 1.5;
    /* Prevent auto-scaling of font size after orientation changes in iOS. */
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    /* Break lines instead of overflowing */
    overflow-wrap: break-word;
    /* Improve text rendering by disabling subpixel antialiasing on Mac */
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4, h5, h6 {
    line-height: 1.1;
    text-wrap: balance;
    font-family: var(--font-display);
  }

  p, li, dl, figcaption, blockquote {
    /* Avoid single-word lines */
    text-wrap: pretty;
  }

  img, picture, video, canvas {
    display: block;
    max-width: 100%;
  }

  /* Inherit fonts for form controls */
  input, button, textarea, select, ::file-selector-button {
    font: inherit;
  }

  input, button {
    line-height: 1;
  }

  input {
    /* Overrides the default `auto` whose fixed size is problematic on mobile  */
    min-width: 0;
    flex-basis: 20ch;
  }

  textarea:not([rows]) {
    min-height: 5lh;
  }

  a:not([class]) {
    text-underline-offset: 2px;
  }
}