/* Header search button and the search dialog (js/search-ui.js). */
.search-button {
    gap: 8px;
}
.search-button svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
}
.search-kbd {
    font: 10px/1 var(--mono);
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 3px 5px;
}
@media (pointer: coarse), (max-width: 700px) {
    .search-kbd {
        display: none;
    }
}
@media (max-width: 520px) {
    .search-button > span {
        display: none;
    }
}

dialog.search-dialog {
    width: min(640px, calc(100% - 32px));
    padding: 0;
    margin-top: min(12vh, 110px);
    max-height: min(76dvh, 680px);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
dialog.search-dialog[open] {
    display: flex;
}
.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 14px 20px;
    border-bottom: 1px solid var(--line);
}
.search-field > svg {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--accent);
}
.search-field input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--fg);
    /* 16px or more, or iOS Safari zooms the page on focus. */
    font: 18px/1.4 var(--font);
    letter-spacing: -0.01em;
    padding: 6px 0;
    -webkit-appearance: none;
    appearance: none;
}
.search-field input::placeholder {
    color: var(--muted);
}
.search-field input::-webkit-search-cancel-button {
    display: none;
}
.search-status {
    font: 10px/1.4 var(--mono);
    color: var(--muted);
    padding: 10px 20px 4px;
    margin: 0;
    min-height: 1.4em;
}
.search-results {
    list-style: none;
    margin: 0;
    padding: 4px 8px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}
.search-results a {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}
.search-results [aria-selected="true"] a {
    background: var(--soft);
}
@media (hover: hover) {
    .search-results a:hover {
        background: var(--soft);
    }
}
.search-results strong {
    font-weight: 560;
    font-size: 15px;
    line-height: 1.35;
    letter-spacing: -0.01em;
}
.search-meta {
    font: 10px/1.4 var(--mono);
    color: var(--accent);
    text-transform: uppercase;
}
.search-excerpt {
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    border-top: 1px solid var(--line);
    font: 10px/1.4 var(--mono);
    color: var(--muted);
}
/* Keyboard hints only; touch screens have no use for them. */
@media (pointer: coarse) {
    .search-footer {
        display: none;
    }
}
@media (max-width: 700px) {
    dialog.search-dialog {
        margin-top: 12px;
        max-height: calc(100dvh - 24px);
    }
}
