/* ==========================================================================
   /study — search results page (pages/search.js)
   A single reading column: one big field, then grouped rows. Everything here
   is namespaced .st-search-* and built from study.css tokens only.
   ========================================================================== */

/* Results read better in a column than across the full 1280 frame. */
.st-search-page {
    max-width: 880px;
    gap: 20px;
}

/* --------------------------------------------------------------------------
   The field
   -------------------------------------------------------------------------- */

.st-search-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.st-search-field {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.st-search-field__icon {
    position: absolute;
    left: 16px;
    display: inline-flex;
    color: var(--st-ink-3);
    pointer-events: none;
}

.st-search-input {
    width: 100%;
    min-height: 58px;
    padding: 14px 52px 14px 48px;
    font-size: 17px;
    border-radius: var(--st-radius-card-sm);
}

.st-search-input::-webkit-search-cancel-button,
.st-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.st-search-clear {
    position: absolute;
    right: 8px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--st-ink-3);
}

.st-search-clear:hover {
    background: var(--st-fill);
    color: var(--st-ink);
}

.st-search-clear[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Count + keyboard hints
   -------------------------------------------------------------------------- */

.st-search-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    /* Reserve the row so results do not jump when the count appears. */
    min-height: 20px;
}

.st-search-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--st-ink-2);
}

.st-search-hints {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--st-ink-4);
    white-space: nowrap;
}

.st-search-hints .st-kbd {
    min-width: 20px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.st-search-results {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.st-search-group .st-section__head { align-items: baseline; }

.st-search-list { overflow: hidden; }

.st-search-row {
    align-items: flex-start;
    cursor: pointer;
    scroll-margin: 24px;
}

.st-search-row:hover,
.st-search-row.is-active {
    background: var(--st-fill);
    color: var(--st-ink);
}

.st-search-row.is-active .st-search-row__go,
.st-search-row:hover .st-search-row__go { color: var(--st-ink); }

.st-search-row .st-space-icon--sm,
.st-search-row .st-tile { margin-top: 1px; }

.st-search-row .st-row__text { gap: 3px; }

.st-search-row__go {
    flex: 0 0 auto;
    align-self: center;
    color: var(--st-ink-4);
}

.st-search-row .st-chip,
.st-search-row .st-row__time {
    flex: 0 0 auto;
    align-self: center;
}

.st-search-snippet {
    font-size: 13px;
    line-height: 1.45;
    color: var(--st-ink-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The matched run, in every group. */
.st-search-row mark {
    background: var(--st-warm-soft);
    color: var(--st-warm-ink);
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Empty query
   -------------------------------------------------------------------------- */

.st-search-start {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 32px 0 8px;
}

.st-search-suggest {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.st-search-suggest .st-cluster { justify-content: center; }

/* --------------------------------------------------------------------------
   Responsive — breakpoints match study.css
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
    .st-search-page { max-width: 760px; }
}

@media (max-width: 900px) {
    .st-search-input {
        min-height: 54px;
        font-size: 16px;
    }
}

@media (max-width: 760px) {
    /* No arrow keys on a phone, and the row needs the width. */
    .st-search-hints { display: none; }
    .st-search-bar { min-height: 0; }
    .st-search-input {
        min-height: 50px;
        padding-left: 44px;
        font-size: 16px; /* below 16px iOS zooms the page on focus */
    }
    .st-search-field__icon { left: 14px; }
    .st-search-row { padding: 12px 14px; }
    .st-search-row .st-row__time { display: none; }
    .st-search-start { padding-top: 20px; }
}
