/*
  base.css — the few style rules of the site. Values come from tokens.css only.

  Most rules style plain HTML elements. The classes:
    .site-header .site-footer  the frame of every page
    .wordmark                  the site name in the header
    .crumbs                    the path at the top of a page (Home / Virginia / ...)
    .small                     small text
    .facts                     a row of short facts that wraps on small screens
    .controls                  a row of form fields (amount, period, sort)
    .stack                     a form with one field on each row (log in)
    .scroll                    lets a wide table scroll sideways on a phone
    .num                       a number column, aligned right
    .link                      a button that looks like a link (log out)
*/

/* ── Reset ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
ul { list-style: none; }

html {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: var(--fw-normal);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ── Page frame ────────────────────────────────────────────────────── */

.site-header, main, .site-footer {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-sm);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  border-bottom: var(--border);
}
.site-header nav { display: flex; align-items: center; gap: var(--space-sm); }
.wordmark { font-size: var(--fs-lg); font-weight: var(--fw-bold); text-decoration: none; }

main { padding-block: var(--space-md) var(--space-lg); }

.site-footer {
  padding-block: var(--space-sm);
  border-top: var(--border);
  font-size: var(--fs-sm);
}

/* ── Flow: the space between blocks ────────────────────────────────── */

main > * + * { margin-top: var(--space-lg); }          /* between sections */
main > * > * + * { margin-top: var(--space-sm); }      /* inside a section */

/* ── Text ──────────────────────────────────────────────────────────── */

h1, h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
strong, th { font-weight: var(--fw-bold); }
a { color: inherit; }
.small, .crumbs { font-size: var(--fs-sm); }

.facts { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-md); }

/* ── Tables ────────────────────────────────────────────────────────── */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) 0;
  border-bottom: var(--border);
}
th:last-child, td:last-child { padding-right: 0; }
thead th { border-bottom: var(--border); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Forms ─────────────────────────────────────────────────────────── */

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

select, button, input[type="email"], input[type="password"] {
  height: var(--control-h);
  padding-inline: var(--space-sm);
  border: var(--border);
  border-radius: 0;
  background: var(--paper);
}
button { background: var(--ink); color: var(--paper); cursor: pointer; }
input[type="checkbox"] { accent-color: var(--ink); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.controls label { display: flex; align-items: center; gap: var(--space-sm); }

.stack { display: grid; gap: var(--space-sm); max-width: calc(var(--content-max) / 3); }
.stack label { display: grid; }

/* A button that looks like a plain link: the log-out button in the header. */
button.link {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
}

:focus-visible { outline: var(--border); outline-offset: var(--focus-offset); }
