/* Read against returned. Reference: frontend/DESIGN.md, "Read against returned".
   Loaded on every page after load.css; only tokens from app.css are used.
   Marks are positions on a log axis, never bar lengths: a log bar has no honest zero. */

/* --- Shared marks ------------------------------------------------------------------------------ */
.rr-grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
/* Where the list cue and the Queries filter start (1,000x, 50 kB a row). */
.rr-limit { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; shape-rendering: crispEdges; }
.rr-key { display: inline-block; width: 14px; height: 12px; overflow: visible; flex: none; vertical-align: -2px; }
.rr-key.is-scale { width: 18px; }

/* --- The cue of a list row: neutral, with a mark for its kind ------------------------------------ */
.rr-cue { gap: var(--sp-2); color: var(--ink-2); }
.rr-cue > b { color: var(--ink); }
.rr-cue-mark { flex: none; width: 9px; height: 9px; }
/* Many rows in, few out: a wide bar narrowing to a short one. */
.rr-cue-mark.is-rows { background: linear-gradient(var(--ink-2), var(--ink-2)) left top / 9px 3px no-repeat, linear-gradient(var(--ink-2), var(--ink-2)) left bottom / 3px 3px no-repeat; }
/* A wide row: one tall block. */
.rr-cue-mark.is-bytes { background: var(--ink-2); border-radius: 1px; width: 5px; }

/* Queries: the two ratio sorts sit in the column head only where it has room; the Filters popover always has them. */
@media (max-width: 1239.98px) { .tbl th > a.sort.hide-lt-xl { display: none; } }

/* A row of chips in a list cell: a chip that does not fit drops out whole instead of showing a sliver. */
.tbl.is-list td > .l2.chips-fit { flex-wrap: wrap; align-content: flex-start; row-gap: 8px; overflow: hidden; }

/* One row's ratios as a line of facts. A ratio at or beyond its threshold is underlined; an aggregate's steps back. */
.rr-facts { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-2); }
.rr-facts > .chip { align-self: center; margin-left: var(--sp-3); }
.rr-fact { margin-left: var(--sp-2); }
.rr-fact > b { font: 600 var(--fs-3)/1.2 var(--font-mono); color: var(--ink); }
.rr-fact.is-over { box-shadow: inset 0 -2px 0 var(--ink-3); }
.rr-fact.is-muted > b { font-weight: 400; color: var(--ink-3); }
.waste-legend-num > b { margin-right: var(--sp-2); }

