/*
 * The chart of docs/benchmark.md (sweep-chart.js). The series colours are the reference palette of the
 * dataviz skill: slots 1-8 in light and dark steps, validated on the theme surfaces (#fff and #14181e).
 * Text and chrome use the theme variables, so html[data-theme] switches the whole chart.
 */

.sweep-chart {
    --sweep-1: #2a78d6;
    --sweep-2: #eb6834;
    --sweep-3: #1baf7a;
    --sweep-4: #eda100;
    --sweep-5: #e87ba4;
    --sweep-6: #008300;
    --sweep-7: #6250d6;
    --sweep-8: #e34948;
    --sweep-other: #898781;
    --sweep-grid: #e1e0d9;
    --sweep-axis: #c3c2b7;
    margin: 1rem 0 1.5rem;
}

html[data-theme="dark"] .sweep-chart {
    --sweep-1: #3987e5;
    --sweep-2: #d95926;
    --sweep-3: #199e70;
    --sweep-4: #c98500;
    --sweep-5: #d55181;
    --sweep-6: #0ca30c;
    --sweep-7: #9085e9;
    --sweep-8: #e66767;
    --sweep-grid: #2c2c2a;
    --sweep-axis: #383835;
}

/* Controls: one row above the chart; it wraps on narrow screens. */
.sweep-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
}

.sweep-controls button,
.sweep-select {
    min-height: 2.25rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--pst-color-border);
    border-radius: 0.375rem;
    background: var(--pst-color-background);
    color: var(--pst-color-text-base);
    font: inherit;
    font-size: 0.875rem;
}

.sweep-segmented button:not(:first-child) {
    margin-left: -1px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.sweep-segmented button:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.sweep-controls button[aria-pressed="true"] {
    position: relative; /* the border of the pressed button stays on top */
    border-color: var(--pst-color-primary);
    background: color-mix(in srgb, var(--pst-color-primary) 14%, var(--pst-color-background));
    font-weight: 600;
}

.sweep-controls button:disabled {
    color: var(--pst-color-text-muted);
    opacity: 0.6;
}

.sweep-controls button:focus-visible,
.sweep-select:focus-visible,
.sweep-svg:focus-visible {
    outline: 2px solid var(--pst-color-accent);
    outline-offset: 2px;
}

/* Legend and tooltip keys: a short line in the series colour with the marker of the package. */
.sweep-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0.75rem 0 0.25rem;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
}

.sweep-legend li,
.sweep-tip-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.sweep-key {
    flex: none;
    overflow: visible;
}

/* Plot: hairline grid and axis, 2 px lines, 8 px markers (one shape per package) with a 2 px ring in the
   surface colour. The ring is painted under the fill, so the shape keeps its full size. */
.sweep-figure {
    position: relative;
}

.sweep-svg {
    display: block;
    width: 100%;
    height: auto;
}

.sweep-grid {
    stroke: var(--sweep-grid);
}

.sweep-axis {
    stroke: var(--sweep-axis);
}

.sweep-tick,
.sweep-title {
    fill: var(--pst-color-text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.sweep-line {
    fill: none;
    stroke: var(--c);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.sweep-bar {
    stroke: var(--c);
    stroke-width: 1.5;
}

.sweep-dot {
    fill: var(--c);
    stroke: var(--pst-color-background);
    stroke-width: 4;
    stroke-linejoin: round;
    paint-order: stroke;
}

/* Hollow marker (the same shape as an outline): the value comes from one pass. */
.sweep-dot.sweep-one {
    fill: var(--pst-color-background);
    stroke: var(--c);
    stroke-width: 2;
    paint-order: normal;
}

.sweep-label {
    fill: var(--pst-color-text-base);
    font-size: 12px;
    paint-order: stroke;
    stroke: var(--pst-color-background);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.sweep-cross {
    stroke: var(--pst-color-text-muted);
}

.sweep-hit {
    fill: transparent;
    touch-action: pan-y;
}

.sweep-tip {
    position: absolute;
    z-index: 1;
    max-width: 18rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--pst-color-border);
    border-radius: 0.375rem;
    background: var(--pst-color-background);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    font-size: 0.8125rem;
    pointer-events: none;
}

.sweep-tip-head,
.sweep-tip-row span:last-child {
    color: var(--pst-color-text-muted);
}

/* Table view: it scrolls on its own on narrow screens. */
.sweep-table-wrap {
    overflow-x: auto;
}

.sweep-table {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.sweep-table caption {
    caption-side: top;
    text-align: left;
    color: var(--pst-color-text-muted);
}

.sweep-table th,
.sweep-table td {
    padding: 0.25rem 0.6rem;
    text-align: right;
    white-space: nowrap;
}

.sweep-table thead th {
    border-bottom: 1px solid var(--pst-color-border);
}

/* Notes and the setup line under the chart */
.sweep-notes,
.sweep-meta,
.sweep-empty {
    font-size: 0.8125rem;
    color: var(--pst-color-text-muted);
    overflow-wrap: anywhere;
}

.sweep-notes {
    margin: 0.75rem 0 0.25rem;
    padding-left: 1.25rem;
}
