/**
 * base.css
 * Font faces, reset, typography, focus, motion.
 *
 * Fonts are self hosted in public/fonts/. There is no runtime link to
 * Google Fonts anywhere, because the app must render correctly offline.
 * scripts/check-fonts.mjs fails the build if one is ever added.
 */

/* ---------- Self hosted fonts ---------- */
/* font-display: swap keeps text readable while the face loads. The fallback
   stack is chosen so the reflow is small when it swaps. */

/* Public Sans ships as one variable font covering 400 to 700, so a single
   26KB file serves every weight the app uses. */
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-var.woff2") format("woff2-variations"),
       url("../fonts/public-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("../fonts/spectral-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("../fonts/spectral-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Reset ---------- */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Stop the whole page rubber banding on iOS. Screens scroll, the shell does not. */
  overscroll-behavior-y: none;
}

h1, h2, h3, .serif {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

img, svg { max-width: 100%; }

/* Numbers in money and reference positions line up in columns. */
.num, input.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- Focus ---------- */
/* Visible keyboard focus is an accessibility floor, not a preference.
   :focus-visible keeps it off mouse clicks but always on for keyboards. */

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--verd);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Motion ---------- */

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

/* ---------- Screen reader only ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link, visible once focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  border-radius: 0 0 var(--radius-ctrl) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Utility ---------- */

.muted { color: var(--slate); }
.tiny  { font-size: 12px; }
.hidden, [hidden] { display: none !important; }
