/* ============================================================
 * Lapland Trip Planner — site search + /guides/ hub
 * Loads after nav.css and reuses its --ltp-* tokens.
 * ============================================================ */

/* ---- Header trigger ---- */
.ltp-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 8px;
    padding: 7px 10px 7px 12px;
    background: var(--ltp-snow);
    border: 1px solid var(--ltp-border);
    border-radius: 999px;
    color: var(--ltp-text-soft);
    font: inherit;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.ltp-search-trigger:hover {
    border-color: var(--ltp-aurora-teal);
    color: var(--ltp-text);
}
.ltp-search-trigger__icon { flex-shrink: 0; }
.ltp-search-trigger__label { white-space: nowrap; }
.ltp-search-trigger__key {
    padding: 1px 6px;
    border: 1px solid var(--ltp-border);
    border-radius: 4px;
    background: #fff;
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--ltp-text-light);
}

/* Below the nav breakpoint the trigger collapses to a bare icon and sits
   next to the burger, which carries margin-left:auto. */
@media (max-width: 960px) {
    .ltp-search-trigger {
        margin-left: auto;
        padding: 8px;
        background: none;
        border-color: transparent;
    }
    .ltp-search-trigger__label,
    .ltp-search-trigger__key { display: none; }
    .ltp-burger { margin-left: 0; }
}

/* ---- Overlay ---- */
.ltp-search {
    position: fixed;
    inset: 0;
    z-index: 200;                 /* above .ltp-header (100) */
    display: flex;
    justify-content: center;
    padding: 12vh 16px 16px;
}
/* REQUIRED. An author-level `display: flex` beats the browser's built-in
   [hidden] { display: none }, so without this the overlay is permanently
   visible full-screen and toggling el.hidden does nothing. Same pattern as
   .ltp-drawer[hidden] / .ltp-panel[hidden] in nav.css. */
.ltp-search[hidden] { display: none; }
html.ltp-search-open { overflow: hidden; }

.ltp-search__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 39, 68, 0.45);
}
.ltp-search__panel {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 76vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(26, 39, 68, 0.28);
    overflow: hidden;
}

.ltp-search__form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 14px 18px;
    border-bottom: 1px solid var(--ltp-border);
}
.ltp-search__icon { flex-shrink: 0; color: var(--ltp-text-light); }
.ltp-search__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 1.05rem;
    color: var(--ltp-text);
    padding: 4px 0;
}
.ltp-search__input:focus { outline: none; }
.ltp-search__input::-webkit-search-cancel-button { display: none; }
.ltp-search__close {
    flex-shrink: 0;
    background: none;
    border: 0;
    padding: 6px;
    color: var(--ltp-text-light);
    cursor: pointer;
    border-radius: 6px;
}
.ltp-search__close:hover { color: var(--ltp-text); background: var(--ltp-snow); }

/* ---- Results ---- */
.ltp-search__results {
    list-style: none;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    flex: 1;
}
.ltp-search__result { margin: 0; }
.ltp-search__link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--ltp-text);
}
.ltp-search__result.is-active .ltp-search__link,
.ltp-search__link:hover { background: var(--ltp-snow); }
.ltp-search__title {
    display: block;
    font-weight: 600;
    font-size: 0.97rem;
    line-height: 1.35;
}
.ltp-search__cluster {
    display: block;
    margin-top: 2px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ltp-aurora-teal);
}
.ltp-search__desc {
    display: block;
    margin-top: 3px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--ltp-text-soft);
}
.ltp-search__note,
.ltp-search__empty {
    padding: 12px 14px 6px;
    font-size: 0.85rem;
    color: var(--ltp-text-soft);
}
.ltp-search__all { padding: 6px 14px 12px; }
.ltp-search__all a {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ltp-aurora-teal);
}
.ltp-search__hint {
    margin: 0;
    padding: 16px 18px 20px;
    font-size: 0.88rem;
    color: var(--ltp-text-soft);
}
.ltp-search__hint a { color: var(--ltp-aurora-teal); font-weight: 600; }

/* WordPress's own utility class is not guaranteed to be present in the child. */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Drawer search row ---- */
.ltp-drawer__search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    margin: 0 0 6px;
    background: var(--ltp-snow);
    border: 1px solid var(--ltp-border);
    border-radius: 10px;
    color: var(--ltp-text-soft);
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    text-align: left;
}

@media (max-width: 600px) {
    .ltp-search { padding: 6vh 10px 10px; }
    .ltp-search__panel { max-height: 86vh; }
}
