/*
 * The UTXO page (utxo.js): /utxo/<txid>:<vout> shows one pane, a header, a
 * banner for a spent UTXO, and cards (the sat page's .sat-card, sat.css):
 * the rare sats in it with their strip, where they are now, the untracked
 * ones, inscriptions and runes, sales; the marketplace and the details in a
 * side column on a wide screen. Built on app.css's tokens, light, dark and
 * auto.
 */

/* The UTXO pane alone, whatever the width (as the sat pane). */
.panes.is-utxo {
    display: flex;
}

.panes.is-utxo > .pane:not(.pane--utxo),
.panes:not(.is-utxo) > .pane--utxo {
    display: none;
}

.pane--utxo {
    overflow-y: auto;
    overscroll-behavior: contain;
    /* The strip's colours, by family (utxo.js FAMILIES). */
    --utxo-top: #8b4fd8;
    --utxo-name: #c2410c;
    --utxo-history: #b7791f;
    --utxo-uncommon: #0ca30c;
    --utxo-black: #52514e;
    --utxo-alpha: #2a78d6;
    --utxo-omega: #0f8f8f;
    --utxo-palindrome: #eb6834;
    --utxo-vintage: #8a6d3b;
    --utxo-other: #898781;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pane--utxo {
        --utxo-top: #a77bf0;
        --utxo-name: #f08a4b;
        --utxo-history: #e0a83a;
        --utxo-uncommon: #3cc13c;
        --utxo-black: #c3c2b7;
        --utxo-alpha: #3987e5;
        --utxo-omega: #2bb3b3;
        --utxo-palindrome: #f07c4a;
        --utxo-vintage: #c49a5a;
    }
}

:root[data-theme="dark"] .pane--utxo {
    --utxo-top: #a77bf0;
    --utxo-name: #f08a4b;
    --utxo-history: #e0a83a;
    --utxo-uncommon: #3cc13c;
    --utxo-black: #c3c2b7;
    --utxo-alpha: #3987e5;
    --utxo-omega: #2bb3b3;
    --utxo-palindrome: #f07c4a;
    --utxo-vintage: #c49a5a;
}

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

.utxo-head {
    display: grid;
    gap: 6px;
    align-items: start;
    padding: 12px 20px 14px;
    border-bottom: 1px solid var(--grid);
}

.utxo-title-line {
    flex-wrap: nowrap;
}

.pane--utxo .utxo-outpoint {
    min-width: 0;
    font-size: 17px;
    font-weight: 650;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.utxo-vout {
    color: var(--ink-2);
}

.utxo-lede {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    color: var(--ink-2);
    font-size: 13px;
}

.utxo-lede .sep {
    color: var(--muted);
}

.utxo-value strong {
    color: var(--ink);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.utxo-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* A spent UTXO: said first, under the header. */
.utxo-banner {
    margin: 14px 20px 0;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--serious) 55%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--serious) 12%, var(--surface));
    font-size: 13.5px;
    overflow-wrap: anywhere;
}

.utxo-banner[hidden] {
    display: none;
}

/* ------------------------------------------------------------- body */

.utxo-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    align-items: start;
    gap: 16px;
    padding: 16px 20px 24px;
}

