/*
 * Visual regression report — standalone stylesheet, no build step.
 * Palette and card layout follow the BackstopJS report this replaced, so a
 * run reads the same way it always did.
 */

:root {
    --color-body: #e2e7ea;
    --color-card: #fafafa;
    --color-white: #fff;
    --color-text: #4a4a4a;
    --color-text-muted: #787878;
    --color-border: #d1d9dd;
    --color-light-gray: #eee;
    --color-med-gray: #999;
    --color-green: #8bc34a;
    --color-red: #f44336;

    --shadow-01: 0 3px 6px 0 rgb(0 0 0 / 16%);
    --shadow-02: 0 4px 5px 0 rgb(0 0 0 / 14%), 0 1px 10px 0 rgb(0 0 0 / 12%), 0 2px 4px -1px rgb(0 0 0 / 30%);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', roboto, helvetica, arial, sans-serif;

    --control-height: 50px;
    --toolbar-spacing: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--color-body);
    color: var(--color-text);
    font-family: var(--font);
}

/* ---------------------------------------------------------------- header */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: 15px;
    background-color: var(--color-body);
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 15px;
    padding: 0 30px;
    border-bottom: 3px solid var(--color-border);
}

.topbar__title {
    margin: 0.5rem 0 1rem;
    font-size: 26px;
    font-weight: 400;
}

.topbar__summary {
    flex: 1 0 auto;
    margin: 0;
    padding-bottom: 2px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: var(--toolbar-spacing) 30px;
}

@media print {
    .header {
        position: static;
    }

    .toolbar {
        display: none;
    }
}

/* The single status chip. The "all" and "passed" filters the BackstopJS
   report showed are gone: this report only ever contains changed
   screenshots, so there is nothing to switch between. */
.chip {
    flex: 0 0 auto;
    padding: 0 30px;
    border-radius: 3px;
    color: var(--color-white);
    font-size: 20px;
    line-height: var(--control-height);
}

.chip--fail {
    background-color: var(--color-red);
}

/* Filter buttons, one per site variant in the run — or per value the consumer
   project passed to build-scrub-report — plus "All". Empty for a single
   variant, which the :empty rule below then collapses. */
.filters {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.filters__button {
    height: var(--control-height);
    padding: 0 22px;
    border: none;
    border-radius: 3px;
    background-color: var(--color-white);
    box-shadow: var(--shadow-01);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 16px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 100ms ease-in-out;
}

.filters__button:hover {
    box-shadow: var(--shadow-02);
}

.filters__button[aria-pressed='true'] {
    background-color: var(--color-text-muted);
    box-shadow: none;
    color: var(--color-light-gray);
}

.filters:empty {
    display: none;
}

.search {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    height: var(--control-height);
}

.search__icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    fill: var(--color-med-gray);
    pointer-events: none;
}

.search input {
    width: 100%;
    height: 100%;
    padding: 0 15px 0 42px;
    border: none;
    border-radius: 3px;
    background-color: var(--color-white);
    box-shadow: var(--shadow-01);
    color: var(--color-text);
    font-family: inherit;
    font-size: 18px;
}

.search input:focus-visible {
    outline: 2px solid var(--color-med-gray);
}

/* ------------------------------------------------------------------ list */

.list {
    padding: 0 30px 60px;
}

.empty {
    padding: 0 30px 60px;
    color: var(--color-text-muted);
}

.card {
    position: relative;
    margin: 5px auto;
    padding: 10px 30px;
    background-color: var(--color-card);
    box-shadow: var(--shadow-01);
    /* Clears the sticky header: the toolbar, plus the topbar above it. */
    scroll-margin-top: calc(var(--control-height) + (2 * var(--toolbar-spacing)) + 75px);
    break-inside: avoid;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    background-color: var(--color-red);
}

.card--pass::before {
    background-color: var(--color-green);
}

@media print {
    .card {
        box-shadow: none;
    }
}

.card__nav {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

@media print {
    .card__nav {
        display: none;
    }
}

.card__nav button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background-color: var(--color-light-gray);
    cursor: pointer;
}

