/* SPDX-License-Identifier: AGPL-3.0-or-later
 *
 * The house reset. A dozen declarations, all of which this project can
 * defend, and rather more lines of explaining why.
 *
 * What was here before was Tailwind's preflight - 9 KB of reset plus unused
 * utilities, loaded first in the cascade, for a codebase containing exactly
 * zero Tailwind utility classes. Grep every view: none. It was also the sole
 * reason "no build step" was false, since tailwindcss-rails runs its CLI on
 * every test run; and it had already produced one shipped bug, because its
 * `h1..h6 { font-size: inherit; font-weight: inherit }` silently flattened
 * every heading in the app to body size and body weight while typography.css
 * faithfully applied a display face to type with no hierarchy left in it.
 *
 * A dependency that ships one bug and zero value is a dependency you remove.
 * But a reset it genuinely was, and these rules were load-bearing - so they
 * are written out here, owned, and explained.
 */

/* Everything below is in a cascade LAYER, and that is load-bearing rather
   than tidy.
 *
   Unlayered declarations beat layered ones whatever their specificity, which
   is precisely what a reset wants: it should lose every argument it has with
   the code that comes after it.
 *
   Measured, because the first version of this file was not layered and the
   difference was visible. `button, input { font: inherit }` is (0,0,1);
   controls.css sets `font-weight: 600` inside `:where(...)`, which is
   deliberately (0,0,0) so that every modifier can beat it. Unlayered, the
   reset therefore won, `font: inherit` pulled the weight back to 400, and
   the label on the Hoard button lost 38% of its ink - 326 dark pixels down
   to 202. Tailwind's preflight had been in `@layer base` all along, which is
   the only reason nobody had seen this.
 *
   The same trap is already documented two files away, about `.quiet` losing
   to `input[type="submit"]`. It is the same bug wearing a reset. */

@layer reset {

  /* Border-box everywhere. The wall is a multi-column layout and a card has
     1rem of padding and a 3px rule; under content-box each card would be
     wider than the column it is laid into. Not a preference - the layout
     depends on it. */
  *, *::before, *::after { box-sizing: border-box; }

  /* The UA's margins are a document's margins, not an interface's. Every
     vertical rhythm in this app is stated somewhere on purpose - the Lectern's
     in `rlh`, the card's in rem, the furniture's in `rlh` - and a UA margin
     underneath them is a second opinion nobody asked for. */
  * { margin: 0; }

  /* A replaced element sits on the text baseline by default, which leaves a
     descender-sized gap under every one of them. The sigils are inline SVG and
     there are six of them on a card. */
  img, svg, video, canvas { display: block; }
  img, video { max-inline-size: 100%; block-size: auto; }

  /* Controls do not inherit type from their page unless told to, which is how
     a button ends up in the operating system's UI font in the middle of a page
     set in Inter. controls.css names the family for the ones it styles; this
     covers the ones it does not. */
  button, input, optgroup, select, textarea {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
  }

  /* A border that has a colour and a style but no width is a border that
     appears the moment someone sets a width, which is the behaviour every
     other reset settled on and it is right. */
  *, *::before, *::after { border: 0 solid currentColor; }

  /* A link is underlined where it is prose and not where it is furniture,
     and which it is depends on where it sits - so the decision belongs to
     the component, not to the UA. Tailwind's preflight had been supplying
     `text-decoration: inherit` here, and removing it put underlines back
     under the masthead's `shelf · settings`, which are navigation. */
  a { color: inherit; text-decoration: inherit; }

  /* Long words break rather than escaping their container. The vault is full
     of URLs and Slovenian compounds, and horizontal scroll on a phone is the
     one layout bug `bin/vault shots` refuses outright. */
  body { overflow-wrap: break-word; }

  /* Lists used as lists keep their markers; the ones this app uses for layout
     say so with a class. Only the numbered steps in an aside are real lists,
     and they want the UA's numbering. */
  ul, ol { padding-inline-start: 1.4em; }

  /* No font-smoothing override, and that is a decision.
   *
     `-webkit-font-smoothing: antialiased` thins glyphs, which flatters
     light-on-dark and harms dark-on-light - and this app is full of the
     second case: every brass button is dark ink on a light plate, and two of
     the four themes are light throughout. Applied globally it visibly thinned
     the label on the one control that captures anything. A setting that helps
     one half of a design and hurts the other is not a reset, it is a
     preference with a blast radius.
   *
     `text-rendering: optimizeLegibility` goes with it: it turns on kerning and
     ligatures, and this project spends a paragraph of CLAUDE.md explaining
     which ligatures must stay off. */

}
