/* IQnomics. Cool fog paper, ink, one ledger-green accent for money.
   The receipt is the only warm surface on the page. */
:root {
  --paper: #F2F4F7;
  --card: #FFFFFF;
  --ink: #15181D;
  --muted: #5B6470;
  --rule: #D5DAE1;
  --money: #127A55;
  --money-soft: #DCEFE6;
  --receipt: #FFFEF8;
  --receipt-ink: #24211C;
  --shadow: 0 1px 2px rgba(21, 24, 29, .06), 0 8px 24px rgba(21, 24, 29, .06);
  --display: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  --body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1216; --card: #171B21; --ink: #E8ECF1; --muted: #9AA3AE; --rule: #2A3038;
    --money: #3CC48E; --money-soft: #16342A; --receipt: #1E2228; --receipt-ink: #E9E4D8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--body);
}
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--money) 60%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--money); }
:focus-visible { outline: 3px solid var(--money); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 6px 10px; z-index: 10; }
.muted { color: var(--muted); }
small { font-size: .8em; color: var(--muted); }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding: 18px 20px;
}
.brand { font: 800 1.35rem/1 var(--display); letter-spacing: -.02em; text-decoration: none; }
.brand-iq {
  display: inline-block; background: var(--money); color: var(--paper);
  padding: 2px 6px 3px; border-radius: 6px; margin-right: 1px;
}
.top nav { display: flex; gap: 18px; font-size: .95rem; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }

main { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Hero: the thesis on the left, the receipt on the right */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 48px; align-items: start; padding: 40px 0 56px;
}
.kicker { font: 600 .8rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--money); margin: 0 0 14px; }
.hero h1 {
  font: 800 clamp(2.3rem, 5.2vw, 4.1rem)/1.02 var(--display); letter-spacing: -.035em;
  margin: 0 0 20px; max-width: 13ch;
}
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; margin: 0 0 28px; }
.pick { font: 600 .85rem/1 var(--body); margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 .95rem/1 var(--body); color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: 999px; padding: 10px 14px; cursor: pointer;
}
.chip small { font-family: var(--mono); margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .7; }

/* The receipt. Torn edges come from a zig-zag mask; switching plans re-prints it. */
.receipt {
  --tooth: 7px;
  margin: 0; max-width: 380px; justify-self: end; width: 100%;
  background: var(--receipt); color: var(--receipt-ink);
  font: 400 .9rem/1.5 var(--mono); padding: 26px 24px 30px;
  filter: drop-shadow(0 10px 22px rgba(21, 24, 29, .14));
  transform: rotate(-1.2deg);
  -webkit-mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    linear-gradient(#000 0 0) center / 100% calc(100% - var(--tooth) * 2) no-repeat;
  mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    linear-gradient(#000 0 0) center / 100% calc(100% - var(--tooth) * 2) no-repeat;
}
.receipt[hidden] { display: none; }
.receipt.printing { animation: print .7s steps(14, end); }
@keyframes print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.r-head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; padding-bottom: 14px; border-bottom: 1px dashed currentColor; }
.r-shop { font: 800 1.35rem/1 var(--display); letter-spacing: -.01em; text-transform: none; }
.r-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 14px 0; font-size: .82rem; }
.r-meta dt { text-transform: uppercase; opacity: .7; }
.r-meta dd { margin: 0; text-align: right; }
.r-meta i { display: block; font-style: normal; opacity: .7; font-size: .75rem; }
.r-col { display: flex; justify-content: space-between; border-top: 1px dashed currentColor; border-bottom: 1px dashed currentColor; padding: 6px 0; margin: 0 0 8px; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; }
.r-items { list-style: none; margin: 0; padding: 0; }
.r-items li { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.r-items a { text-decoration: none; min-width: 0; }
.r-items .lead { flex: 1; border-bottom: 2px dotted color-mix(in srgb, currentColor 35%, transparent); transform: translateY(-4px); min-width: 12px; }
.r-items b { font-weight: 600; white-space: nowrap; }
.r-items .void { opacity: .55; }
.r-items .void b { font-weight: 400; font-size: .78rem; white-space: normal; text-align: right; max-width: 48%; }
.r-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed currentColor; font-size: .74rem; line-height: 1.45; opacity: .85; }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card { min-width: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 22px 22px 16px; box-shadow: var(--shadow); }
.card h2 { font: 600 1.15rem/1.25 var(--display); letter-spacing: -.01em; margin: 0 0 6px; }
.take { margin: 0 0 12px; font-weight: 500; }
.legend { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.legend .fl { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--money); vertical-align: middle; margin-right: 6px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.card.wide { grid-column: 1 / -1; }
.only-narrow { display: none; }
@media (max-width: 700px) {
  .only-wide { display: none; }
  .only-narrow { display: block; }
}
.chart .tick { fill: var(--muted); font: 400 13px var(--mono); }
.chart .axis { fill: var(--muted); font: 500 14px var(--body); }
.chart .frontier { fill: none; stroke: var(--money); stroke-width: 2.5; stroke-linejoin: round; }
.chart .pt { stroke: var(--card); stroke-width: 1.5; cursor: pointer; transition: r .12s; }
.chart .pt.on { stroke: var(--money); stroke-width: 2.5; }
.chart .pt.hl { stroke: var(--ink); stroke-width: 3; }
.chart .pt:hover, .chart .pt:focus-visible { stroke: var(--ink); stroke-width: 2.5; outline: none; }
.chart .flabel { fill: var(--ink); font: 600 13px var(--body); paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.chart .blabel { fill: var(--ink); font: 500 15px var(--body); }
.chart .bnote { fill: var(--muted); font: 400 12px var(--mono); }
.chart .bval { fill: var(--ink); font: 600 15px var(--mono); }

.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 280px;
  background: var(--ink); color: var(--paper); font: 500 .8rem/1.35 var(--body);
  padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow);
}

