/* the help search: its box (in the header on a wide screen, at the top of the help's menu on a phone, and on the
   results page), its suggestions as it is typed, and its page of results */

.help-search {
    position: relative;
    display: flex;
    align-items: center;
    min-inline-size: 0;
}

    .help-search input[type=search] {
        font: inherit;
        font-size: var(--wa-font-size-s);
        color: var(--wa-color-text-normal);
        background: var(--wa-color-surface-default);
        border: var(--wa-border-width-s) solid var(--wa-color-neutral-border-loud, var(--wa-color-surface-border));
        border-radius: var(--wa-border-radius-pill, 999px);
        padding: var(--wa-space-2xs) 2.4rem var(--wa-space-2xs) var(--wa-space-m);
        min-block-size: 2.25rem;
        inline-size: 100%;
        box-sizing: border-box;
    }

    .help-search input[type=search]:focus-visible {
        outline: var(--wa-focus-ring);
        outline-offset: var(--wa-focus-ring-offset);
    }

    .help-search button {
        position: absolute;
        inset-inline-end: 0.2rem;
        inset-block: 0;
        margin-block: auto;
        block-size: 2rem;
        inline-size: 2rem;
        display: grid;
        place-items: center;
        border: 0;
        background: transparent;
        color: var(--wa-color-text-quiet);
        cursor: pointer;
        border-radius: var(--wa-border-radius-pill, 999px);
    }

        .help-search button:focus-visible {
            outline: var(--wa-focus-ring);
        }

/* in the header: beside the language picker on a wide screen only (a phone has it in the help's menu) */
.help-search-header {
    inline-size: clamp(12rem, 22vw, 20rem);
}

wa-page[view='mobile'] .help-search-header {
    display: none;
}

/* in the help's menu: on a phone only (a wide screen has it in the header) */
.help-search-nav {
    margin-block-end: var(--wa-space-s);
}

wa-page:not([view='mobile']) .help-search-nav {
    display: none;
}

.help-search-page {
    max-inline-size: 48rem;
}

    .help-search-page .help-search {
        margin-block: var(--wa-space-m);
    }

    .help-search-page .help-search input[type=search] {
        font-size: var(--wa-font-size-m);
        min-block-size: 2.75rem;
    }

/* the suggestions under the box */
.help-search-list {
    position: absolute;
    z-index: 100;
    inset-block-start: calc(100% + 0.25rem);
    inset-inline: 0;
    min-inline-size: min(28rem, 90vw);
    max-block-size: 70vh;
    overflow-y: auto;
    margin: 0;
    padding: var(--wa-space-2xs);
    list-style: none;
    background: var(--wa-color-surface-raised, var(--wa-color-surface-default));
    border: var(--wa-border-width-s) solid var(--wa-color-surface-border);
    border-radius: var(--wa-border-radius-l);
    box-shadow: var(--wa-shadow-l);
    text-align: start;
}

.help-search-header .help-search-list {
    inset-inline: auto 0;
}

.help-search-list li {
    margin: 0;
    padding: var(--wa-space-xs) var(--wa-space-s);
    border-radius: var(--wa-border-radius-m);
    cursor: pointer;
    font-size: var(--wa-font-size-s);
    line-height: 1.35;
    color: var(--wa-color-text-normal);
}

    .help-search-list li[aria-selected=true],
    .help-search-list li:hover {
        background: var(--wa-color-brand-fill-quiet, var(--wa-color-neutral-fill-quiet));
    }

    .help-search-list li .help-search-snippet {
        display: block;
        color: var(--wa-color-text-quiet);
        margin-block-start: var(--wa-space-3xs);
    }

    .help-search-list li.help-search-all {
        font-weight: var(--wa-font-weight-semibold);
        color: var(--wa-color-brand-on-quiet, var(--wa-color-text-link));
    }

.help-search-title {
    font-weight: var(--wa-font-weight-semibold);
}

.help-search-heading {
    color: var(--wa-color-text-quiet);
}

.help-search mark,
.help-search-results mark {
    background: var(--wa-color-yellow-90, #fff3a0);
    color: inherit;
    border-radius: 2px;
    padding-inline: 1px;
}

.wa-dark .help-search mark,
.wa-dark .help-search-results mark {
    background: var(--wa-color-yellow-30, #6b5a00);
}

/* the page of results */
.help-search-results {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: var(--wa-space-l);
}

    .help-search-results li {
        margin: 0;
    }

    .help-search-results a {
        font-size: var(--wa-font-size-l);
    }

    .help-search-results .help-search-snippet {
        margin: var(--wa-space-2xs) 0;
    }

.help-search-path {
    font-size: var(--wa-font-size-xs);
    color: var(--wa-color-text-quiet);
}