.utxo-main,
.utxo-side {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.utxo-side {
    position: sticky;
    top: 0;
}

.utxo-subhead {
    margin: 14px 0 8px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 650;
}

.utxo-note {
    margin-top: 8px;
}

/* ------------------------------------------------------------- the strip */

.utxo-strip-wrap {
    display: grid;
    gap: 4px;
    margin: 2px 0 6px;
}

.utxo-strip {
    padding: 2px;
    border-radius: 6px;
    cursor: crosshair;
}

.utxo-strip:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.utxo-strip-svg {
    display: block;
    width: 100%;
    height: 24px;
}

.utxo-strip-svg--two {
    height: 44px;
}

.utxo-strip-lane {
    fill: var(--sunken);
    stroke: var(--grid);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.utxo-strip-lane--other {
    fill: color-mix(in srgb, var(--ink) 2%, var(--page));
}

.utxo-mark {
    fill: var(--utxo-other);
    stroke: var(--surface);
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
}

.utxo-mark--run {
    fill-opacity: 0.55;
}

.utxo-mark.is-selected {
    stroke: var(--ink);
    stroke-width: 2;
    fill-opacity: 1;
}

.utxo-mark--top { fill: var(--utxo-top); background: var(--utxo-top); }
.utxo-mark--name { fill: var(--utxo-name); background: var(--utxo-name); }
.utxo-mark--history { fill: var(--utxo-history); background: var(--utxo-history); }
.utxo-mark--uncommon { fill: var(--utxo-uncommon); background: var(--utxo-uncommon); }
.utxo-mark--black { fill: var(--utxo-black); background: var(--utxo-black); }
.utxo-mark--alpha { fill: var(--utxo-alpha); background: var(--utxo-alpha); }
.utxo-mark--omega { fill: var(--utxo-omega); background: var(--utxo-omega); }
.utxo-mark--palindrome { fill: var(--utxo-palindrome); background: var(--utxo-palindrome); }
.utxo-mark--vintage { fill: var(--utxo-vintage); background: var(--utxo-vintage); }
.utxo-mark--other { fill: var(--utxo-other); background: var(--utxo-other); }

.utxo-axis {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.utxo-readout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 6px;
    background: var(--sunken);
    font-size: 12.5px;
}

.utxo-readout-head {
    font-weight: 600;
}

.utxo-readout-item {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
}

.utxo-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    color: var(--ink-2);
    font-size: 11.5px;
}

.utxo-legend li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.utxo-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.utxo-legend-lanes {
    color: var(--muted);
}

/* ------------------------------------------------------------- tables */

.utxo-table td,
.utxo-table th {
    vertical-align: top;
}

.utxo-table .sat-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 2px 4px;
}

.utxo-table td.left .sat-cell {
    justify-content: flex-start;
}

.utxo-inscribed {
    color: var(--series-2);
}

.utxo-samples {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.utxo-details {
    margin-top: 10px;
    font-size: 13px;
}

.utxo-details summary {
    color: var(--ink-2);
    cursor: pointer;
}

.utxo-details .table-x {
    margin-top: 8px;
}

a.utxo-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-underline-offset: 2px;
}

a.utxo-link:hover {
    color: var(--series-1);
    text-decoration-color: currentColor;
}

/* ------------------------------------------------------------- lists */

.utxo-now,
.utxo-inscriptions,
.utxo-runes {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.utxo-now li {
    display: grid;
    gap: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--grid);
}

.utxo-now li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.utxo-now-sat {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.utxo-now-where {
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

.utxo-rune-name {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.utxo-script,
.utxo-sources {
    overflow-wrap: anywhere;
}

/* ----------------------------------------------------- narrow screens */

@media (max-width: 1099.98px) {
    .utxo-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .utxo-side {
        position: static;
    }
}

@media (max-width: 719.98px) {
    .utxo-head {
        padding: 10px 12px 12px;
    }

    /* app.css hides a pane's h2 on a phone; this one is the page's subject. */
    .pane--utxo .utxo-head h2 {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        white-space: normal;
        font-size: 14px;
    }

    .utxo-banner {
        margin: 10px 10px 0;
    }

    .utxo-body {
        gap: 12px;
        padding: 12px 10px 18px;
    }

    .utxo-main,
    .utxo-side {
        gap: 12px;
    }

    /* The tables as stacks of cards: each cell labelled. */
    .utxo-table-x {
        overflow: visible;
    }

    .utxo-table,
    .utxo-table tbody,
    .utxo-table tr,
    .utxo-table td {
        display: block;
        width: 100%;
    }

    .utxo-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .utxo-table tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--grid);
    }

    .utxo-table td {
        display: grid;
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 8px;
        padding: 2px 0;
        border: 0;
        text-align: left;
        white-space: normal;
    }

    .utxo-table .sat-cell {
        justify-content: flex-start;
    }

    .utxo-table td::before {
        content: attr(data-label);
        color: var(--ink-2);
        font-size: 11.5px;
    }

    .utxo-details .utxo-table td::before {
        content: none;
    }

    .utxo-details .utxo-table td {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* A sale's own row and the rest it sold, under "Sold out of this UTXO". */
.utxo-sold-as {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    color: var(--ink-2);
    font-size: 12px;
}

.utxo-sold-as .sale-with {
    margin-left: 0;
}
