/* base.css: v2 reset, body type, semantic text classes, privacy fade and
   accessibility helpers. Values come from tokens.css only; surfaces are flat. */

*, *::before, *::after { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body {
  height: var(--app-h);
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: var(--t-body);
  letter-spacing: var(--tr-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button {
  margin: 0; padding: 0; border: 0; background: none;
  text-align: inherit; cursor: pointer;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
a { color: var(--tint); text-decoration: none; }
h1, h2, h3, h4, p, figure { margin: 0; font: inherit; letter-spacing: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { overflow: visible; }
[hidden] { display: none !important; }

/* focus: a tint ring for keyboard users only */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: var(--radius-xs); }

/* semantic text colours */
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero, .muted { color: var(--label-2); }
/* text: --label-2 (5.3:1 or more); --label-3 is for placeholders, chevrons and disabled controls only */
.faint { color: var(--label-2); }
.tint { color: var(--tint); }
.warn { color: var(--warn); }

/* icons: one line family, 1.8 stroke, round caps (filled glyphs set their own fill) */
.ui-ico {
  width: var(--icon); height: var(--icon); flex: none;
  fill: none; stroke: currentColor; stroke-width: var(--icon-stroke);
  stroke-linecap: round; stroke-linejoin: round;
}

/* privacy: amounts fade out, swap, fade in (body.is-masking); body.is-masked is the state */
.ui-amt { transition: opacity var(--dur-fade) var(--ease-linear); }
body.is-masking .ui-amt { opacity: 0; }
/* hidden amounts give nothing away: no gain/loss colour on a masked amount */
body.is-masked .ui-amt:is(.pos, .neg) { color: inherit; }
.ui-peekable { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* screen-reader-only text */
.ui-vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* the hidden WebKit switch used for haptic ticks */
.ui-haptic {
  position: fixed; left: -100px; top: 0; width: 1px; height: 1px;
  overflow: hidden; opacity: 0; pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  /* a busy spinner still turns: it is the only sign the app is working */
  [data-state="busy"] .ui-spinner {
    animation-duration: 0.8s !important;
    animation-iteration-count: infinite !important;
  }
}
