/* Site search: the bar under the social icons (komp/meklesana.js).
   At home (no column open, wider than a phone) it sits in the middle of the
   viewport; once a column opens it glides into its slot here. The slot always
   keeps the bar's height, so the menu below never moves. */

.meklesana-vieta {
    position: relative;
    height: 2.25rem;
    margin-top: 1.25rem;
}

/* The slot makes the header taller, and main.css lifts the menu below it by
   15% — on a 700px screen far enough to run into the bar. So the lift stops
   where the menu would come closer to the slot than the slot is to the icons
   (--meklesana-pacelt, measured by the script). Without the script the menu
   is placed exactly as main.css says. */
.parent-items-wrapper {
    top: max(-15%, var(--meklesana-pacelt, -15%));
}

@media (max-height: 640px) {
    .parent-items-wrapper {
        top: max(0px, var(--meklesana-pacelt, 0px));
    }
}

.meklesana {
    position: absolute;
    top: 0;
    /* Starts where the menu's highlight band does (.parent-item's -0.5rem)
       and stops 1rem short of the column's edge. */
    left: -0.5rem;
    right: -5rem;
    height: 100%;
    /* Over the columns' scroll bars (10), under the 4th column's overlay (50). */
    z-index: 20;
    display: flex;
    align-items: center;
    border: 1px solid var(--tinte, #000);
    background: var(--fons, #fff);
    color: var(--tinte, #000);
}

/* Focused: the frame doubles, inside, so nothing shifts. */
.meklesana:focus-within {
    box-shadow: inset 0 0 0 1px var(--tinte, #000);
}

.meklesana input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 0.5rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.meklesana input::placeholder {
    color: inherit;
    opacity: 0.45;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Escape clears it; no native × or magnifier. */
.meklesana input::-webkit-search-cancel-button,
.meklesana input::-webkit-search-decoration {
    -webkit-appearance: none;
    display: none;
}

/* The "/" shortcut hint: only with a keyboard in mind, and not while typing. */
.meklesana-taustins {
    flex-shrink: 0;
    margin-right: 0.5rem;
    padding: 0 0.35rem;
    border: 1px solid currentColor;
    font-family: inherit;
    font-size: 0.7rem;
    line-height: 1.4;
    opacity: 0.45;
    pointer-events: none;
}

.meklesana:focus-within .meklesana-taustins {
    display: none;
}

@media (hover: none) {
    .meklesana-taustins {
        display: none;
    }
}

/* Results: the children list's look (an inverted block), the chosen one
   inverted back, like an active child link. */
.meklesana-rezultati {
    position: absolute;
    top: calc(100% + 1px);
    left: -1px;
    width: min(30rem, calc(100vw - 2rem));
    max-height: min(60vh, 34rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    background: var(--tinte, #000);
    color: var(--fons, #fff);
}

.meklesana-rezultati::-webkit-scrollbar {
    display: none;
}

.meklesana-rezultati[hidden] {
    display: none;
}

.meklesana-rezultati li {
    padding: 0.6rem 1rem;
    line-height: 1.35;
    cursor: pointer;
}

.meklesana-rezultati li[aria-selected="true"] {
    background: var(--fons, #fff);
    color: var(--tinte, #000);
}

.meklesana-rezultati .meklesana-tukss {
    font-size: 0.85rem;
    opacity: 0.7;
    cursor: default;
}

.meklesana-veids {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.meklesana-virsraksts {
    display: block;
    font-size: 0.95rem;
    font-weight: bold;
}

.meklesana-fragments {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    opacity: 0.85;
}

.meklesana-rezultati mark {
    background: var(--fons, #fff);
    color: var(--tinte, #000);
}

.meklesana-rezultati li[aria-selected="true"] mark {
    background: var(--tinte, #000);
    color: var(--fons, #fff);
}

/* Centred, at home. Phones never get here (the menu fills their screen).
   --meklesana-l is the portrait column's right edge (set by the script): on a
   narrow screen the bar moves right rather than cover the menu. */
@media (min-width: 769px) {
    body.meklesana-centra .meklesana {
        --platums: min(34rem, calc(100vw - var(--meklesana-l, 0px) - 4rem));
        position: fixed;
        top: calc(50vh - 1.5rem);
        left: max(calc(var(--meklesana-l, 0px) + 2rem), calc(50vw - var(--platums) / 2));
        right: auto;
        width: var(--platums);
        height: 3rem;
    }

    body.meklesana-centra .meklesana input {
        padding: 0 1rem;
        font-size: 1.1rem;
    }

    body.meklesana-centra .meklesana-rezultati {
        width: calc(100% + 2px);
    }
}
