/* shipgauge — measurement-lab surface.
 *
 * The page this replaces had the right instinct (dark, monospace, no
 * decoration) and the wrong content: a study that measured 20 (model, device)
 * rows on real hardware showed NONE of them. The visitor got a heading, a
 * paragraph, two empty dropdowns and a 200-word footnote about the Resource
 * Timing API. The finding was in results/results.json, unreferenced.
 *
 * So the surface is built around the data. A bar chart of measured transfer
 * against the figure everyone cites is the first object on the page; the live
 * "run it here" harness is a second panel below it, framed as one more data
 * point rather than as the whole product.
 *
 * The three brand values below (--bg, --text, --accent) are unchanged from the
 * original stylesheet on purpose: a sibling project (assay) cites them by
 * file and line as a real ingested palette, and quietly moving them would
 * break a claim someone else's tests check. Everything else is derived.
 */

/* ======================================================= 1. SUBSTRATE ===== */

:root {
  color-scheme: dark;

  /* The brand triple, cited elsewhere by value — do not change these three. */
  --bg: #0b0d12;
  --text: #e6e9f2;
  --accent: #5eb3ff;

  --sig-h: 245;   /* --accent expressed as a hue */
  --sub-h: 258;

  --s-0: oklch(0.148 0.014 var(--sub-h));
  --s-1: oklch(0.190 0.015 var(--sub-h));
  --s-2: oklch(0.232 0.015 var(--sub-h));
  --s-3: oklch(0.282 0.014 var(--sub-h));
  --edge-lo: oklch(0.318 0.013 var(--sub-h));
  --edge-hi: oklch(0.435 0.014 var(--sub-h));

  --ink-1: oklch(0.965 0.005 var(--sub-h));
  --ink-2: oklch(0.805 0.010 var(--sub-h));
  --ink-3: oklch(0.665 0.013 var(--sub-h));

  --shadow-ink: oklch(0.07 0.032 262);

  --sig: oklch(0.76 0.135 var(--sig-h));
  --sig-ink: oklch(0.845 0.11 var(--sig-h));
  --sig-glow: oklch(0.86 0.17 var(--sig-h));

  --ok: oklch(0.77 0.16 152);
  --warn: oklch(0.80 0.15 78);
  --bad: oklch(0.72 0.17 27);
  --ghost: oklch(0.40 0.02 var(--sub-h));

  --lit: inset 0 1px 0 var(--edge-hi);
  --elev-1: 0 1px 2px -1px oklch(from var(--shadow-ink) l c h / 32%),
            0 4px 12px -4px oklch(from var(--shadow-ink) l c h / 36%);
  --elev-2: 0 2px 4px -2px oklch(from var(--shadow-ink) l c h / 38%),
            0 14px 34px -10px oklch(from var(--shadow-ink) l c h / 46%);
  --elev-3: 0 6px 12px -6px oklch(from var(--shadow-ink) l c h / 44%),
            0 32px 76px -18px oklch(from var(--shadow-ink) l c h / 56%);

  --r-panel: 12px;
  --r-control: 8px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --slow: 460ms;

  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-data: "JetBrains Mono", ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --f-text: "Manrope", ui-sans-serif, system-ui, "Segoe UI", sans-serif;

  --shell: 1220px;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("./vendor/fonts/SpaceGrotesk[wght].woff2") format("woff2-variations");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("./vendor/fonts/Manrope[wght].woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./vendor/fonts/JetBrainsMono[wght].woff2") format("woff2-variations");
  font-weight: 100 800;
  font-display: swap;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--s-0);
  color: var(--ink-1);
  font-family: var(--f-text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.shell { max-width: var(--shell); margin-inline: auto; padding-inline: 24px; }
@media (max-width: 640px) { .shell { padding-inline: 18px; } }

/* ============================================================ 2. TYPE ===== */

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; }

