/*
 * PoE2 Oracle next to other price checkers (bench.js): one table of the app, its memory after launch
 * and its CPU load while playing, both as bar charts, and its processes, in the site's colours
 * (style.css). On a phone each row becomes a card: the app, then each column under its label.
 */

.bench {
    margin: 1.5rem 0 0;
    padding: 1.25rem 1.5rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
}

.bench figcaption {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.bench-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
}

/* Said by a screen reader; the claims above the table say it on screen. */
.bench-table caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.bench-table th,
.bench-table td {
    padding: 0.8rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.bench-table thead th {
    padding-top: 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-gold);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    vertical-align: bottom;
}

.bench-table thead th:nth-child(1) {
    width: 22%;
}

.bench-table thead th:nth-child(4) {
    width: 15%;
}

.bench-row + .bench-row {
    border-top: 1px solid var(--border);
}

.bench-ours {
    background: rgba(208, 145, 59, 0.07);
}

.bench-app {
    font-weight: 400;
    line-height: 1.5;
}

.bench-name {
    color: var(--text);
    font-weight: 600;
}

.bench-ours .bench-name {
    color: var(--gold);
}

.bench-version {
    color: var(--text-dim);
    font-weight: 400;
}

/* --room is what the value beside the bar needs; CPU's value is a ratio in words. */
.bench-track {
    --room: 5.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.5em;
}

.bench-cpu .bench-track {
    --room: 9.5rem;
}

/* The bar's length is the app's share of the column's most, of the room its value leaves. */
.bench-bar {
    flex: none;
    width: calc((100% - var(--room)) * var(--share));
    min-width: 3px;
    height: 1rem;
    border-radius: 2px;
    background: #4b4b53;
}

.bench-ours .bench-bar {
    background: linear-gradient(var(--gold-bright), var(--gold));
}

.bench-value {
    color: var(--text);
    white-space: nowrap;
}

.bench-ours .bench-value {
    color: var(--gold-bright);
    font-weight: 600;
}

.bench-ratio,
.bench-state {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.85rem;
    line-height: 1.35;
}

.bench-ratio {
    color: var(--text-muted);
    white-space: nowrap;
}

/* The app's state, where its numbers depend on it. */
.bench-state {
    color: var(--text-dim);
}

.bench-processes {
    line-height: 1.5;
    white-space: nowrap;
}

.bench-pips {
    display: inline-flex;
    gap: 3px;
    margin-right: 0.45rem;
    vertical-align: 0.05em;
}

.bench-pips i {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 1px;
    background: #5f5f68;
}

.bench-ours .bench-pips i {
    background: var(--gold);
}

@media (max-width: 60rem) {
    .bench {
        padding: 0.25rem 0.5rem 0.9rem;
    }

    .bench figcaption {
        margin-top: 0.25rem;
        padding: 0.9rem 0.5rem 0;
    }

    .bench-table,
    .bench-table tbody {
        display: block;
    }

    /* The labels move into each card (data-label); the header stays for screen readers. */
    .bench-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    /* The app and its processes share the card's first line; the bars take a line each. */
    .bench-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.6rem 1rem;
        padding: 0.9rem 0.5rem;
    }

    .bench-table th,
    .bench-table td {
        display: block;
        padding: 0;
    }

    .bench-bars {
        grid-column: 1 / -1;
    }

    .bench-processes {
        grid-row: 1;
        grid-column: 2;
        text-align: right;
    }

    .bench-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.1rem;
        color: var(--text-muted);
        font-size: 0.8rem;
    }
}
