/* JQ1. Builds: the Monitor's console (monitor.css) with a card per build in progress, the queue as
   an ordered list and a gallery of what just finished. Motion is decoration only and stops for anyone
   who asks for less of it. */

.bq-now {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.bq-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    background:
        radial-gradient(420px 120px at 0% 0%, rgba(143, 201, 240, 0.1), transparent 70%),
        var(--panel-2);
    display: grid;
    gap: 10px;
    box-shadow: 0 0 0 1px rgba(143, 201, 240, 0.08), 0 12px 32px -18px rgba(143, 201, 240, 0.45);
}

.bq-card-head,
.bq-stage,
.bq-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bq-title {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bq-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.bq-tag {
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--panel-3);
    color: var(--muted);
}

.bq-private {
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
}

.bq-stage-name {
    font-family: var(--display);
    font-size: 1.15rem;
    color: var(--mn-run);
}

.bq-clock {
    font-variant-numeric: tabular-nums;
    font-size: 1.15rem;
    color: var(--text);
}

.bq-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
}

.bq-steps li {
    font-size: 0;
    height: 6px;
    border-radius: 3px;
    background: var(--panel-3);
}

.bq-steps li.done {
    background: var(--mn-ok);
}

.bq-steps li.active {
    background: var(--mn-run);
    animation: bq-pulse 1.2s ease-in-out infinite;
}

@keyframes bq-pulse {
    50% {
        opacity: 0.45;
    }
}

.bq-foot {
    font-size: 0.76rem;
    color: var(--muted);
}

.bq-joined {
    color: var(--mn-ok);
    font-weight: 600;
}

.bq-stop {
    flex: none;
    min-height: 32px;
    padding: 4px 14px;
    border-radius: 999px;
    border: 1px solid var(--mn-bad);
    background: transparent;
    color: var(--mn-bad);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.bq-stop:hover:not(:disabled) {
    background: var(--mn-bad);
    color: #fff;
}

.bq-stop:disabled {
    opacity: 0.55;
    cursor: progress;
}

.bq-queue {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.bq-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}

.bq-row.is-following {
    margin-left: 28px;
    border-style: dashed;
    background: transparent;
}

.bq-pos {
    font-family: var(--display);
    font-size: 1.2rem;
    color: var(--accent);
    text-align: center;
}

.bq-row-main {
    min-width: 0;
}

.bq-row-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.bq-row-sub .bq-badges {
    margin: 0;
}

.bq-note {
    font-size: 0.76rem;
    color: var(--muted);
}

.bq-done {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}

.bq-tile {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px 8px 10px;
    background: var(--panel-2);
    display: grid;
    gap: 4px;
    min-width: 0;
}

.bq-tile.is-failed {
    border-color: color-mix(in srgb, var(--mn-bad) 45%, var(--line));
}

.bq-pic {
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
    display: grid;
    place-items: center;
    overflow: hidden;
}

.bq-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bq-pic-ph {
    font-size: 2rem;
    opacity: 0.35;
}

.bq-kind {
    position: absolute;
    top: 14px;
    left: 14px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

.bq-kind-built {
    color: var(--mn-ok);
}
.bq-kind-instant,
.bq-kind-joined {
    color: var(--mn-run);
}
.bq-kind-failed {
    color: var(--mn-bad);
}

.bq-tile .bq-foot {
    flex-wrap: wrap;
    gap: 2px 8px;
}

@media (max-width: 560px) {
    .bq-now {
        grid-template-columns: 1fr;
    }
    .bq-row {
        grid-template-columns: 32px 1fr;
    }
    .bq-row .bq-stop {
        grid-column: 2;
        justify-self: start;
    }
    .bq-row.is-following {
        margin-left: 12px;
    }
    .bq-done {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .bq-steps li.active {
        animation: none;
    }
}

/* DM1. Demand: ranked lists with a bar each, and the backlog with its state. */
.bq-demand {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.bq-rank h3 {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px;
}

.bq-rank ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.bq-rank li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px 34px;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

.bq-backlog li {
    grid-template-columns: auto minmax(0, 1fr) 40px;
}

.bq-rank-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bq-rank-bar {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent) var(--w), var(--panel-3) var(--w));
}

.bq-rank-n {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.bq-demand-tag {
    color: var(--mn-run);
    border: 1px solid var(--mn-run);
    background: transparent;
}

.bq-state-queued {
    color: var(--muted);
}
.bq-state-building {
    color: var(--mn-run);
}
.bq-state-built {
    color: var(--mn-ok);
}
.bq-state-failed,
.bq-state-skipped {
    color: var(--mn-bad);
}
