/* ==========================================================================
   Live-search dropdown (kf_live_search_results)
   --------------------------------------------------------------------------
   Written for this port's own markup rather than carried over from
   cpro-live-search.css: that file is 639 lines built around LynTec's dark search panel, its
   horizontal `grid-auto-flow: column` result rails and a card set this element does not use.

   Loaded on every page, not just search results — the dropdown belongs to the header, so gating it
   on is_search() would leave it unstyled everywhere it actually appears. Same reasoning as the
   products mega-menu stylesheet in the theme.

   Tokens (--kf-*) are scoped to `.kf-sec` in kf-about.css, which is a page-content class and is not
   an ancestor of the header. Everything here therefore uses literals, deliberately — a var() that
   resolves to nothing takes the whole declaration with it.
   ========================================================================== */

.kf-live-search {
    --kf-ls-ink: #161616;
    --kf-ls-ink-3: #414243;
    --kf-ls-mute: #717275;
    --kf-ls-line: #E5E5E5;
    --kf-ls-paper: #F9F9F9;
    --kf-ls-yellow: #FED208;
    --kf-ls-display: 'Roboto Condensed', 'Roboto', system-ui, sans-serif;

    text-align: left;
    max-height: min(70vh, 620px);
    overflow-y: auto;
    /* The scrollbar overlays the right edge and was clipping the per-group counts on narrow
       screens, where the modal leaves less room. */
    padding-right: 10px;
    /* Keeps a wheel/trackpad gesture inside the dropdown instead of scrolling the page behind it
       once the list hits its end. */
    overscroll-behavior: contain;
}

.kf-live-search__hint,
.kf-live-search__empty {
    margin: 0;
    padding: 20px 4px;
    font-size: 15px;
    color: var(--kf-ls-mute);
}

.kf-live-search__group { padding: 0 0 4px; }
.kf-live-search__group + .kf-live-search__group { border-top: 1px solid var(--kf-ls-line); margin-top: 12px; padding-top: 16px; }

.kf-live-search__grouptitle {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
    font-family: var(--kf-ls-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--kf-ls-ink);
}
.kf-live-search__groupcount {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--kf-ls-mute);
    font-variant-numeric: tabular-nums;
}

/* The theme's dropdown inherits a list style; reset it rather than rely on the surroundings. */
.kf-live-search__list { list-style: none; margin: 0; padding: 0; }
.kf-live-search__item { margin: 0; padding: 0; }
.kf-live-search__item::marker { content: none; }

.kf-live-search__link {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 8px 6px;
    color: var(--kf-ls-ink);
    text-decoration: none;
    border-radius: 2px;
}
.kf-live-search__link:hover,
.kf-live-search__link:focus-visible {
    background: var(--kf-ls-paper);
    color: var(--kf-ls-ink);
    text-decoration: none;
}

/* Fixed box: product shots vary wildly in aspect and would otherwise set the row height. */
.kf-live-search__thumb {
    width: 48px; height: 48px;
    flex: 0 0 auto;
    background: var(--kf-ls-paper);
    border: 1px solid var(--kf-ls-line);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.kf-live-search__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

.kf-live-search__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kf-live-search__title {
    font-family: var(--kf-ls-display);
    font-size: 15px;
    font-weight: 700;
    line-height: 20px;
    color: var(--kf-ls-ink);
    /* Two lines, then ellipsis — a long product name must not push the dropdown wider. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kf-live-search__sub {
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--kf-ls-mute);
    font-variant-numeric: tabular-nums;
}

.kf-live-search__more {
    display: inline-block;
    margin: 6px 0 0 6px;
    font-size: 13px;
    color: var(--kf-ls-ink-3);
    text-decoration: underline;
}
.kf-live-search__more:hover { color: var(--kf-ls-ink); }

.kf-live-search__all {
    display: block;
    margin-top: 16px;
    padding: 12px;
    background: var(--kf-ls-yellow);
    color: var(--kf-ls-ink);
    font-family: var(--kf-ls-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
}
.kf-live-search__all:hover { background: #D9B201; color: var(--kf-ls-ink); text-decoration: none; }

@media (max-width: 639px) {
    .kf-live-search { max-height: 60vh; }
    .kf-live-search__link { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; }
    .kf-live-search__thumb { width: 40px; height: 40px; }
}

/* Thumb placeholder — a download has no featured image, and an empty bordered square reads as a
   failed image rather than as a file. */
.kf-live-search__thumb--empty { background: #fff; border-style: dashed; }
.kf-live-search__thumbtext {
    font-family: var(--kf-ls-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--kf-ls-mute);
    text-align: center;
    line-height: 1.1;
    padding: 2px;
    overflow: hidden;
}
