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

  * {
    margin: 0;
  }

  html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }

  /* Prevent horizontal scroll from positioned elements */
  html,
  body {
    overflow-x: clip;
  }

  /* Full-height flex layout so main fills remaining viewport */
  body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    line-height: 1.5;
  }

  main {
    flex: 1;
  }

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

  p, li {
    text-wrap: pretty;
  }

  /* Scoped to unstyled links — preserves accessibility */
  a:not([class]) {
    text-decoration-skip-ink: auto;
    color: currentColor;
  }

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

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

  /* Remove list styles on semantic lists */
  ul[role="list"],
  ol[role="list"] {
    list-style: none;
    padding: 0;
  }

  fieldset {
    border: none;
    padding: 0;
    margin: 0;
  }

  button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
  }

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  summary {
    &::-webkit-details-marker { display: none; }
    &::marker { content: ""; }
  }

  textarea:not([rows]) {
    min-height: 10em;
  }

  :target {
    scroll-margin-block: 5ex;
  }

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