/**
 * Fast Search Styles
 * Tufte-inspired minimal search interface
 */

/* Search Modal */
#fastSearch {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in oklab, var(--text) 60%, transparent);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

#fastSearch.visible {
    display: flex;
    opacity: 1;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

/* Search Container */
.search-container {
    background-color: var(--bg);
    border-radius: 4px;
    box-shadow: 0 10px 40px color-mix(in oklab, var(--text) 30%, transparent);
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Search Header */
.search-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg);
}

/* Search Input */
#searchInput {
    flex: 1;
    font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    font-size: 1.2rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text);
}

#searchInput::placeholder {
    color: var(--muted);
}

/* Close Button */
.search-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-close:hover {
    color: var(--text);
}

/* Search Results */
#searchResults {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    max-height: calc(70vh - 80px);
    width: 100%;
}

#searchResults:empty {
    display: none;
}

/* Result Items */
.search-result {
    border-bottom: 1px solid var(--border-soft);
    width: 100%;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result a {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: background-color 0.15s;
    box-sizing: border-box;
}

.search-result a:hover,
.search-result.selected a {
    background-color: var(--border-soft);
}

.search-result-title {
    font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    font-size: 1.2rem;
    font-weight: normal;
    margin-bottom: 0.3rem;
    color: var(--text);
    width: 100%;
    max-width: none;
}

.search-result-meta {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: none;
}

.search-result-date {
    margin-right: 0.8rem;
}

.search-result-section {
    text-transform: capitalize;
    color: var(--muted);
}

.search-result-section::before {
    content: "·";
    margin-right: 0.5rem;
    color: var(--border);
}

.search-result-summary {
    font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--muted);
    width: 100%;
    max-width: none;
}

/* Special States */
.search-loading,
.search-no-results {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--muted);
    font-style: italic;
}

/* Mobile Responsiveness */
@media (max-width: 760px) {
    #fastSearch.visible {
        padding-top: 5vh;
    }

    .search-container {
        width: 95%;
        max-height: 80vh;
    }

    .search-header {
        padding: 0.8rem;
    }

    #searchInput {
        font-size: 1rem;
    }

    .search-result a {
        padding: 0.8rem 1rem;
    }

    .search-result-title {
        font-size: 1.1rem;
    }

    .search-result-summary {
        font-size: 0.95rem;
    }
}

/* Prevent body scroll when search is open */
body.search-open {
    overflow: hidden;
}
