/* ==========================================================
   search.css — Global Site Search Styles
   Fully isolated: all selectors scoped to #search-modal or .search-
   ========================================================== */

/* --- Search Trigger Button (in header nav) --- */
.search-trigger {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-family: 'Manrope', 'Manrope Fallback', sans-serif;
    font-size: 0.85rem;
    transition: border-color 0.3s ease, color 0.3s ease;
    white-space: nowrap;
    line-height: 1;
}
.search-trigger:hover,
.search-trigger:focus-visible {
    border-color: var(--brand-primary);
    color: var(--text-light);
    outline: none;
}
.search-trigger svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}
.search-trigger kbd {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-family: inherit;
    line-height: 1;
    pointer-events: none;
}

/* Mobile: icon-only trigger in header bar */
.search-trigger--mobile {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-muted);
    transition: color 0.3s ease;
}
.search-trigger--mobile:hover { color: var(--text-light); }
.search-trigger--mobile svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
}

@media (max-width: 991px) {
    /* Hide desktop trigger details on mobile for homepage */
    .search-trigger--mobile { display: flex; align-items: center; }
}

@media (max-width: 767px) {
    /* Compact trigger for header-nav and simple pages */
    .search-trigger kbd { display: none; }
    .search-trigger > span { display: none; }
    .search-trigger { padding: 0.35rem; border: none; }
}

/* --- Search Modal Overlay --- */
#search-modal {
    position: fixed;
    inset: 0;
    z-index: 2001;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(13, 31, 58, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
#search-modal.is-open {
    display: flex;
}

/* --- Search Panel --- */
#search-modal .search-panel {
    background: var(--background-panel, #122A4C);
    border: 1px solid var(--border-color, #2A3F5F);
    border-radius: 12px;
    width: 92%;
    max-width: 640px;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* --- Search Input Area --- */
#search-modal .search-input-wrap {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #2A3F5F);
    gap: 0.75rem;
}
#search-modal .search-input-wrap svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted, #BCCFE0);
    fill: none;
    flex-shrink: 0;
}
#search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-light, #F5F5F5);
    font-family: 'Manrope', 'Manrope Fallback', sans-serif;
    font-size: 1.1rem;
    caret-color: var(--brand-primary, #E65100);
    min-width: 0;
}
#search-input::placeholder {
    color: var(--text-muted, #BCCFE0);
    opacity: 0.5;
}

/* --- Results Area --- */
#search-modal .search-results {
    overflow-y: auto;
    padding: 0.5rem;
    flex: 1;
    min-height: 0;
}
#search-modal .search-results::-webkit-scrollbar { width: 6px; }
#search-modal .search-results::-webkit-scrollbar-track { background: transparent; }
#search-modal .search-results::-webkit-scrollbar-thumb {
    background: var(--border-color, #2A3F5F);
    border-radius: 3px;
}

/* Result group label */
#search-modal .search-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #BCCFE0);
    opacity: 0.5;
    padding: 0.75rem 0.75rem 0.25rem;
    font-weight: 600;
    font-family: 'Inter', 'Inter Fallback', sans-serif;
}

/* Individual result */
#search-modal .search-result {
    display: block;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: inherit;
}
#search-modal .search-result:hover,
#search-modal .search-result.is-active {
    background-color: rgba(230, 81, 0, 0.08);
}
#search-modal .search-result-title {
    font-family: 'Inter', 'Inter Fallback', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-light, #F5F5F5);
    margin-bottom: 0.15rem;
    line-height: 1.35;
}
#search-modal .search-result-title mark {
    background: rgba(230, 81, 0, 0.25);
    color: var(--brand-secondary, #FF8F00);
    border-radius: 2px;
    padding: 0 2px;
}
#search-modal .search-result-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.15rem;
}
#search-modal .search-result-type {
    display: inline-block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    background: rgba(230, 81, 0, 0.12);
    color: var(--brand-secondary, #FF8F00);
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1.4;
}
#search-modal .search-result-desc {
    font-size: 0.82rem;
    color: var(--text-muted, #BCCFE0);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* No results */
#search-modal .search-no-results {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted, #BCCFE0);
}
#search-modal .search-no-results p {
    font-size: 0.95rem;
    color: var(--text-muted, #BCCFE0);
}
#search-modal .search-no-results a {
    color: var(--brand-primary, #E65100);
}

/* Empty state (before typing) */
#search-modal .search-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted, #BCCFE0);
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Footer keyboard hints */
#search-modal .search-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-color, #2A3F5F);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.72rem;
    color: var(--text-muted, #BCCFE0);
    opacity: 0.45;
    font-family: 'Manrope', 'Manrope Fallback', sans-serif;
}
#search-modal .search-footer kbd {
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border: 1px solid var(--border-color, #2A3F5F);
    border-radius: 3px;
    background: rgba(255,255,255,0.04);
    margin: 0 0.1rem;
    font-family: inherit;
    line-height: 1;
}

/* --- Responsive --- */
@media (max-width: 767px) {
    #search-modal {
        padding-top: 5vh;
    }
    #search-modal .search-panel {
        width: 96%;
        max-height: 85dvh;
        border-radius: 10px;
    }
    #search-modal .search-footer {
        display: none;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    #search-modal {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(13, 31, 58, 0.95);
    }
}
