/* RANKED "Terminal": the vendor guides' look (FG-44-25 #1830; ds/term/README.md). The only place this look defines a
   colour, a font family or a type size; term.css only reads these. Dark by default, light under
   prefers-color-scheme: light. ranked/design.py bundles this file, then term.css, into one content-hashed stylesheet
   (the term bundle), linked only by the vendor_guide kind's pages (ranked/factory/vendor_home.document). */

/* One face: Overpass Mono (SIL OFL 1.1), the design system's own file, served from the site's origin. */
@font-face { font-family: "Overpass Mono"; src: url("/assets/fonts/overpass-mono-latin.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark light;

  /* the screen: dark by default */
  --bg: #0B0E0C;
  --panel: #0F1411;           /* the board and the forms, a step above the screen */
  --row-alt: #121915;         /* every other row of the board */
  --ink: #D4DDD7;
  --dim: #8E9E94;             /* labels, times, the line under a heading */
  --rule: #222B25;            /* hairlines between rows: decorative, never the only cue */
  --rule-strong: #3B4A41;     /* a box's edge: decorative */
  --field-line: #6F8177;      /* a form field's edge: 3:1 on the screen and on the panel (WCAG 1.4.11) */
  --field-bg: #070908;
  --accent: #3EE07F;          /* the ONE accent: the prompt, the lowest price, links, focus, the desk's button */
  --on-accent: #03120A;
  --sel: rgba(62, 224, 127, .10);   /* a row under the pointer or picked with j and k */
  --focus: #3EE07F;

  /* type */
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --t-h1: 24px;
  --t-h2: 17px;
  --t-body: 15px;
  --t-price: 17px;            /* the board's lowest price */
  --t-small: 14px;            /* the floor for words */
  --t-label: 12px;            /* upper-case column heads and paid labels only */

  /* spacing (4px base) and width; no radii: nothing here is rounded */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --gutter: 16px;
  --max: 1320px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F3F5F2;
    --panel: #FFFFFF;
    --row-alt: #F5F7F4;
    --ink: #0E1510;
    --dim: #4A5850;
    --rule: #DCE2DD;
    --rule-strong: #A5B1AA;
    --field-line: #6B7A71;
    --field-bg: #FFFFFF;
    --accent: #07703A;
    --on-accent: #FFFFFF;
    --sel: rgba(7, 112, 58, .08);
    --focus: #07703A;
  }
}

@media (min-width: 768px) { :root { --gutter: 32px; } }
@media (min-width: 1024px) { :root { --t-h1: 30px; --t-h2: 19px; --t-price: 18px; } }
/* RANKED "Terminal": every rule of the vendor guides' look (FG-44-25 #1830; ds/term/README.md). Reads tokens.css only.
   The pages are the kind's own plain markup (ranked/factory/vendor_home.py, vendor_page.py) and the site join's modules,
   so most rules read elements, ids and the few classes those renderers write. Sections:
   1 base  2 the prompt  3 headings and text  4 the board  5 lists and facts  6 forms  7 labels  8 the footer  9 motion */

/* 1 base ---------------------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: var(--t-body); line-height: 1.6; font-weight: 400;
  font-variant-numeric: tabular-nums;
}
main, header.tty, body > footer {
  width: 100%; max-width: var(--max); margin-left: auto; margin-right: auto;
  padding-left: var(--gutter); padding-right: var(--gutter);
}
main { padding-top: var(--s6); padding-bottom: var(--s7); }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus:not(:focus-visible) { outline: none; }  /* a pointer's focus; a browser without :focus-visible keeps its own ring */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

