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

/* Two faces, the design system's own files, served from the site's origin (SIL OFL 1.1): Overpass for words, Overpass
   Mono for figures, so prices line up digit under digit. */
@font-face { font-family: "Overpass"; src: url("/assets/fonts/overpass-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@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, a deep ink, never pure black */
  --bg: #0B1120;
  --panel: #111A2E;           /* the cards: the headline, the chart, the tables, the forms */
  --panel-2: #0E1628;         /* a table's head and the strip, a step below a card */
  --ink: #E7ECF5;
  --dim: #9BA7BC;             /* labels, times, the line under a heading */
  --rule: #1E2A44;            /* hairlines between rows: decorative, never the only cue */
  --rule-strong: #2F3D5C;     /* a card's edge: decorative */
  --field-line: #7A88A3;      /* a form field's edge: 3:1 on the screen and on a card (WCAG 1.4.11) */
  --field-bg: #0A1020;
  --accent: #FFB547;          /* the lowest price: its figure and its line, and the desk's button */
  --on-accent: #1A1000;
  --median: #7CC4FA;          /* the median's line and its key */
  --link: #9CC9FF;
  --up: #FF8A7A;              /* a price that rose: with its arrow and sign, never colour alone */
  --down: #5FD39A;            /* a price that fell */
  --sel: rgba(255, 181, 71, .10);   /* a row under the pointer or picked with j and k */
  --focus: #FFB547;

  /* type */
  --sans: "Overpass", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --t-figure: 44px;           /* the headline's price */
  --t-h1: 26px;
  --t-h2: 20px;
  --t-body: 16px;
  --t-price: 17px;            /* a table's price per GPU-hour */
  --t-small: 14px;            /* the floor for words */
  --t-label: 12px;            /* upper-case column heads and paid labels only */

  /* spacing (4px base), corners and width */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --radius: 12px;
  --radius-small: 6px;
  --gutter: 16px;
  --max: 1320px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F6F7F9;
    --panel: #FFFFFF;
    --panel-2: #F1F4F8;
    --ink: #0E1726;
    --dim: #4B5870;
    --rule: #E3E8EF;
    --rule-strong: #C9D2DE;
    --field-line: #6B7A93;
    --field-bg: #FFFFFF;
    --accent: #A35A00;
    --on-accent: #FFFFFF;
    --median: #0B6AA8;
    --link: #1F4FD1;
    --up: #B42318;
    --down: #087443;
    --sel: rgba(163, 90, 0, .08);
    --focus: #A35A00;
  }
}

@media (min-width: 768px) { :root { --gutter: 32px; } }
@media (min-width: 1024px) { :root { --t-figure: 60px; --t-h1: 32px; --t-h2: 22px; } }
/* RANKED "Index": every rule of the vendor guides' look (FG-44-18 #1654 part 5c; ds/index/README.md). Reads tokens.css
   only. A designed price index: a big number, a clear chart, clean tables, readable on a phone. The words are the page's
   own: the only generated content is a phone card's column label, the cell's own data-label, and empty marks. */

/* 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(--sans); font-size: var(--t-body);
  line-height: 1.55; font-variant-numeric: tabular-nums;
}
main, header.site, body > footer { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
main { padding-top: var(--s6); padding-bottom: var(--s7); }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
time { white-space: nowrap; }

/* 2 the masthead: the site's name and the desk's link (vendor_look.masthead) ----------------------------------------- */
header.site {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  padding-top: var(--s4); padding-bottom: var(--s4); border-bottom: 1px solid var(--rule);
}
.site-name { color: var(--ink); font-weight: 800; font-size: 20px; letter-spacing: -.01em; text-decoration: none; }
.site-name:hover { color: var(--accent); }
.site-act {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid var(--accent);
  border-radius: 999px; color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.site-act:hover { background: var(--sel); }

/* 3 headings and text --------------------------------------------------------------------------------------------- */
h1, h2, h3 { color: var(--ink); text-wrap: balance; }
h1 { font-size: var(--t-h1); line-height: 1.2; font-weight: 800; letter-spacing: -.015em; margin: 0 0 var(--s3); }
h2 { font-size: var(--t-h2); line-height: 1.3; font-weight: 750; margin: 0 0 var(--s3); }
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: 72ch; }
p[data-answer] { color: var(--dim); font-size: 18px; margin-bottom: var(--s5); }
main > section, main > form, main > div > section { margin: 0 0 var(--s7); }
main > section > p:last-child { margin-bottom: 0; }

