/* ==========================================================================
   reset.css , modern, minimal, opinionated
   ==========================================================================
   Lives in @layer reset, the LOWEST layer, so literally any rule in base/
   layout/components/utilities beats it without needing specificity tricks.

   v1's entire reset was `*{margin:0;padding:0;box-sizing:border-box}`, which
   left form controls unstyled, images overflowing their containers, and no
   sensible text-wrapping or tap behaviour.

   NO HEX VALUES IN THIS FILE. See tokens.css.
   ========================================================================== */

@layer reset {

  /* Border-box everywhere. Non-negotiable. */
  *, *::before, *::after {
    box-sizing: border-box;
  }

  /* Kill default margins. We reintroduce rhythm deliberately in base.css. */
  * {
    margin: 0;
  }

  html {
    /* Prevent iOS bumping font sizes on orientation change. */
    -webkit-text-size-adjust: 100%;
    /* Anchor links land below the sticky topbar instead of underneath it. */
    scroll-padding-top: calc(var(--topbar-h) + var(--sp-4));
  }

  body {
    min-height: 100svh;          /* svh, not vh: correct with mobile browser chrome */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  /* Media should never blow out its container. This alone kills most of the
     horizontal-scroll bugs that plague responsive layouts. */
  img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
  }

  /* Form controls do NOT inherit type by default. Make them. */
  input, button, textarea, select {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
  }

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

  /* Long words / URLs must not force a horizontal scrollbar. */
  p, h1, h2, h3, h4, h5, h6, li, dd, dt, figcaption {
    overflow-wrap: break-word;
  }

  /* Modern balanced headline wrapping where supported. */
  h1, h2, h3, h4 {
    text-wrap: balance;
  }
  p {
    text-wrap: pretty;
  }

  ul[role="list"], ol[role="list"] {
    list-style: none;
    padding: 0;
  }

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

  /* Anything with a hidden attribute stays hidden, even if a component rule
     later sets display. Small guard, saves real debugging time. */
  [hidden] {
    display: none !important;
  }
}