/* 2 the prompt: <header class="tty">, the site's address and the page's path as a shell prompt ------------------- */
header.tty {
  display: flex; align-items: center; gap: var(--s2) var(--s4); flex-wrap: wrap;
  min-height: 56px; padding-top: var(--s2); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--rule);
}
.tty-line { display: flex; align-items: center; min-width: 0; flex: 1 1 auto; margin: 0; white-space: nowrap; }
.tty-host { color: var(--accent); font-weight: 700; text-decoration: none; }
.tty-host:hover { text-decoration: underline; }
.tty-path { color: var(--dim); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tty-sigil { color: var(--ink); padding-left: .2ch; }
.tty-cursor {
  display: inline-block; flex: none; width: 1ch; height: 1.15em; margin-left: .6ch;
  background: var(--accent); vertical-align: text-bottom;
  animation: tty-blink 1.06s steps(1, end) infinite;
}
.tty-act {
  flex: none; padding: 6px 12px; border: 1px solid var(--accent);
  color: var(--accent); text-decoration: none; font-weight: 700; white-space: nowrap;
}
.tty-act::before { content: "> " / ""; }
@media (max-width: 479px) { header.tty { font-size: var(--t-small); } .tty-act { padding: 4px 8px; } }
.tty-act:hover { background: var(--accent); color: var(--on-accent); }

/* 3 headings and text --------------------------------------------------------------------------------------------- */
h1, h2, h3 { font-family: var(--mono); color: var(--ink); text-wrap: balance; }
h1 { font-size: var(--t-h1); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; margin: 0 0 var(--s3); }
h1::before { content: "# " / ""; color: var(--accent); }
h2 { font-size: var(--t-h2); line-height: 1.35; font-weight: 700; margin: 0 0 var(--s3); }
h2::before { content: "## " / ""; color: var(--dim); font-weight: 400; }
h3 { font-size: var(--t-body); line-height: 1.4; font-weight: 700; margin: var(--s5) 0 var(--s2); }
p { margin: 0 0 var(--s3); max-width: 92ch; }
p[data-answer] { color: var(--dim); margin-bottom: var(--s6); }
main > section, main > form { margin: 0 0 var(--s7); }
main > section > p:last-child { margin-bottom: 0; }
time { white-space: nowrap; }

/* 4 the board: the home's live price index (#price-index; vendor_home.index_html) --------------------------------- */
#price-index > h2 { font-size: calc(var(--t-h2) + 2px); }
#price-index > h2::before { content: "$ " / ""; color: var(--accent); }
#price-index > h2 + p { color: var(--dim); }
#price-index > p:has(> time) { display: flex; align-items: center; flex-wrap: wrap; gap: 0 1ch; color: var(--dim); font-size: var(--t-small); }
#price-index > p:has(> time)::before {
  content: "" / ""; display: inline-block; width: 8px; height: 8px; margin-right: .4ch;
  background: var(--accent); box-shadow: 0 0 0 3px var(--sel); animation: tty-pulse 2.4s ease-in-out infinite;
}
#price-index > p:has(> time) time { color: var(--ink); }
/* A table at a desk's width: fixed columns, so every one fits and the cheapest cloud is never cut off; a card per row on
   a phone (below). The cells, in vendor_home.INDEX_COLUMNS order: gpu (th), lowest, median, clouds, cheapest, spot,
   reserved; a cell's second line (region, cloud, read time) is its .sub. A model with several spellings opens its
   tbody.family with its heading row (tr.model), its spellings under it as a tree. */
