/* ============================================================
   Reset, typography, utilities
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  padding: 0;
  /* Nothing in this app scrolls sideways. */
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: var(--lead-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
button:disabled { cursor: not-allowed; }

a { color: inherit; text-decoration: none; }

ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: normal; }

p { margin: 0; }

table { border-collapse: collapse; width: 100%; }

/* Visible, branded focus. Never removed. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}
.on-dark :focus-visible { outline-color: var(--gold-lt); }

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

/* ---------- type primitives ---------- */

.serif { font-family: var(--serif); }

.hero-t { font-family: var(--serif); font-size: var(--t-hero); line-height: var(--lead-tight); letter-spacing: -0.01em; }
.h1     { font-family: var(--serif); font-size: var(--t-h1);   line-height: var(--lead-tight); }
.h2     { font-family: var(--serif); font-size: var(--t-h2);   line-height: var(--lead-snug); }
.h3     { font-family: var(--serif); font-size: var(--t-h3);   line-height: var(--lead-snug); }

.eyebrow {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--gold);
  display: block;
}
.on-dark .eyebrow, .eyebrow.on-dark { color: var(--gold-lt); }
.eyebrow.quiet { color: var(--text-3); }

.label {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
}
.on-dark .label { color: var(--dk-text-3); }

.sm    { font-size: var(--t-sm); }
.xs    { font-size: var(--t-xs); }
.micro { font-size: var(--t-micro); letter-spacing: 0.06em; }
.muted { color: var(--text-3); }
.on-dark .muted { color: var(--dk-text-3); }
.dim   { color: var(--text-2); }
.gold  { color: var(--gold); }
.on-dark .gold { color: var(--gold-lt); }
.pos   { color: var(--green); }
.neg   { color: var(--red); }
.warn  { color: var(--amber); }
.b     { font-weight: 700; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }

.lead { font-size: 1.0625rem; line-height: 1.5; color: var(--text-2); }
.on-dark .lead { color: var(--dk-text-2); }

/* Money. Serif, tabular, tight — it should look like a figure in a ledger. */
.money {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  line-height: 1.02;
  white-space: nowrap;
}
.money-hero { font-size: var(--t-money-hero); }
.money-lg   { font-size: var(--t-money-lg); }
.money-md   { font-size: var(--t-money-md); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- rules ---------- */
.rule { height: 1px; background: var(--border); border: 0; margin: var(--s-4) 0; }
.on-dark .rule { background: var(--dk-border); }
.rule-gold { height: 2px; width: 46px; background: var(--gold); border: 0; margin: 0 0 var(--s-4); }

/* ---------- layout utilities ---------- */
.stack > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-6 > * + * { margin-top: var(--s-6); }

/*
 * min-width:0 and max-width:100% on every flex row matter more than they look.
 * Without them a nested flex chain lets intrinsic content width win, and a
 * scrollable child (a chip row, a table) grows past the viewport instead of
 * scrolling inside itself — invisible on desktop, unreachable on a phone.
 */
.row, .row-tight, .row-between, .row-top { min-width: 0; max-width: 100%; }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row-tight { display: flex; align-items: center; gap: var(--s-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.row-top { display: flex; align-items: flex-start; gap: var(--s-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
/* Sits beside a figure on a laptop, drops onto its own line on a phone. */
.grow-own-line { flex: 1 1 auto; min-width: 160px; }
@media (max-width: 520px) { .grow-own-line { min-width: 100%; } }
.shrink0 { flex: 0 0 auto; }

.grid { display: grid; gap: var(--s-4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(min(215px, 100%), 1fr)); }
.g-wide { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }

@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .g4, .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .g2.keep2, .g4.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.hide-mobile { display: revert; }
.only-mobile { display: none; }
@media (max-width: 860px) {
  .hide-mobile { display: none !important; }
  .only-mobile { display: revert; }
}

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

/* ---------- entrance motion, used sparingly ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.rise { animation: rise var(--dur-slow) var(--ease-out) both; }
.rise-1 { animation-delay: 40ms; }
.rise-2 { animation-delay: 90ms; }
.rise-3 { animation-delay: 140ms; }
.rise-4 { animation-delay: 190ms; }
