/* Cardonomics — the design system.

   THE ONE IDEA: the two accents ARE the two-sided model.

   Ledger Teal is what something COST. Hit Gold is what it could RETURN.
   That rule never bends, anywhere in the product, which means a reader knows
   which side of a trade a number is on before they have read its label. A
   teal figure is money out; a gold figure is money that might come back. Green
   and red are kept for direction only — up, down, over, under — and never
   used to mean cost or upside, or the whole scheme collapses into decoration.

   Everything is set in three faces with three jobs. Space Grotesk carries the
   headings; IBM Plex Sans carries the interface; IBM Plex Mono carries every
   figure, tabular, so a column of prices lines up on the decimal and can be
   scanned rather than read.

   Both themes are designed rather than inverted. The tokens below are the
   complete light palette; the dark blocks redefine only the tokens, once for
   the browser's own preference and once for an explicit choice, so a person
   who has picked light on a dark machine gets light. */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- ground and ink: light ---- */
  --paper:        #F7F8FA;
  --surface:      #FFFFFF;
  --surface-2:    #F1F3F6;
  --surface-sunk: #EAEDF1;
  --line:         #DFE3E9;
  --line-strong:  #C6CCD6;

  --ink:          #0C0F14;
  --ink-2:        #3D4550;
  --ink-3:        #6B7480;
  --ink-4:        #949CA8;

  /* ---- the two sides of every trade ---- */
  --cost:         #0B7F7A;   /* Ledger Teal, weighted for light ground */
  --cost-bright:  #0FA6A0;
  --cost-wash:    #E4F4F3;
  --upside:       #B87C14;   /* Hit Gold, weighted for light ground */
  --upside-bright:#E8A22B;
  --upside-wash:  #FBF1DE;

  /* ---- direction, never meaning ---- */
  --up:           #14804A;
  --down:         #C4292F;
  --warn:         #B4690E;

  --focus:        #0FA6A0;
  --shadow:       0 1px 2px rgba(12,15,20,.06), 0 8px 24px -12px rgba(12,15,20,.14);
  --shadow-lift:  0 2px 4px rgba(12,15,20,.07), 0 16px 40px -16px rgba(12,15,20,.22);

  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --body:    'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-sm: 6px;  --r: 10px;  --r-lg: 14px;  --r-xl: 20px;
  --gap: 16px;
  --page: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #0C0F14;
    --surface:      #10141B;
    --surface-2:    #171C24;
    --surface-sunk: #0A0D12;
    --line:         #1F2630;
    --line-strong:  #2C3542;

    --ink:          #F7F8FA;
    --ink-2:        #C2C9D2;
    --ink-3:        #8A929E;
    --ink-4:        #626A76;

    --cost:         #0FA6A0;
    --cost-bright:  #24C4BD;
    --cost-wash:    #0E2A2B;
    --upside:       #E8A22B;
    --upside-bright:#F5B953;
    --upside-wash:  #2A2113;

    --up:           #22A06B;
    --down:         #E5484D;
    --warn:         #E8A22B;

    --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lift:  0 2px 4px rgba(0,0,0,.45), 0 16px 40px -16px rgba(0,0,0,.7);
  }
}

:root[data-theme="dark"] {
  --paper:        #0C0F14;
  --surface:      #10141B;
  --surface-2:    #171C24;
  --surface-sunk: #0A0D12;
  --line:         #1F2630;
  --line-strong:  #2C3542;

  --ink:          #F7F8FA;
  --ink-2:        #C2C9D2;
  --ink-3:        #8A929E;
  --ink-4:        #626A76;

  --cost:         #0FA6A0;
  --cost-bright:  #24C4BD;
  --cost-wash:    #0E2A2B;
  --upside:       #E8A22B;
  --upside-bright:#F5B953;
  --upside-wash:  #2A2113;

  --up:           #22A06B;
  --down:         #E5484D;
  --warn:         #E8A22B;

  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lift:  0 2px 4px rgba(0,0,0,.45), 0 16px 40px -16px rgba(0,0,0,.7);
}

/* ---------------------------------------------------------------- base */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

:root[data-density="compact"] body { font-size: 14px; line-height: 1.45; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.12; }
h2 { font-size: clamp(20px, 2.4vw, 26px); line-height: 1.2; }
h3 { font-size: 17px; }
p  { margin: 0 0 1em; max-width: 68ch; }

a { color: var(--cost); text-decoration: none; }
a:hover { color: var(--cost-bright); text-decoration: underline; text-underline-offset: 2px; }

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

img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* ------------------------------------------------------------ type roles */

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.display { font-family: var(--display); }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
}

.lede { font-size: 17px; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }

/* The colour rule, as classes. */
.cost   { color: var(--cost); }
.upside { color: var(--upside); }
.up     { color: var(--up); }
.down   { color: var(--down); }