.display {
  font-size: clamp(2.2rem, 1.3rem + 3.9vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

.display em { font-style: normal; color: var(--sig-ink); }

h2.section-title {
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.25rem);
  letter-spacing: -0.035em;
  line-height: 1.12;
  text-wrap: balance;
}

.eyebrow {
  font-family: var(--f-data);
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lede {
  font-size: clamp(1.02rem, 0.97rem + 0.24vw, 1.16rem);
  color: var(--ink-2);
  max-width: 56ch;
  margin: 14px 0 0;
}

.note { font-size: 0.8rem; color: var(--ink-3); line-height: 1.55; max-width: 82ch; }

code, .data { font-family: var(--f-data); font-variant-numeric: tabular-nums; }

code.inline { background: var(--s-2); padding: 1px 6px; border-radius: 5px; font-size: 0.86em; color: var(--ink-1); }

a { color: var(--sig-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink-1); }

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

/* ========================================================== 3. HEADER ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--s-0) 93%, transparent);
  border-bottom: 1px solid var(--edge-lo);
}

.site-header__in { display: flex; align-items: center; gap: 11px; height: 58px; }

.gauge-mark { width: 22px; height: 22px; flex: none; display: block; }

.wordmark { font-family: var(--f-display); font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }

.site-header nav { margin-left: auto; display: flex; gap: 4px; font-family: var(--f-data); font-size: 0.8rem; }

.site-header nav a {
  color: var(--ink-3);
  text-decoration: none;
  padding: 8px 12px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-control);
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.site-header nav a:hover { color: var(--ink-1); background: var(--s-2); }

@media (max-width: 760px) {
  .site-header nav a[data-optional] { display: none; }
  .site-header nav a { padding: 8px 10px; font-size: 0.76rem; }
}

/* ============================================================ 4. BANDS ==== */

.band { padding-block: clamp(50px, 3.8vw, 88px); border-top: 1px solid var(--edge-lo); }
.band--tone { background: var(--s-1); }
.band__head { margin-bottom: 26px; }
.band__head .eyebrow { display: block; margin-bottom: 10px; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(30px, 2.5vw, 44px) clamp(46px, 4vw, 80px);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -28% -12% auto -12%;
  height: 150%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(50% 44% at 20% 2%, oklch(from var(--sig-glow) l c h / 18%), transparent 68%),
    radial-gradient(42% 40% at 90% 6%, oklch(0.8 0.14 168 / 10%), transparent 70%);
}

/* ============================================================ 5. CHART ==== */

.chart-panel {
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-3);
  overflow: hidden;
  margin-top: 26px;
}

.chart-panel__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 16px;
  background: var(--s-2);
  border-bottom: 1px solid var(--edge-lo);
  font-family: var(--f-data);
  font-size: 0.72rem;
  color: var(--ink-3);
}

.legend { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 8px; border-radius: 2px; display: block; }
.legend .k-adv { background: var(--ghost); }
.legend .k-real { background: var(--sig); }

.chart { padding: 18px 16px 20px; }

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 14px;
  padding: 10px 0;
  border-top: 1px solid oklch(from var(--edge-lo) l c h / 55%);
}

.row:first-child { border-top: 0; }

@media (min-width: 720px) {
  .row { grid-template-columns: 13.5rem minmax(0, 1fr) 8.6rem; align-items: center; gap: 16px; }
}

.row__name { font-family: var(--f-data); font-size: 0.79rem; color: var(--ink-1); overflow-wrap: anywhere; }
.row__name small { display: block; color: var(--ink-3); font-size: 0.68rem; margin-top: 2px; }

.bars { display: grid; gap: 4px; }

.bar {
  height: 11px;
  border-radius: 3px;
  position: relative;
  background: var(--s-2);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  transform-origin: left center;
  animation: grow var(--slow) var(--ease) both;
}

.bar--adv i { background: var(--ghost); }
.bar--real i { background: var(--sig); }

@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.row__delta {
  font-family: var(--f-data);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ok);
  text-align: left;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 720px) { .row__delta { text-align: right; } }

.row__delta small { display: block; color: var(--ink-3); font-weight: 400; font-size: 0.66rem; margin-top: 2px; }

.chart__foot {
  padding: 13px 16px;
  border-top: 1px solid var(--edge-lo);
  background: var(--s-1);
  font-family: var(--f-data);
  font-size: 0.68rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* ========================================================= 6. READOUTS ==== */

.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 880px) { .readouts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.readout {
  padding: 20px;
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-1);
}

.band--tone .readout { background: var(--s-2); }

.readout__n {
  font-family: var(--f-display);
  font-size: clamp(1.95rem, 1.4rem + 2.1vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.readout__n.is-ok { color: var(--ok); }
.readout__n.is-warn { color: var(--warn); }
.readout__n.is-bad { color: var(--bad); }

.readout__l { margin-top: 10px; font-family: var(--f-data); font-size: 0.71rem; color: var(--ink-3); line-height: 1.5; }

/* ============================================================ 7. MACHINE == */

.machine {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--s-2);
  box-shadow: var(--lit);
  font-family: var(--f-data);
  font-size: 0.72rem;
  color: var(--ink-2);
}

.chip b { color: var(--ink-1); font-weight: 600; }
.chip--n { color: var(--ink-3); }

.chip--live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--sig);
  box-shadow: 0 0 0 3px oklch(from var(--sig) l c h / 22%);
}

/* ============================================================ 8. TABLE ==== */

.tablewrap {
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-1);
  overflow-x: auto;
}

table.grid { border-collapse: collapse; width: 100%; font-family: var(--f-data); font-size: 0.76rem; }

table.grid th, table.grid td {
  text-align: right;
  padding: 10px 14px;
  border-bottom: 1px solid oklch(from var(--edge-lo) l c h / 55%);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.grid th:first-child, table.grid td:first-child { text-align: left; }

table.grid thead th {
  position: sticky;
  top: 0;
  background: var(--s-2);
  color: var(--ink-3);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 1;
}

table.grid tbody tr { transition: background-color var(--fast) var(--ease); }
table.grid tbody tr:hover { background: var(--s-2); }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.model { color: var(--ink-1); white-space: normal; min-width: 12rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  min-height: 22px;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  background: var(--s-2);
  color: var(--ink-3);
}

table.grid tbody tr:hover .tag { background: var(--s-3); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: none; }
.tag--ok { color: var(--ok); }
.tag--bad { color: var(--bad); }
.tag--gpu { color: var(--sig-ink); }

/* =========================================================== 9. CONSOLE === */

.console {
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-2);
  overflow: hidden;
}

