/* cloud-builds web UI — chrome + chart tokens.
 * Palette: dataviz reference instance (one accent hue + de-emphasis gray + fixed status colors).
 * Dark values are selected steps, declared under both the OS media query and the data-theme toggle. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;          /* categorical slot 1 (blue), light */
  --accent-track: #b7d3f6;    /* blue step 150: meter / bar track */
  --deemph: #898781;          /* de-emphasis for context marks */
  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;
  --warning: #fab219;
  --sample-bg: #fff6d6;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-track: #184f95;
    --deemph: #898781;
    --good: #0ca30c;
    --good-text: #0ca30c;
    --critical: #d03b3b;
    --warning: #fab219;
    --sample-bg: #3a3212;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-track: #184f95;
  --deemph: #898781;
  --good: #0ca30c;
  --good-text: #0ca30c;
  --critical: #d03b3b;
  --warning: #fab219;
  --sample-bg: #3a3212;
}

* { box-sizing: border-box; }
html { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--page); color: var(--ink); }
body { margin: 0; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.4rem; }
h4 { font-size: 0.95rem; margin: 0 0 0.3rem; }
p { margin: 0.4rem 0; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }

header.site {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem 1.4rem;
  padding: 0.9rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface);
}
header.site nav a { margin-right: 1rem; }
header.site nav a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: none; }
header.site .spacer { flex: 1; }
header.site label { color: var(--ink-2); font-size: 0.9rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.lede { color: var(--ink-2); max-width: 70ch; }

.notice { padding: 0.6rem 0.9rem; border-radius: 6px; margin: 0.6rem 0 1rem; border: 1px solid var(--border); }
.notice-sample { background: var(--sample-bg); }
.notice-error { border-color: var(--critical); }

.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: end; margin: 0.8rem 0 1rem; }
.filters label { display: grid; gap: 0.2rem; font-size: 0.85rem; color: var(--ink-2); }
select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis);
  border-radius: 6px; padding: 0.35rem 0.5rem; min-width: 12ch;
}
select:focus-visible, button:focus-visible, .frontier-pt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; }
/* chart column takes the remaining width, the frontier-point card has a fixed width: a long build name or provenance string
   in the card must never shrink the chart (fr tracks default to min-content sizing, hence minmax(0, …) and min-width: 0) */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.grid-2 > * { min-width: 0; overflow-wrap: break-word; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---- key/value lists ---- */
/* the key column takes what it needs up to 45% of the card, then wraps: long felt labels must not squeeze the values */
dl.kv { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: 0.25rem 0.9rem; margin: 0.4rem 0; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; }

/* ---- chart ---- */
figure.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.6rem 0.4rem; }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.grid line { stroke: var(--grid); stroke-width: 1; }
.axis { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis-label { fill: var(--ink-2); font-size: 11.5px; }
.direct-label { fill: var(--ink-2); font-size: 11.5px; }
.dominated circle { fill: var(--deemph); opacity: 0.45; }
.hit { fill: transparent; pointer-events: all; cursor: pointer; }
.frontier-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.frontier-pt .mark { fill: var(--accent); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.frontier-pt:hover .mark, .frontier-pt:focus-visible .mark { r: 7; }
.frontier-pt.selected .mark { stroke: var(--ink); }
.frontier-pt { outline: none; cursor: pointer; }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.85rem; color: var(--ink-2); padding: 0.3rem 0.2rem 0; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.key { display: inline-block; }
.key-line { width: 18px; height: 0; border-top: 2px solid var(--accent); position: relative; }
.key-line::after { content: ""; position: absolute; left: 5px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.key-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--deemph); opacity: 0.6; }

.tooltip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 300px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); padding: 0.5rem 0.7rem; font-size: 0.85rem;
}
.tt-title { color: var(--ink-2); font-size: 0.8rem; }
.tt-build { font-weight: 600; margin-bottom: 0.3rem; }
.tt-row { display: flex; gap: 0.6rem; justify-content: space-between; }
.tt-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-label { color: var(--ink-2); }

.detail .build { font-weight: 600; }