/* ------------------------------------------------------------- layout */

.page { max-width: var(--page); margin: 0 auto; padding: 0 22px; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.section { padding: 40px 0; }
.pad { padding: 20px; }

/* ---------------------------------------------------------------- nav */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner { max-width: var(--page); margin: 0 auto; padding: 11px 22px; display: flex; align-items: center; gap: 20px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 16.5px; letter-spacing: -0.025em; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand svg { display: block; }

.nav { display: flex; gap: 4px; margin-left: 8px; flex-wrap: wrap; }
.nav a {
  color: var(--ink-3); font-size: 13.5px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--r-sm);
}
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

.topbar .end { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); object-fit: cover; }

/* --------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card.flat { background: transparent; box-shadow: none; }
.card.sunk { background: var(--surface-sunk); }
.card.lift { box-shadow: var(--shadow); }

/* A card that declares which side of the trade it is about. Used sparingly —
   on the two panels that face each other, not on everything. */
.card.is-cost   { border-top: 2px solid var(--cost); }
.card.is-upside { border-top: 2px solid var(--upside); }

/* ---------------------------------------------------------------- figures */

.figure { display: flex; flex-direction: column; gap: 3px; }
.figure .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.figure .value { font-family: var(--mono); font-size: 27px; font-weight: 500; line-height: 1.1; letter-spacing: -0.01em; }
.figure .value.sm { font-size: 20px; }
.figure .note { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* An unknown is a statement, not a blank. */
.unknown { color: var(--ink-4); font-family: var(--mono); }

/* --------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface);
  position: sticky; top: 0;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 100px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.cost   { background: var(--cost-wash);   color: var(--cost);   border-color: transparent; }
.pill.upside { background: var(--upside-wash); color: var(--upside); border-color: transparent; }
.pill.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.pill.live { color: var(--up); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--body); font-size: 14px; font-weight: 500;
  padding: 8px 15px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn.primary { background: var(--cost); border-color: var(--cost); color: #fff; }
.btn.primary:hover { background: var(--cost-bright); border-color: var(--cost-bright); color: #fff; }
.btn.gold { background: var(--upside); border-color: var(--upside); color: #1A1206; }
.btn.gold:hover { background: var(--upside-bright); border-color: var(--upside-bright); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { border-color: var(--down); color: var(--down); background: transparent; }
.btn.danger:hover { background: var(--down); color: #fff; }
.btn.sm { font-size: 13px; padding: 5px 11px; }
.btn.lg { font-size: 15.5px; padding: 11px 20px; }

/* --------------------------------------------------------------- forms */

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
label.field > span.hint { font-size: 12.5px; color: var(--ink-3); }

input[type=text], input[type=email], input[type=number], input[type=search], select, textarea {
  font-family: var(--body); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); padding: 8px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
input[type=number] { font-family: var(--mono); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 100px; background: var(--surface-sunk); border: 1px solid var(--line-strong); position: relative; cursor: pointer; flex: none; transition: background .15s ease, border-color .15s ease; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); transition: transform .15s ease, background .15s ease; }
.switch input:checked { background: var(--cost); border-color: var(--cost); }
.switch input:checked::after { transform: translateX(16px); background: #fff; }

.seg { display: inline-flex; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button {
  font-family: var(--body); font-size: 13px; font-weight: 500; color: var(--ink-3);
  background: transparent; border: 0; border-radius: 7px; padding: 5px 12px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- notes */

/* A missing number explains itself here rather than showing a dash. */
.gap-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 2px solid var(--warn);
  border-radius: var(--r); padding: 11px 13px; font-size: 13px; color: var(--ink-2);
}
.gap-note b { color: var(--ink); font-weight: 600; }

.callout { border: 1px solid var(--line); border-left: 2px solid var(--cost); background: var(--surface-2); border-radius: var(--r); padding: 14px 16px; font-size: 13.5px; color: var(--ink-2); }
.callout.gold { border-left-color: var(--upside); }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }

/* --------------------------------------------------------------- misc */

.bar { height: 6px; background: var(--surface-sunk); border-radius: 100px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--cost); border-radius: 100px; }
.bar > i.gold { background: var(--upside); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 42px; }
.spark i { flex: 1; background: var(--cost-wash); border-radius: 2px 2px 0 0; min-height: 2px; }
.spark i.hi { background: var(--cost); }
.spark i.top { background: var(--upside); }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-sunk) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--r-sm); color: transparent; }
@keyframes sk { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }

footer.site { border-top: 1px solid var(--line); margin-top: 56px; padding: 28px 0 40px; color: var(--ink-3); font-size: 13px; }
footer.site a { color: var(--ink-3); }
footer.site a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 720px) {
  .topbar .inner { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .figure .value { font-size: 23px; }
  .section { padding: 28px 0; }
}