/* --- The panel on a finding page ----------------------------------------------------------------- */
.rr-axis { padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.rr-axis + .rr-axis { border-top: 1px solid var(--line); }
.rr-row { display: grid; grid-template-columns: 6.5rem minmax(7rem, 1fr) 4.25rem minmax(0, 15rem); column-gap: var(--sp-5); align-items: center; min-height: 24px; }
/* The head of an axis: its title and the aggregate note on one line, the tick labels over the track. */
.rr-row.is-head { min-height: 0; row-gap: var(--sp-2); align-items: center; }
.rr-title { grid-column: 1 / 3; font-weight: 600; font-size: var(--fs-2); white-space: nowrap; }
.rr-note { grid-column: 3 / 5; display: flex; justify-content: flex-end; min-width: 0; }
.rr-row.is-head > .rr-ticks { grid-column: 2; grid-row: 2; }
.rr-note > .chip { max-width: 100%; }
.rr-ticks { display: block; width: 100%; height: 14px; overflow: visible; }
.rr-ticks text, .waste-xticks text, .waste-yticks text { font: 400 11px/1 var(--font-mono); fill: var(--ink-3); text-anchor: middle; }
.rr-ticks text.is-start, .waste-xticks text.is-start { text-anchor: start; }
.rr-ticks text.is-end, .waste-xticks text.is-end { text-anchor: end; }
.rr-name { color: var(--ink-2); font-size: var(--fs-2); white-space: nowrap; }
.rr-track { display: block; width: 100%; height: 24px; overflow: visible; }
.rr-dot { stroke-width: 1.5; }
/* Production is the measured load's ink (the accent, as the load bars). The sandbox baseline is a ring;
   the sandbox result is filled, green only for a verified win. Each lane is also named in words. */
.rr-dot.is-production { fill: var(--accent); stroke: var(--surface); }
.rr-dot.is-before { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }
.rr-dot.is-after { fill: var(--ink-2); stroke: var(--surface); }
.rr-dot.is-after.is-verified { fill: var(--win); }
.rr-move { stroke: var(--ink-3); stroke-width: 1.5; }
.rr-from { fill: var(--ink-3); }
.rr-value { text-align: right; font: 600 var(--fs-3)/1.2 var(--font-mono); white-space: nowrap; }
.rr-value.is-over { box-shadow: inset 0 -2px 0 var(--ink-3); justify-self: end; }
.rr-abs { color: var(--ink-2); font: 400 var(--fs-2)/1.2 var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* An aggregate reads many rows to return few on purpose: the first ratio steps back. */
.rr-axis.is-muted .rr-dot.is-production { fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 2 2; }
.rr-axis.is-muted .rr-dot.is-before { stroke: var(--ink-3); stroke-dasharray: 2 2; stroke-width: 1.5; }
.rr-axis.is-muted .rr-dot.is-after, .rr-axis.is-muted .rr-dot.is-after.is-verified { fill: var(--surface); stroke: var(--ink-3); stroke-dasharray: 2 2; }
.rr-axis.is-muted .rr-value { color: var(--ink-3); font-weight: 400; }
.rr-axis.is-muted .rr-title { color: var(--ink-2); }
@media (max-width: 767.98px) {
  .rr-row, .rr-row.is-head { grid-template-columns: minmax(0, 1fr) max-content; row-gap: 2px; }
  .rr-row > .rr-track { grid-column: 1 / -1; grid-row: 2; }
  .rr-row > .rr-abs { grid-column: 1 / -1; grid-row: 3; white-space: normal; }
  .rr-title, .rr-note { grid-column: 1 / -1; justify-content: flex-start; }
  .rr-row.is-head > .rr-ticks { grid-column: 1 / -1; grid-row: 3; }
  .rr-row + .rr-row { margin-top: var(--sp-3); }
}

/* --- Overview: the measured load by kind of waste ------------------------------------------------ */
.waste-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(19rem, 1fr); }
.waste-plot { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); grid-template-rows: auto minmax(13.5rem, 1fr) 16px auto; column-gap: var(--sp-3); padding: var(--sp-4) var(--sp-6) var(--sp-4) var(--sp-5); min-width: 0; }
.waste-ytitle { grid-column: 1 / -1; margin-bottom: var(--sp-3); color: var(--ink-3); font-size: var(--fs-1); font-weight: 500; }
.waste-yticks { grid-column: 1; grid-row: 2; width: 100%; height: 100%; overflow: visible; }
.waste-yticks text { text-anchor: end; }
.waste-svg { grid-column: 2; grid-row: 2; display: block; width: 100%; height: 100%; overflow: visible; border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.waste-xticks { grid-column: 2; grid-row: 3; width: 100%; height: 16px; overflow: visible; }
.waste-xtitle { grid-column: 2; grid-row: 4; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-5); margin-top: var(--sp-2); color: var(--ink-3); font-size: var(--fs-1); font-weight: 500; }
.waste-keys { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-5); margin-left: auto; font-weight: 400; }
.waste-keys > span { display: inline-flex; align-items: center; gap: var(--sp-2); }
/* The two regions the thresholds cut off, tinted so the eye finds them before it reads the labels. */
.waste-zone { fill: var(--ink-3); opacity: .06; }
.waste-zone-label { font: 400 11px/1 var(--font-sans); fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.waste-zone-label.is-end { text-anchor: end; }
/* Measured load is one ink (the accent, as the load bars); an aggregate is a dashed ring, because
   its place on the first axis is not waste. */
.waste-dot { fill: var(--accent); fill-opacity: .3; stroke: var(--accent); stroke-width: 1.5; }
.waste-dot.is-agg { fill: none; stroke: var(--ink-3); stroke-dasharray: 3 2; }
.waste-svg a:hover .waste-dot, .waste-svg a:focus-visible .waste-dot { fill-opacity: .6; stroke: var(--ink); stroke-dasharray: none; }
.waste-svg a:focus-visible { outline: none; }
.waste-n { font: 600 11px/1 var(--font-mono); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.waste-n.is-left { text-anchor: end; }
.waste-side { display: grid; align-content: start; gap: var(--sp-3); padding: var(--sp-4) 0 0; border-left: 1px solid var(--line); min-width: 0; }
.waste-side > .split, .waste-side > .waste-legend { margin: 0 var(--sp-5); }
.waste-legend > li > a, .waste-legend-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-4); padding: var(--sp-2) 0; color: var(--ink); font-size: var(--fs-2); }
.waste-legend-num { color: var(--ink-2); white-space: nowrap; }
.waste-part.is-bytes { background: var(--accent); }
.waste-part.is-rows { background: var(--accent); background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--surface) 3px 5px); }
.waste-part.is-both { background: var(--ink); }
.waste-part.is-aggregate { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-3); background-image: repeating-linear-gradient(90deg, var(--ink-3) 0 1px, transparent 1px 4px); }
.waste-part.is-neither { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.waste-top { border-top: 1px solid var(--line); }
.waste-top > a { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.waste-rank { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 11px; font-weight: 600; flex: none; }
.waste-top .rows-end > b { color: var(--ink); font-weight: 600; }
.waste-top .rows-sub { padding-left: calc(16px + var(--sp-4)); font-size: var(--fs-1); }
.waste-hit { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink-3); }
@media (max-width: 899.98px) {
  .waste-body { grid-template-columns: minmax(0, 1fr); }
  .waste-side { border-left: 0; border-top: 1px solid var(--line); }
}

/* --- Overview: verified fixes ordered by measured load. Two labelled lines, production first. ------ */
.rows.is-two .fix-load { display: grid; grid-template-columns: 4.75rem minmax(0, 1fr); align-items: center; gap: var(--sp-3); }
.fix-src { color: var(--ink-3); font-size: var(--fs-1); }
.rows > a > .fix-load > .gain { margin-left: 0; }
