/* ============================================================
   Search page (/search/) — page layout only. The field
   (.search-field--lg), the scope pills (.seg-pill), the group heads
   (.section-head), the result rows (.surface-inset), the type badge
   (.status-pill.is-brand) and the no-results box (.empty-state) are
   shared components in includes/styles.css.
   ============================================================ */

/* Scope pills sit under the field. */
.search-scopes {
    margin-top: var(--space-4);
}

/* Per-scope hit count inside a pill, shown once results load, in the
   pill's own accent (4.7:1 or better on the pressed tint). It holds
   the number and a visually-hidden " results"; positioning it keeps
   that hidden word inside the pill row's scroll clip on phones. */
.search-scope-count {
    position: relative;
    color: var(--pill-color);
    font-weight: 700;
}

/* The two status slots: the visual-only hint ("Searching…", "Keep
   typing") and the role=status region (the count, the empty state or
   the error). One shows at a time; each collapses when empty. */
.search-status:not(:empty) {
    margin-top: var(--space-5);
}

.search-status-text {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.search-status-text.is-error {
    display: flex;
    align-items: center;
    gap: var(--gap-icon);
    color: var(--danger-text);
    font-weight: 600;
}

.search-results:not(:empty) {
    margin-top: var(--space-4);
}

.search-group + .search-group {
    margin-top: var(--space-8);
}

.search-results-list {
    display: grid;
    /* minmax(0, ...) so one long unbroken word can't size the column
       wider than the panel. */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* One result row: the title, a meta line (type badge and
   breadcrumb), then the snippet. */
.search-result-title {
    display: block;
    font-size: var(--fs-body);
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-top: 0.35rem;
}

.search-result-bc {
    min-width: 0;
    font-size: var(--fs-meta);
    line-height: 1.4;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

/* The muted grey dips under 4.5:1 on the dark hover tint. */
.search-result:hover .search-result-bc {
    color: var(--text-secondary);
}

.search-result-snippet {
    display: block;
    margin-top: 0.35rem;
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

/* Query matches. Bootstrap's <mark> is a fixed pale yellow that light
   text can't sit on; this is the brand tint in both themes. */
.search-result mark {
    padding: 0;
    border-radius: 2px;
    background: var(--primary-tint);
    color: inherit;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
    .search-result mark {
        background: color-mix(in srgb, var(--primary-text) 24%, transparent);
    }
}