.board { overflow-x: auto; border: 1px solid var(--rule-strong); background: var(--panel); margin: var(--s4) 0 var(--s3); }
.board:focus-visible { outline-offset: 3px; }
.board table { width: 100%; min-width: 1100px; border-collapse: collapse; table-layout: fixed; }
.board th, .board td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.board tbody:last-child tr:last-child > * { border-bottom: 0; }
.board thead th {
  font-size: var(--t-label); line-height: 1.35; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--dim); border-bottom: 1px solid var(--rule-strong); vertical-align: bottom; background: var(--panel);
  overflow-wrap: normal;
}
#price-index .board thead th:nth-child(1), #price-index .board thead th:nth-child(2) { width: 13%; }
#price-index .board thead th:nth-child(3) { width: 7.5%; }
#price-index .board thead th:nth-child(4) { width: 5.5%; }
#price-index .board thead th:nth-child(n+5) { width: 20.33%; }
.board tbody th { font-weight: 700; color: var(--ink); }
.board thead th:first-child, .board tbody th[scope="row"] {
  position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: inset -1px 0 0 var(--rule);
}
.board tbody tr:hover > *, .board tbody tr:focus > *, .board tbody tr:focus-within > * { background-color: var(--panel); background-image: linear-gradient(var(--sel), var(--sel)); }
.board tbody tr:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
.board tbody tr.model > th {
  padding-top: 14px; padding-bottom: 4px; color: var(--accent); font-size: var(--t-small); letter-spacing: .04em;
  border-bottom: 0; background: var(--panel); background-image: none;
}
.board tbody tr.model > th::before { content: "[" / ""; color: var(--dim); }
.board tbody tr.model > th::after { content: "]" / ""; color: var(--dim); }
.board tbody.family th[scope="row"] { padding-left: calc(12px + 3ch); font-weight: 400; }
.board tbody.family th[scope="row"]::before { content: "├─ " / ""; margin-left: -3ch; color: var(--dim); }
.board tbody.family tr:last-child th[scope="row"]::before { content: "└─ " / ""; }
.board tbody td { color: var(--ink); }
#price-index .board tbody td:nth-child(2) { position: relative; padding-right: calc(12px + 56px); color: var(--accent); font-weight: 700; font-size: var(--t-price); white-space: nowrap; }
#price-index .board tbody td:nth-child(3) { white-space: nowrap; }
#price-index .board tbody td:nth-child(4) { color: var(--dim); }
#price-index .board tbody td:nth-child(n+5) { font-size: var(--t-small); }
/* the token board (vendor_home.tokens_html): model, lowest input, median input, lowest output, median output, providers */
#token-index .board tbody td:nth-child(2), #token-index .board tbody td:nth-child(4) { color: var(--accent); font-weight: 700; }
#token-index .board tbody td:nth-child(6) { color: var(--dim); }
.board .sub { display: block; font-size: var(--t-small); font-weight: 400; color: var(--dim); white-space: normal; }
.board .none { font-size: var(--t-small); font-weight: 400; color: var(--dim); }
.board td a { font-weight: 700; }
.board td time { color: var(--dim); }
/* a sparkline (vendor_look.spark) sits in its price cell's top right, inside the cell's own padding */
.board td .spark { position: absolute; top: 15px; right: 12px; margin: 0; }
@media (max-width: 759px) {
  .board { overflow: visible; border: 0; background: none; }
  .board table, .board tbody, .board tr, .board th, .board td { display: block; width: auto; min-width: 0; }
  .board thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .board tbody tr:not(.model) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2) var(--s4);
    margin: 0 0 var(--s2); padding: var(--s3); border: 1px solid var(--rule-strong); background: var(--panel);
  }
  .board th, .board td { padding: 0; border: 0; }
  .board tbody th[scope="row"] { grid-column: 1 / -1; position: static; box-shadow: none; background: none; font-size: var(--t-body); }
  .board tbody.family th[scope="row"] { padding-left: 0; }
  .board tbody.family th[scope="row"]::before, .board tbody.family tr:last-child th[scope="row"]::before { content: "└─ " / ""; margin-left: 0; }
  .board tbody tr.model > th { padding: var(--s3) 0 var(--s2); background: none; }
  .board td time { white-space: normal; }
  #price-index .board tbody td:nth-child(2) { grid-column: 1 / -1; padding-right: calc(56px + var(--s2)); }
  #price-index .board tbody td:nth-child(5) { grid-column: 1 / -1; }
  .board td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px; font-size: var(--t-label); font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; color: var(--dim); white-space: normal;
  }
  .board td .spark { top: 22px; right: 0; }
  .board tbody tr:hover > *, .board tbody tr:focus-within > * { background: none; }
}
/* a row the find field (keys.js) hides stays hidden in every layout: the cards' display would show it (Codex, #2047) */
.board tbody tr[hidden] { display: none; }
/* the models the board leaves off (vendor_home.tracked_html): one line, open for each name and why */
details.tracked { margin: 0 0 var(--s4); border: 1px dashed var(--rule-strong); padding: var(--s2) var(--s3); font-size: var(--t-small); color: var(--dim); }
details.tracked > summary { cursor: pointer; color: var(--ink); list-style: none; }
details.tracked > summary::-webkit-details-marker { display: none; }
details.tracked > summary::before { content: "[+] " / ""; color: var(--accent); font-weight: 700; }
details.tracked[open] > summary::before { content: "[-] " / ""; }
details.tracked > p { margin: var(--s3) 0 var(--s1); }
details.tracked ul { list-style: none; margin: 0 0 var(--s1); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) 0; }
details.tracked li { margin: 0; padding: 0; color: var(--ink); white-space: nowrap; }
details.tracked li:not(:last-child)::after { content: "·" / ""; padding: 0 1.2ch; color: var(--dim); }
#price-index > p:has(> a):not(:has(time)) { display: inline-block; margin: 0 var(--s4) 0 0; font-size: var(--t-small); }
#price-index > p:has(> a):not(:has(time)) a::before { content: "./" / ""; color: var(--dim); }
/* the find field and the keys keys.js adds above the board (ds/term/keys.js): never in the page without the script */
.board-find { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: var(--s4) 0 0; }
.board-find label { display: flex; align-items: center; gap: 1ch; color: var(--dim); font-size: var(--t-small); }
#price-index .board-find input { width: 18em; max-width: 60vw; min-height: 36px; padding: 4px 10px; }
.keys { display: inline-flex; gap: 6px; }
kbd {
  font-family: var(--mono); font-size: var(--t-label); line-height: 1; padding: 4px 6px; color: var(--dim);
  border: 1px solid var(--rule-strong); border-bottom-width: 2px;
}
/* a sparkline (vendor_look.spark): one price over time, a gap where a day has no reading */
.spark { display: inline-block; width: 48px; height: 12px; margin-left: 1ch; vertical-align: middle; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--accent); }

