/* CouldBeStocks — base layer: reset, utilities and primitives.
 *
 * Hand-written. The *tokens* this uses come from `tokens.css`, which is
 * generated from `design/tokens.json` by `manage.py build_tokens` and must
 * not be edited. Split out when the generator landed: a generated file and a
 * hand-maintained one cannot be the same file.
 */

:root {
  /* A layout constant, not a colour or a scale step. It was only ever in the
     token file because everything was; `design/tokens.json` is the design
     system's vocabulary and a container width is not part of it. */
  --maxw: 1240px;
}


* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-ui);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* Utility */
.mono { font-family: var(--f-num); font-feature-settings: "tnum"; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.serif { font-family: var(--f-ui); }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; }
.eyebrow {
  font-family: var(--f-num);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hairline { border: 0; border-top: 1px solid var(--line); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--t-quick) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--ink); color: var(--surface-raised); }
.btn-primary:hover { background: var(--signal); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-input); }
.btn-ghost:hover { background: var(--surface-raised); border-color: var(--ink-3); }
.btn-teal { background: var(--signal); color: var(--surface-raised); }
.btn-teal:hover { background: var(--signal); }
.btn-gold { background: var(--warn); color: var(--surface-raised); }
.btn-gold:hover { background: var(--warn); filter: brightness(.92); }
/* For an action that cannot be undone. Closing a position reaches a real
   broker, so the control that does it should not look like "Save". */
.btn-danger { background: var(--neg); color: var(--surface-raised); }
.btn-danger:hover { background: var(--neg-2, var(--neg)); filter: brightness(.92); }
.btn:disabled, .btn[disabled] {
  opacity: .4; cursor: not-allowed; filter: none;
}
/* The confirmation beat (confirm-beat.js). `disabled` dims to .4 to say
   "not available"; this button is only *not yet* available, and only for
   --t-beat, so dimming it that far reads as broken rather than as settling.
   Equal specificity to the rule above on purpose — it has to come after it,
   and saying so here is cheaper than an !important. */
.btn[disabled].is-settling { opacity: .85; cursor: progress; }

/* For text that exists only for a screen reader. The same rule is in
   exchange.css under the same name, deliberately: the desk loads app.css
   and base.css while the public exchange loads exchange.css, and neither is
   an ancestor of the other. A six-line utility duplicated beats an
   `aria-live` region that is invisible on one half of the estate and a
   stray line of text on the other — the same reasoning as ticker.css. */
.x-sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
/* For a dense table row, where even btn-sm's 13px and 6px padding force the
   cell wider than its share. Small enough to sit in a 12px row and still
   read as something to press: the alternative was stripping the classes
   altogether, which left two actions looking like ordinary text and nobody
   knowing they could be clicked. */
.btn-xs { padding: 2px 9px; font-size: 11px; gap: 4px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }

/* Inputs */
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface-raised); border: 1px solid var(--line-input);
  border-radius: var(--r-sm); color: var(--ink); font-size: 14px;
  outline: none; transition: border-color var(--t-quick), background var(--t-quick);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--signal);
  background: var(--surface-raised); }
.label { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; display: block; font-weight: 500; }

/* Card */
.card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* Pill / chip */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-sunken); color: var(--ink-2);
  border: 1px solid var(--line);
}
.pill.pos { background: color-mix(in oklch, var(--pos) 14%, transparent); color: var(--pos); border-color: transparent; }
.pill.neg { background: color-mix(in oklch, var(--neg) 14%, transparent); color: var(--neg); border-color: transparent; }
.pill.gold { background: var(--warn-wash); color: var(--warn); border-color: transparent; }
.pill.teal { background: var(--signal-wash); color: var(--signal); border-color: transparent; }

/* Headings */
h1, h2, h3, h4 { font-family: var(--f-ui); font-weight: 400; letter-spacing: -0.01em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(40px, 5vw, 72px); letter-spacing: -0.025em; }
h2 { font-size: clamp(28px, 3.4vw, 48px); letter-spacing: -0.02em; }
h3 { font-size: 24px; }
h4 { font-size: 18px; }

/* Striped placeholder image */
.placeholder {
  background:
    repeating-linear-gradient(135deg, rgba(15,23,20,0.05) 0 1px, transparent 1px 14px),
    var(--surface-sunken);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-family: var(--f-num); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: var(--r-md);
  text-align: center;
}

/* Container */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container-wide { max-width:1440px; margin: 0 auto; padding: 0 32px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 12px; font-weight: 500; color: var(--ink-3); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 8px 10px; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* Hide scrollbar but allow scroll */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }
