/* ═══════════════════════════════════════════════════════════════════════════
   RESET

   The cascade order for the whole application is declared here, once, and
   never fought again. A later layer always wins over an earlier one no matter
   how specific the earlier selector was, which is what lets `base.css` say
   `[data-pane="inspector"]` and a theme override it with a bare `aside`.

   Nothing in this file has an opinion. Opinions live in a theme.
   ═══════════════════════════════════════════════════════════════════════════ */

@layer reset, base, grammar, theme, state;

@layer reset {

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

  :where(html) {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    tab-size: 2;
  }

  :where(body) {
    margin: 0;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  /* Margins arrive from the theme's rhythm, not from the user agent's idea of
     one. Every block starts flat. */
  :where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ol, ul, menu, pre) {
    margin: 0;
  }

  :where(ol, ul, menu) {
    padding: 0;
    list-style: none;
  }

  :where(img, picture, svg, video, canvas) {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
  }

  /* Form controls do not inherit type by default, which is the single most
     common reason an interface looks almost right. */
  :where(input, button, textarea, select) {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
  }

  :where(button) {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: inherit;
  }

  :where(table) {
    border-collapse: collapse;
    border-spacing: 0;
  }

  :where(a) { color: inherit; }

  :where(dialog) {
    padding: 0;
    border: 0;
    max-inline-size: 100%;
    max-block-size: 100%;
    color: inherit;
    background: none;
  }

  /* Visible focus is not negotiable — a keyboard is how the front desk works
     when it is busy. A theme may restyle the ring; it may not remove it. */
  :where(:focus-visible) {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }

  [hidden] { display: none !important; }

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