/* 5 lists and facts ----------------------------------------------------------------------------------------------- */
ul, ol { margin: 0 0 var(--s3); padding-left: 2.6ch; }
ul { list-style: square; }
ol { list-style: decimal-leading-zero; padding-left: 4ch; }
li { margin: 0 0 var(--s1); padding-left: .4ch; }
li::marker { color: var(--accent); font-weight: 700; }
ol > li { padding: var(--s1) 0 var(--s1) .6ch; border-bottom: 1px solid var(--rule); margin: 0; }
li.fact { margin: 0; padding: var(--s2) 0 var(--s2) .4ch; border-bottom: 1px dashed var(--rule); }
li.fact time, li.fact a.source { font-size: var(--t-small); }
li.fact time { color: var(--dim); }
a.source::before { content: "[" / ""; color: var(--dim); }
a.source::after { content: "]" / ""; color: var(--dim); }
p.sister { margin-top: var(--s3); }
p.sister a { font-weight: 700; }

/* 6 forms: the desk's buyer form (#request), the price alert (#price-alert) and a site join module's sign-up -------- */
section.desk, section[data-module] { border: 1px solid var(--rule-strong); border-top: 2px solid var(--accent); background: var(--panel); padding: var(--s5); }
section[data-module] { border-top-color: var(--rule-strong); }
section.desk > p, section[data-module] p { color: var(--dim); }
section.desk > p.desk-note { margin: var(--s4) 0 0; font-size: var(--t-small); border-left: 2px solid var(--rule-strong); padding-left: 1.5ch; }
form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3) var(--s4); margin: var(--s4) 0 0; max-width: 920px; }
form > p, form > div { margin: 0; max-width: none; }
form > h2, form > p:not(:has(> label)), form > p:has(input[type="checkbox"]), form > p:has(> button), form > p.consent,
form > button { grid-column: 1 / -1; }
@media (min-width: 720px) { section.desk form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
label { display: grid; gap: 6px; color: var(--dim); font-size: var(--t-small); }
label:has(> input[type="checkbox"]), p.consent { display: flex; align-items: flex-start; gap: 1.2ch; color: var(--ink); line-height: 1.55; }
p.consent label { display: inline; color: var(--ink); }
.field { display: grid; gap: 6px; }
.field > label { display: block; }
input, select, textarea, button { font-family: var(--mono); font-size: var(--t-body); }
input:not([type="checkbox"]):not([type="hidden"]), select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; margin: 0;
  color: var(--ink); background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 0;
  caret-color: var(--accent);
}
input[type="checkbox"] { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
select { accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
button {
  min-height: 44px; padding: 10px 20px; border: 1px solid var(--accent); border-radius: 0;
  background: transparent; color: var(--accent); font-weight: 700; cursor: pointer;
}
button::before { content: "> " / ""; }
button:hover { background: var(--sel); }
#request button { background: var(--accent); color: var(--on-accent); }
#request button:hover { filter: brightness(1.08); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* 7 labels: a vendor's paid relationship (ranked/factory/vendor_label.py): always shown, never an accent ------------ */
span.paid-label {
  display: inline-block; margin-left: .8ch; padding: 0 .7ch; border: 1px solid var(--ink); color: var(--ink);
  font-size: var(--t-label); font-weight: 700; line-height: 1.6; letter-spacing: .06em; text-transform: uppercase;
  vertical-align: 1px; white-space: nowrap;
}
p.paid-label { border-left: 2px solid var(--ink); padding-left: 1.5ch; margin-bottom: var(--s5); color: var(--ink); }
p.paid-label span.paid-label { margin-left: .4ch; }

/* 8 the footer: the site's trust pages ---------------------------------------------------------------------------- */
body > footer { border-top: 1px solid var(--rule); padding-top: var(--s5); padding-bottom: var(--s7); color: var(--dim); font-size: var(--t-small); }
body > footer ul { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); list-style: none; margin: 0; padding: 0; }
body > footer li { margin: 0; padding: 0; }
body > footer a { color: var(--dim); }
body > footer a:hover { color: var(--accent); }

/* 9 motion: the cursor and the live dot; still for anyone who asks for less motion -------------------------------- */
@keyframes tty-blink { 50% { opacity: 0; } }
@keyframes tty-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .tty-cursor, #price-index > p:has(> time)::before { animation: none; }
}
