/* The rules a document needs before main.js has run, and the ones a
   generated stylesheet has no business holding: the reset, and the faces.

   Everything that is a *value* — a colour, a size, a corner — is in
   `nu.theme` and reaches the page through `nu.style`. What is here is either
   a browser default being undone or a font being declared.

   --color-bg and --color-text are repeated from `theme/palette` on purpose:
   they are the pair visible in the moment between the page arriving and
   main.js injecting the sheet, and without them that moment is white. Keep
   them in step. */

:root {
  --color-bg: #f4f2ef;
  --color-text: #1c1a17;
}

/* Montserrat, vendored under public/fonts — nothing is fetched from a third
   party, so a phone on one bar of signal renders in the app's own face and an
   offline load is not a different app. Three weights, which is what
   `theme/type-ladders` asks for; `swap` so the words are readable while the
   file is still coming. */

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/montserrat-v14-latin-regular.woff2') format('woff2'),
       url('/fonts/montserrat-v14-latin-regular.woff') format('woff');
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/montserrat-v14-latin-500.woff2') format('woff2'),
       url('/fonts/montserrat-v14-latin-500.woff') format('woff');
}

/* 900 is what is vendored, and it stands in for the 600 and 700 the heading
   ladder asks for. A weight nobody vendored is a smear the browser
   synthesises, which is a hard kind of wrong to see — so the two rungs are
   pointed at the file that exists. */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('/fonts/montserrat-v14-latin-500.woff2') format('woff2'),
       url('/fonts/montserrat-v14-latin-500.woff') format('woff');
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 800 900;
  font-display: swap;
  src: url('/fonts/montserrat-v14-latin-900.woff2') format('woff2'),
       url('/fonts/montserrat-v14-latin-900.woff') format('woff');
}

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

html {
  /* the page scrolls under a sticky bar, so an anchor landing under it would
     be an anchor you cannot read */
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  /* a phone with a notch: the nav bar's own padding is not enough on its own */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1, h2, h3, h4 { font-weight: 600; }

img { max-width: 100%; }

a { color: inherit; }

/* Every tap target in this app is a card or a row inside one, and a highlight
   box drawn by the browser over a card with a shadow reads as a rendering
   fault. The `:active` states in `nu.style` are what replaces it. */
* { -webkit-tap-highlight-color: transparent; }

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