.console__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: var(--s-2);
  border-bottom: 1px solid var(--edge-lo);
  font-family: var(--f-data);
  font-size: 0.72rem;
  color: var(--ink-3);
}

.console__body { padding: 20px; display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .console__body { grid-template-columns: 19rem minmax(0, 1fr); } }

.field { display: block; margin-bottom: 14px; }

.field > span {
  display: block;
  font-family: var(--f-data);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}

select {
  width: 100%;
  font: 400 0.82rem var(--f-data);
  color: var(--ink-1);
  background: var(--s-2);
  border: 1px solid var(--edge-lo);
  border-radius: var(--r-control);
  padding: 10px 34px 10px 12px;
  min-height: 42px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239aa3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

select:hover { border-color: var(--edge-hi); }
select option { background: var(--s-2); color: var(--ink-1); }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

button {
  font: 500 0.82rem var(--f-data);
  cursor: pointer;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  color: var(--ink-1);
  background: var(--s-2);
  box-shadow: var(--lit);
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease), color var(--fast) var(--ease);
}

button:hover:not(:disabled) { background: var(--s-3); transform: translateY(-1px); box-shadow: var(--lit), var(--elev-1); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.42; cursor: default; }

button.primary { background: var(--sig); color: oklch(0.16 0.02 258); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--sig-ink); }

.status {
  font-family: var(--f-data);
  font-size: 0.74rem;
  color: var(--ink-3);
  min-height: 3.2em;
  margin: 14px 0 0;
  white-space: pre-wrap;
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: var(--s-0);
}

.out { min-height: 8rem; }

.out__empty {
  display: grid;
  place-items: center;
  min-height: 12rem;
  border-radius: var(--r-control);
  background: var(--s-0);
  color: var(--ink-3);
  font-family: var(--f-data);
  font-size: 0.78rem;
  text-align: center;
  padding: 22px;
  line-height: 1.6;
}

table.kv { width: 100%; border-collapse: collapse; font-family: var(--f-data); font-size: 0.76rem; }

table.kv td {
  padding: 9px 12px;
  border-bottom: 1px solid oklch(from var(--edge-lo) l c h / 55%);
  vertical-align: top;
}

table.kv td:first-child { color: var(--ink-3); width: 44%; white-space: nowrap; }
table.kv td:last-child { color: var(--ink-1); overflow-wrap: anywhere; }
table.kv tr:last-child td { border-bottom: 0; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* ========================================================= 10. DETAILS ==== */

details.more {
  margin-top: 16px;
  border-radius: var(--r-control);
  background: var(--s-1);
  box-shadow: var(--lit);
  overflow: hidden;
}

.band--tone details.more { background: var(--s-2); }

details.more > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-data);
  font-size: 0.78rem;
  color: var(--ink-2);
  transition: background-color var(--fast) var(--ease);
}

details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; color: var(--sig-ink); font-weight: 700; }
details.more[open] > summary::before { content: "\2212"; }
details.more > summary:hover { background: var(--s-2); }
details.more .body { padding: 0 16px 16px; color: var(--ink-2); font-size: 0.86rem; line-height: 1.65; }
details.more .body p { margin: 0 0 10px; max-width: 80ch; }
details.more .body p:last-child { margin: 0; }
details.more .body ul { margin: 0; padding-left: 1.15em; }
details.more .body li { margin-bottom: 8px; }

/* ========================================================== 11. FOOTER ==== */

.site-footer { border-top: 1px solid var(--edge-lo); padding-block: 30px 44px; font-size: 0.82rem; color: var(--ink-3); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.site-footer nav a {
  color: var(--ink-3);
  text-decoration: none;
  padding: 7px 11px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-control);
  background: var(--s-1);
  font-family: var(--f-data);
  font-size: 0.76rem;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.site-footer nav a:hover { background: var(--s-2); color: var(--ink-1); }

/* attribution-kit v1 */
.aj-attribution { margin: 0; font: inherit; line-height: 1.5; color: inherit; }
.aj-attribution__mark { display: inline-block; width: 20px; height: 20px; vertical-align: -0.3em; margin-right: 0.45em; }
.aj-attribution a { color: inherit; text-decoration: underline; text-underline-offset: 0.15em; }
.aj-attribution a:hover { text-decoration-thickness: 2px; color: var(--ink-1); }
.aj-attribution a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.aj-attribution__sep { margin: 0 0.35em; }
.aj-attribution { --aj-attribution-signal: oklch(0.76 0.135 245); }

/* ==================================================== 12. REDUCED MOTION == */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar i { animation: none; }
  button, button:hover:not(:disabled), select, table.grid tbody tr,
  .site-header nav a, .site-footer nav a, details.more > summary { transition: none; transform: none; }
}