/* All-models table */
.model-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0 8px; }
.model-controls[hidden] { display: none; }
.model-controls label { display: grid; gap: 4px; font-size: .9rem; }
.model-controls input[type="search"], .model-controls select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 9px; max-width: 100%; }
.model-controls .measured-only { display: flex; align-items: center; padding: 9px 0; }
.model-controls button { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 9px; cursor: pointer; }
.model-count { font-size: .85rem; color: var(--muted); }
.chart.bars { min-height: 160px; }
@media (max-width: 480px) {
  .only-narrow .chart.bars { width: 560px; max-width: none; }
  .only-narrow:has(.bars) { overflow-x: auto; }
  .plan-lines li { flex-wrap: wrap; }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .facts dd { overflow-wrap: anywhere; }
}
.models { margin: 56px 0; }
.models h2 { font: 800 1.8rem/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 16px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
thead th { font: 600 .75rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); position: sticky; top: 0; background: var(--card); }
tbody th { font-weight: 500; }
tbody th a { text-decoration: none; }
tbody tr:last-child > * { border-bottom: 0; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }

/* Model pages */
.model { padding: 36px 0 56px; }
.model h1 { font: 800 clamp(2rem, 4.5vw, 3.2rem)/1.05 var(--display); letter-spacing: -.03em; margin: 0 0 28px; }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.big { font: 600 2.4rem/1 var(--mono); margin: 6px 0 8px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 6px 0 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: var(--mono); text-align: right; }
.plan-lines { list-style: none; margin: 6px 0 0; padding: 0; }
.plan-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--rule); }
.plan-lines b { font-family: var(--mono); font-weight: 600; }

/* Info pages */
.prose { max-width: 68ch; padding: 36px 0 64px; }
.prose h1 { font: 800 clamp(2rem, 4.5vw, 3rem)/1.05 var(--display); letter-spacing: -.03em; margin: 0 0 20px; }
.prose h2 { font: 600 1.35rem/1.25 var(--display); margin: 36px 0 8px; }
.prose li { margin-bottom: 6px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 28px 20px 48px; border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem; }
.foot p { margin: 0 0 8px; max-width: 90ch; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 20px; }
  .receipt { justify-self: start; transform: none; }
  .charts, .model-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .top nav { gap: 12px; font-size: .9rem; }
  .card { padding: 16px 14px 12px; }
  .receipt { padding: 22px 16px 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .receipt.printing { animation: none; }
  .chart .pt { transition: none; }
}

/* Keep the original chart application isolated inside the editorial home. */
.chart-embed-section { margin-bottom: 56px; }
.chart-embed-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.chart-embed-heading h2 { font: 800 clamp(1.5rem, 2.7vw, 2.2rem)/1.15 var(--display); letter-spacing: -.025em; margin: 0; }
.chart-embed-heading .kicker { margin-bottom: 10px; }
.chart-embed-heading button { flex: none; }
.chart-embed-shell { position: relative; border: 1px solid var(--rule); background: white; box-shadow: var(--shadow); }
.chart-embed-shell iframe { display: block; width: 100%; height: 850px; border: 0; background: white; }
.chart-reading { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; color: var(--muted); font-size: .9rem; }
.chart-embed-shell:fullscreen, .chart-embed-shell.chart-expanded { width: 100vw; height: 100dvh; max-width: none; border: 0; background: white; }
.chart-embed-shell.chart-expanded { position: fixed; inset: 0; z-index: 200; }
.chart-embed-shell:fullscreen iframe, .chart-embed-shell.chart-expanded iframe { height: calc(100dvh - 42px); }
.chart-close { display: block; height: 42px; width: 100%; padding: 8px 18px; border: 0; border-bottom: 1px solid var(--rule); color: var(--ink); background: var(--card); font: 500 .9rem var(--body); text-align: right; cursor: pointer; }
.chart-close[hidden] { display: none; }
@media(min-width:1200px) { .chart-embed-section { position: relative; width: min(1680px, calc(100vw - 64px)); left: 50%; transform: translateX(-50%); } }
@media(max-width:600px) { .chart-embed-heading { align-items: flex-start; flex-direction: column; gap: 12px; }.chart-embed-shell iframe { height: 760px; }.chart-reading { grid-template-columns: 1fr; gap: 0; } }

/* Keep API dollars prominent in the accepted receipt design. */
.tier-label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.tier-select { width: 100%; max-width: 380px; padding: 9px 12px; margin-bottom: 18px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: var(--ink); font: 400 .9rem var(--body); }
.r-api-dollar { font: 800 1.9rem/1.15 var(--display); color: var(--money); margin: 18px 0 10px; }
.r-explain { font-size: .85rem; margin: 12px 0; }
.r-basis, .r-range { font-size: .78rem; margin: 8px 0 16px; }
