/* Results header: heading, count, sort and the saved-search bell.
   Filter controls are intentionally absent; the list starts under this bar. */
.results-sort {
    display: none;
}

@media (min-width: 64rem) {
    html.js .results-top > nav {
        display: none;
    }

    html.js .results-tools {
        display: none;
    }

    html.js .results-top {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: var(--sp-3) var(--sp-4);
        padding-block: var(--sp-2);
        border-bottom: 1px solid var(--line);
        background: var(--paper);
    }

    html.js .results-head {
        flex: 0 1 auto;
        min-width: 0;
        align-items: center;
        margin-bottom: 0;
    }

    html.js .results-title {
        margin-inline-end: 0;
    }

    html.js .results-count {
        font-size: var(--fs-xs);
        white-space: nowrap;
    }

    html.js .results-sort {
        display: flex;
        align-items: center;
        flex: none;
        gap: 0.45rem;
        margin-inline-start: auto;
    }

    html.js .results-sort-label {
        color: var(--muted);
        font-size: 0.625rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    html.js .results-sort-control {
        position: relative;
        display: flex;
        align-items: center;
    }

    html.js .results-sort-control select {
        min-height: 2.15rem;
        padding: 0 2rem 0 0.8rem;
        border: 1px solid var(--line-strong);
        border-radius: 999px;
        background: var(--surface);
        color: var(--ink);
        font: 600 0.75rem/1 var(--font);
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        box-shadow: none;
    }

    html.js .results-sort-control select:hover {
        border-color: var(--accent);
    }

    html.js .results-sort-control select:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 13%, transparent);
    }

    html.js .results-sort-control .gi {
        position: absolute;
        right: 0.65rem;
        width: 0.8rem;
        height: 0.8rem;
        color: var(--muted);
        pointer-events: none;
    }
}

/* Distance sorting is only meaningful with a visible origin. This line keeps
   that origin and radius next to the sort control. */
.results-distance-context {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.66rem;
    line-height: 1.4;
}

.results-distance-context .gi {
    width: 0.85rem;
    height: 0.85rem;
    flex: none;
    color: var(--accent);
}

/* The line under the results heading belongs to the content column, not to
   the wrap's outer padding. It is also the only top border: the list and the
   reader must not add a second or third line under it. */
@media (min-width: 64rem) {
    html.js .results-top {
        border-bottom: 0;
    }

    html.js .results-top::after {
        content: "";
        position: absolute;
        inset-inline: var(--gutter);
        bottom: 0;
        height: 1px;
        background: var(--line);
        pointer-events: none;
    }

    html.js .results-top + .ledger .rows,
    html.js .results-top + .ledger .reader {
        border-top: 0;
    }

    html.js .results-top + .ledger .rows .row[data-active] {
        box-shadow: none;
    }
}

/* Pinned results heading gets the same active line/shadow as the home sections. */
html.js .results-top {
    transition: box-shadow 0.18s ease;
}

html.js .results-top.is-stuck {
    box-shadow: 0 12px 18px -16px rgb(8 10 16 / 0.5);
}

/* Editorial guide below the root category results. */
.cat-guide {
    margin-top: clamp(2rem, 5vw, 3.25rem);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.cat-guide h2 {
    margin: 0 0 var(--sp-3);
    color: var(--ink);
    font-size: var(--fs-l);
    letter-spacing: -0.02em;
}

.cat-guide p {
    max-width: 78ch;
    margin: 0 0 var(--sp-3);
    line-height: 1.7;
}

.cat-guide-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin: var(--sp-4) 0 0;
    padding: 0;
    list-style: none;
}

.cat-guide-links a {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.72rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill, 999px);
    color: var(--ink);
    font-size: var(--fs-s);
    text-decoration: none;
}

.cat-guide-links a:hover,
.cat-guide-links a:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}
