/* ==========================================================================
   STOXVAULT — reset, elements, typography primitives, a11y utilities
   Depends on tokens.css. Loaded second.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s-3));
}

body {
  margin: 0;
  min-height: 100dvh;
  /* Never let the page scroll sideways; wide content gets its own scroller. */
  overflow-x: hidden;
  background-color: var(--paper);
  /* the very subtle lighter wash at the top of the page */
  background-image: var(--page-wash);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul {
  margin: 0;
}
ol, ul { padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}
h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: 0; }
h4 { font-size: var(--fs-body); letter-spacing: 0; }

a {
  color: inherit;
  text-decoration: none;
}
a:hover { color: var(--ink); }

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }

hr {
  border: 0;
  border-top: var(--hairline) solid var(--rule);
  margin: 0;
}

table { border-collapse: collapse; border-spacing: 0; }

::selection {
  background: var(--gold);
  color: var(--accent-ink);
}

/* ---- focus ------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* On a gold fill the gold ring vanishes — add a halo and swap the ring ink. */
.btn--primary:focus-visible,
.tabbar__tab[aria-selected="true"]:focus-visible,
.tab[aria-selected="true"]:focus-visible {
  outline-color: var(--ink);
  box-shadow: 0 0 0 4px var(--focus-halo);
}

/* ---- typography primitives --------------------------------------------- */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  text-align: right;
  white-space: nowrap;
}

/* The micro-label: small, uppercase, letter-spaced, muted gold. Used
   everywhere the frames put a caption above a figure. */
.micro {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--gold-label);
  line-height: 1.4;
}
/* .eyebrow is the older neutral variant. Kept so any rule or markup that
   still asks for it keeps working. */
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-3);
}

.lede {
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 62ch;
}
.muted  { color: var(--ink-3); }
.faint  { color: var(--ink-4); }
.strong { font-weight: var(--fw-semi); }
.nowrap { white-space: nowrap; }
.gold   { color: var(--gold-bright); }

.up   { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

.link {
  color: var(--ink);
  border-bottom: var(--hairline) solid var(--rule-strong);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.link:hover { border-bottom-color: var(--gold); color: var(--ink); }

/* A <button> that reads as a link. Used for the in-prose tab jumps, which
   change tab rather than navigate. */
.linkbtn {
  font: inherit;
  display: inline;
  padding: 0;
  cursor: pointer;
}

.tnum-fix { font-variant-numeric: tabular-nums; }

/* ---- a11y utilities ----------------------------------------------------- */
.sr-only {
  position: absolute;
  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;
}

.skip-link {
  position: absolute;
  left: var(--s-2);
  top: -100%;
  z-index: 100;
  padding: var(--s-1) var(--s-2);
  background: var(--gold);
  color: var(--accent-ink);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
}
.skip-link:focus-visible {
  top: var(--s-1);
  outline-color: var(--ink);
}

[hidden] { display: none !important; }

/* ---- scrollbars (kept quiet, still visible) ----------------------------- */
.scroll-x, .table-scroll, .drawer__body, .picker__list, .tabbar-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
.scroll-x::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.drawer__body::-webkit-scrollbar,
.tabbar-wrap::-webkit-scrollbar,
.picker__list::-webkit-scrollbar { height: 6px; width: 8px; }
.scroll-x::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.drawer__body::-webkit-scrollbar-thumb,
.tabbar-wrap::-webkit-scrollbar-thumb,
.picker__list::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border-radius: var(--radius-pill);
}
.scroll-x::-webkit-scrollbar-track,
.tabbar-wrap::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---- reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* The tape stops moving and becomes a manual horizontal scroller. */
  .tape__track { animation: none !important; transform: none !important; }
  .tape__viewport { overflow-x: auto; }
  .pane--loading { animation: none !important; }
}

/* ---- print (a brokerage statement should print) ------------------------- */
@media print {
  .site-header, .tape, .toasts, .drawer, .alloc__actions, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .view[hidden] { display: block !important; }
  .card { break-inside: avoid; border: 1px solid #999; }
}