.card__nav button:hover:not(:disabled) {
    background-color: var(--color-med-gray);
}

.card__nav button:disabled {
    opacity: 0.2;
    cursor: default;
}

.card__nav svg {
    width: 18px;
    height: 18px;
    fill: var(--color-text-muted);
}

.card__nav button:first-child svg {
    transform: rotate(180deg);
}

.card__row {
    padding: 5px 0;
}

.card__label {
    color: var(--color-text-muted);
    font-size: 14px;
}

.card__value {
    padding-right: 20px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
}

.card__link {
    padding-right: 20px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.card__link:hover,
.card__link:focus-visible {
    color: var(--color-red);
}

.card__error {
    margin: 10px 0 0;
    padding: 2ex;
    background: rgb(251 234 234);
    color: brown;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.card__images {
    display: flex;
}

.figure {
    flex: 1 1 0;
    padding: 20px 25px 0;
    text-align: center;
}

.figure__label {
    display: block;
    padding: 5px 0 15px;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.figure img {
    width: auto;
    max-width: 100%;
    max-height: 400px;
    cursor: pointer;
}

/* -------------------------------------------------------------- scrubber */

.scrubber {
    width: 99vw;
    max-width: none;
    height: 96vh;
    max-height: none;
    padding: 0;
    border: none;
    border-radius: 3px;
    background-color: var(--color-white);
}

.scrubber::backdrop {
    background-color: rgb(0 0 0 / 55%);
}

.scrubber__bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-bottom: 1px solid #e4e4e4;
    background-color: var(--color-white);
}

.scrubber__modes {
    display: flex;
    gap: 8px;
}

.scrubber__modes button {
    height: 32px;
    padding: 0 16px;
    border: none;
    border-radius: 3px;
    background-color: var(--color-light-gray);
    box-shadow: var(--shadow-01);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 12px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 100ms ease-in-out;
}

.scrubber__modes button:hover {
    box-shadow: var(--shadow-02);
}

.scrubber__modes button[aria-pressed='true'] {
    background-color: var(--color-text-muted);
    box-shadow: none;
    color: var(--color-light-gray);
}

.scrubber__close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background-color: var(--color-light-gray);
    cursor: pointer;
}

.scrubber__close:hover {
    background-color: var(--color-med-gray);
}

.scrubber__close svg {
    width: 18px;
    height: 18px;
    fill: var(--color-text-muted);
}

.scrubber__label {
    margin: 0;
    padding: 10px 20px 0;
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
}

.scrubber__stage {
    padding: 10px 20px 20px;
}

/*
 * The compare pane. Both images occupy the same grid cell, so the pane is as
 * tall as the taller of the two — which is what makes a height mismatch
 * visible rather than cropped. The top image is revealed from the left by
 * clip-path, driven by --position.
 */
.compare {
    position: relative;
    display: grid;
    overflow: hidden;
    cursor: ew-resize;
    touch-action: pan-y;
}

/*
 * The panes span the full width and the images sit centred inside them at
 * natural size, so the divider sweeps the whole dialog rather than only the
 * width of the screenshot. Clipping the pane rather than the image is what
 * keeps the seam under the handle: both percentages then resolve against the
 * same box.
 */
.compare__pane {
    grid-area: 1 / 1;
    align-self: start;
    width: 100%;
    text-align: center;
}

/* Natural size, shrunk only when wider than the dialog — never upscaled. */
.compare__pane img {
    width: auto;
    max-width: 100%;
    height: auto;
}

.compare__pane--top {
    clip-path: inset(0 calc(100% - var(--position)) 0 0);
}

.compare__handle {
    grid-area: 1 / 1;
    justify-self: start;
    width: 3px;
    height: 100%;
    margin-left: var(--position);
    background-color: var(--color-red);
    transform: translateX(-1.5px);
    pointer-events: none;
}

.compare--single {
    cursor: default;
}

.compare--single .compare__handle {
    display: none;
}

.compare__missing {
    padding: 40px;
    color: var(--color-text-muted);
    text-align: center;
}