/* 4 the home's price index (#price-index; vendor_home.index_html): the strip, then the board ----------------------- */
#price-index > h2 + p { color: var(--dim); }
#price-index > p:has(> time) { color: var(--dim); font-size: var(--t-small); }
#price-index > p:has(> time) time { color: var(--ink); }
/* the strip: each GPU's lowest price per GPU-hour and its 7-day move, one cell each, never wrapped mid-word */
.strip { margin: var(--s4) 0; }
.strip ul {
  list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.strip li { margin: 0; padding: 0; min-width: 0; }
.strip li > a, .strip li > span {
  display: grid; gap: 2px; height: 100%; padding: var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--radius-small);
  background: var(--panel); color: var(--ink); text-decoration: none;
}
.strip li > a:hover { border-color: var(--accent); }
.strip-gpu { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-price { font-family: var(--mono); font-size: var(--t-price); font-weight: 700; color: var(--accent); white-space: nowrap; }
/* the board: a table at a desk's width that scrolls sideways on a narrow screen; words wrap only between words */
.board {
  overflow-x: auto; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--panel);
  margin: var(--s4) 0 var(--s3);
}
.board table { width: 100%; min-width: 960px; border-collapse: collapse; }
/* the home's board: fixed columns, so every one fits a 1280px screen and the cheapest cloud is never cut off */
#price-index .board table { table-layout: fixed; }
#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 th, .board td {
  padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule);
  overflow-wrap: normal; word-break: normal; hyphens: none;
}
.board tbody:last-child tr:last-child > * { border-bottom: 0; }
.board thead th {
  background: var(--panel-2); color: var(--dim); font-size: var(--t-label); font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; vertical-align: bottom; white-space: normal;
}
.board tbody th { font-weight: 700; color: var(--ink); }
.board tbody th a { color: var(--ink); }
.board tbody tr:hover > *, .board tbody tr:focus > *, .board tbody tr:focus-within > * { 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: var(--s4); background: var(--panel-2); color: var(--dim); font-size: var(--t-small); font-weight: 700; }
.board tbody.family th[scope="row"] { padding-left: 28px; font-weight: 600; }
.board td { color: var(--ink); }
#price-index .board tbody td:nth-child(2) { position: relative; padding-right: calc(14px + 56px); color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: var(--t-price); white-space: nowrap; }
#price-index .board tbody td:nth-child(3), #price-index .board tbody td:nth-child(4) { font-family: var(--mono); white-space: nowrap; }
#price-index .board tbody td:nth-child(n+5) { font-size: var(--t-small); }
#token-index .board tbody td:nth-child(2), #token-index .board tbody td:nth-child(4) { color: var(--accent); font-family: var(--mono); font-weight: 700; white-space: nowrap; }
#token-index .board tbody td:nth-child(3), #token-index .board tbody td:nth-child(5) { font-family: var(--mono); white-space: nowrap; }
.board .sub { display: block; font-family: var(--sans); font-size: var(--t-small); font-weight: 400; color: var(--dim); white-space: normal; }
.board .none { font-family: var(--sans); font-size: var(--t-small); font-weight: 400; color: var(--dim); white-space: nowrap; }
.board td a { font-weight: 600; }
.board td time { color: var(--dim); }
.board td .spark { position: absolute; top: 16px; right: 14px; margin: 0; }
/* 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); padding: var(--s2) var(--s3); border: 1px dashed var(--rule-strong); border-radius: var(--radius-small); font-size: var(--t-small); color: var(--dim); }
details.tracked > summary { cursor: pointer; color: var(--ink); }
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) var(--s4); }
details.tracked li { margin: 0; padding: 0; color: var(--ink); white-space: nowrap; }
#price-index > p:has(> a):not(:has(time)) { display: inline-block; margin: 0 var(--s4) 0 0; font-size: var(--t-small); }
/* the find field and the keys keys.js adds above the board: 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; border-radius: 4px; }
/* 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 a GPU's price page (vendor_gpu): the headline, the chart, every offer, the GPU ------------------------------- */
.quote {
  display: grid; gap: var(--s2); padding: var(--s5); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--panel);
}
.quote > p { margin: 0; max-width: none; }
.quote-label { color: var(--dim); font-size: var(--t-small); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.quote-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1.2ch; }
.quote-figure { font-family: var(--sans); font-size: var(--t-figure); font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--accent); }
.quote-unit { color: var(--dim); font-size: 18px; }
.quote-at, .quote-asof, .quote-note { color: var(--dim); font-size: var(--t-small); }
.quote-note { color: var(--ink); font-size: var(--t-body); }
.quote-moves { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.quote-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s4) var(--s5); margin: var(--s3) 0 var(--s1);
  padding-top: var(--s4); border-top: 1px solid var(--rule);
}
.quote-stats div { min-width: 0; }
.quote-stats dt { color: var(--dim); font-size: var(--t-small); }
.quote-stats dd { margin: 2px 0 0; font-family: var(--mono); font-size: var(--t-price); font-weight: 700; }
.quote-stats dd .move { display: block; margin-top: 2px; }
.quote .sub { display: block; font-family: var(--sans); font-weight: 400; font-size: var(--t-small); color: var(--dim); }
.move { font-family: var(--mono); font-size: var(--t-small); font-weight: 700; white-space: nowrap; }
.move[data-move="up"] { color: var(--up); }
.move[data-move="down"] { color: var(--down); }
.move[data-move="flat"] { color: var(--dim); }
.move-label { font-family: var(--sans); font-weight: 400; color: var(--dim); }
.chart figure { margin: 0; padding: var(--s4); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--panel); }
.chart svg { display: block; width: 100%; height: auto; }
/* the SVG scales to its column, so its lines keep their own width and its labels a size for each screen */
.chart .grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .tick { fill: var(--dim); font-family: var(--mono); font-size: 13px; }
.chart path { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart path.lowest { stroke: var(--accent); }
.chart path.median { stroke: var(--median); stroke-dasharray: 6 4; }
.chart circle.lowest { fill: var(--accent); }
.chart circle.median { fill: var(--median); }
.chart circle.end { stroke: var(--panel); stroke-width: 2; }
.chart figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); margin-top: var(--s3); color: var(--dim); font-size: var(--t-small); }
.chart-key { margin: 0; display: flex; gap: var(--s4); }
.key::before { content: "" / ""; display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.key.lowest::before { background: var(--accent); }
.key.median::before { background: var(--median); }
.offers .board table { min-width: 880px; }
.offers .board tbody td:nth-child(2) { color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: var(--t-price); white-space: nowrap; }
.offers .board tbody td:nth-child(3), .offers .board tbody td:nth-child(6), .offers .board tbody td:nth-child(7) { font-family: var(--mono); white-space: nowrap; }
.offers .board tbody td:nth-child(5) { min-width: 14ch; }
.offers .board tbody.older td, .offers .board tbody.older th[scope="row"] { color: var(--dim); }
.offers .board tbody.older td:nth-child(2) { color: var(--ink); }
.gpu-spec ul { list-style: none; padding: 0; }
p.method { color: var(--dim); font-size: var(--t-small); }

/* 6 lists and facts (a vendor's page, a list, a comparison) --------------------------------------------------------- */
ul, ol { margin: 0 0 var(--s3); padding-left: 2.6ch; }
li { margin: 0 0 var(--s1); }
li::marker { color: var(--dim); }
ol > li { padding: var(--s1) 0; border-bottom: 1px solid var(--rule); margin: 0; }
li.fact { margin: 0; padding: var(--s2) 0; border-bottom: 1px solid var(--rule); }
li.fact time, li.fact a.source { font-size: var(--t-small); }
li.fact time { color: var(--dim); }
p.sister { margin-top: var(--s3); }
p.sister a { font-weight: 700; }

/* 7 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] { padding: var(--s5); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--panel); }
section.desk { border-top: 3px solid var(--accent); }
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); }
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(--sans); 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: var(--radius-small); 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 22px; border: 1px solid var(--accent); border-radius: 999px;
  background: transparent; color: var(--accent); font-weight: 700; cursor: pointer;
}
button:hover { background: var(--sel); }
#request button { background: var(--accent); color: var(--on-accent); }
#request button:hover { filter: brightness(1.06); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* 8 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); border-radius: 4px; 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: 3px solid var(--ink); padding-left: 1.5ch; margin-bottom: var(--s5); color: var(--ink); }
p.paid-label span.paid-label { margin-left: .4ch; }

/* 9 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); }

/* 10 a phone: each table row a card, each cell labelled with its column's own words -------------------------------- */
@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; }
  .offers .board table { 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); border-radius: var(--radius-small); background: var(--panel);
  }
  .board th, .board td { padding: 0; border: 0; }
  .board tbody th[scope="row"] { grid-column: 1 / -1; font-size: var(--t-body); white-space: normal; }
  .board tbody.family th[scope="row"] { padding-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), .offers .board tbody td:nth-child(2) { grid-column: 1 / -1; padding-right: calc(56px + var(--s2)); }
  #price-index .board tbody td:nth-child(5), .offers .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-family: var(--sans); font-size: var(--t-label);
    font-weight: 700; letter-spacing: .05em; 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; }
  .quote { padding: var(--s4); }
  .chart figure { padding: var(--s2); }
  .chart .tick { font-size: 30px; }
  .strip ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* a row the find field (keys.js) hides stays hidden in every layout: after the cards' display rule, which would show it */
.board tbody tr[hidden] { display: none; }

/* 11 motion: none but what a reader starts; still for anyone who asks for less ------------------------------------- */
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