/* ---- tables ---- */
table.data { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.data th { color: var(--ink-2); font-weight: 600; }   /* headings wrap; a card-wide table scrolls (see #points/#budget) instead of overflowing */
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.num { white-space: nowrap; }
#points, #budget { overflow-x: auto; }
table.data tr.selected td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
table.data th button { all: unset; cursor: pointer; }
table.data th.sorted { color: var(--ink); }
.table-scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.table-scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* ---- steps ---- */
ol.steps { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.6rem; }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; font-size: 1.02rem; }
.price-chip { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.step-felt strong { font-weight: 700; }
.step-sub { font-size: 0.85rem; margin-top: 0.3rem; }
.tag { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }
.tag-good { color: var(--good-text); border-color: var(--good); }
.tag-bad { color: var(--critical); border-color: var(--critical); }

/* ---- config page ---- */
.hero { font-size: 1.6rem; font-weight: 600; }
.band { color: var(--ink-2); font-weight: 400; font-size: 0.85em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; }
.metric-line { color: var(--ink-2); font-size: 0.9rem; }
.price-hero { font-size: 2.4rem; font-weight: 600; margin: 0.2rem 0; }
.not-possible { color: var(--ink-2); font-style: italic; }
.uc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0.8rem; }

.bars { display: grid; grid-template-columns: max-content 1fr max-content; gap: 0.35rem 0.7rem; align-items: center; }
.bar-row { display: contents; }
.bar-label { color: var(--ink-2); font-size: 0.9rem; }
.bar-track { display: block; height: 14px; position: relative; }
.bar-fill { display: block; height: 14px; max-height: 24px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-value { font-variant-numeric: tabular-nums; font-size: 0.9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid var(--border); font-size: 0.85rem; }
.chip-icon { font-weight: 700; }
.chip-state { color: var(--ink-2); font-size: 0.8rem; }
.chip-pass { border-color: var(--good); } .chip-pass .chip-icon { color: var(--good-text); }
.chip-fail { border-color: var(--critical); } .chip-fail .chip-icon { color: var(--critical); }
.chip-unknown { border-color: var(--axis); } .chip-unknown .chip-icon { color: var(--muted); }

.meter-block { margin-top: 0.6rem; }
.meter { position: relative; height: 20px; }
.meter-track { position: absolute; left: 0; right: 0; top: 7px; height: 6px; border-radius: 3px; background: var(--accent-track); }
.meter-fill { position: absolute; left: 0; top: 7px; height: 6px; border-radius: 3px 0 0 3px; background: var(--accent); }
.meter-tick { position: absolute; top: 3px; width: 2px; height: 14px; background: var(--ink-2); transform: translateX(-1px); }
.meter-tick-beat { background: var(--ink); }
.meter-marker { position: absolute; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); transform: translateX(-7px); box-shadow: 0 0 0 1px var(--ink-2); }
.meter-legend { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.1rem; }
.meter-legend strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

pre.prewrap { white-space: pre-wrap; font: 0.85rem/1.4 ui-monospace, monospace; margin: 0.3rem 0; max-height: 40vh; overflow: auto; }
dl.kv dl.kv { margin: 0; }

/* ---- blend sliders (standard form controls in the filter area) ---- */
.blend { margin: 0 0 0.8rem; }
.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.4rem 1.2rem; margin: 0.4rem 0 0.6rem; }
.slider { display: grid; grid-template-columns: 1fr 140px 3ch; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.slider-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.slider output { font-variant-numeric: tabular-nums; text-align: right; }
.btn { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 6px; padding: 0.3rem 0.7rem; cursor: pointer; }
.btn:hover { border-color: var(--ink-2); }
.felt-change { white-space: nowrap; }
table.budget tr.no-fit td { color: var(--ink-2); }
details.section { margin: 0.6rem 0; }
details.section > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
details.section[open] > summary { color: var(--ink); margin-bottom: 0.3rem; }
table.fits td, table.fits th { white-space: nowrap; }

footer.site { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem 2rem; color: var(--muted); font-size: 0.8rem; }
