/* Global site search modal */

.site-search-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem 1rem 2rem;
    padding-top: max(1rem, 10vh);
}

.site-search-modal.hidden {
    display: none;
}

.site-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.45);
    backdrop-filter: blur(4px);
}

.site-search-modal__panel {
    position: relative;
    display: flex;
    width: min(100%, 42rem);
    max-height: min(78vh, 640px);
    flex-direction: column;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(255 255 255);
    box-shadow:
        0 24px 60px rgb(15 23 42 / 0.18),
        0 0 0 1px rgb(255 255 255 / 0.6) inset;
    animation: siteSearchIn 0.2s ease-out;
}

@keyframes siteSearchIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.site-search-modal__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgb(241 245 249);
    padding: 0.875rem 1rem;
    background: linear-gradient(180deg, rgb(248 250 252), rgb(255 255 255));
}

.site-search-modal__input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.site-search-modal__input-icon {
    pointer-events: none;
    position: absolute;
    top: 50%;
    right: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    transform: translateY(-50%);
    color: rgb(148 163 184);
}

.site-search-modal__input {
    width: 100%;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.75rem;
    background: rgb(255 255 255);
    padding: 0.75rem 2.75rem 0.75rem 0.875rem;
    font-size: 0.9375rem;
    color: rgb(15 23 42);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.site-search-modal__input:focus {
    border-color: rgb(37 99 235);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.site-search-modal__input::placeholder {
    color: rgb(148 163 184);
}

.site-search-modal__kbd {
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    border-radius: 0.375rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(248 250 252);
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: rgb(100 116 139);
}

.site-search-modal__close {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(255 255 255);
    color: rgb(100 116 139);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.site-search-modal__close:hover {
    border-color: rgb(191 219 254);
    background: rgb(239 246 255);
    color: rgb(29 78 216);
}

.site-search-modal__close svg {
    width: 1.125rem;
    height: 1.125rem;
}

.site-search-modal__hints {
    padding: 1.25rem 1.25rem 1rem;
}

.site-search-modal__hints-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: rgb(15 23 42);
}

.site-search-modal__hint-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.site-search-modal__hint-tags span {
    border-radius: 9999px;
    border: 1px solid rgb(226 232 240);
    background: rgb(248 250 252);
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(71 85 105);
}

.site-search-modal__hints-text {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: rgb(100 116 139);
}

.site-search-modal__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0.5rem 0.75rem;
}

.site-search-modal__group + .site-search-modal__group {
    margin-top: 0.25rem;
}

.site-search-modal__group-label {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0;
    padding: 0.5rem 0.75rem 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgb(100 116 139);
    background: rgb(255 255 255 / 0.95);
    backdrop-filter: blur(4px);
}

.site-search-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-search-modal__item + .site-search-modal__item {
    margin-top: 0.125rem;
}

.site-search-modal__link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-radius: 0.75rem;
    padding: 0.625rem 0.75rem;
    text-decoration: none;
    transition: background 0.15s ease;
}

.site-search-modal__link:hover,
.site-search-modal__link.is-active {
    background: rgb(239 246 255);
}

.site-search-modal__icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgb(241 245 249);
    color: rgb(71 85 105);
}

.site-search-modal__link:hover .site-search-modal__icon,
.site-search-modal__link.is-active .site-search-modal__icon {
    background: rgb(219 234 254);
    color: rgb(29 78 216);
}

.site-search-modal__icon svg {
    width: 1rem;
    height: 1rem;
}

.site-search-modal__icon--calls { background: rgb(219 234 254); color: rgb(29 78 216); }
.site-search-modal__icon--axes { background: rgb(237 233 254); color: rgb(109 40 217); }
.site-search-modal__icon--elites { background: rgb(209 250 229); color: rgb(4 120 87); }
.site-search-modal__icon--articles { background: rgb(255 237 213); color: rgb(194 65 12); }
.site-search-modal__icon--ideas { background: rgb(254 243 199); color: rgb(180 83 9); }

.site-search-modal__text {
    min-width: 0;
    flex: 1;
}

.site-search-modal__title {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.45;
    color: rgb(15 23 42);
}

.site-search-modal__subtitle {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgb(100 116 139);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-search-modal__empty,
.site-search-modal__loading,
.site-search-modal__error {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgb(100 116 139);
}

.site-search-modal__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.site-search-modal__spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgb(226 232 240);
    border-top-color: rgb(37 99 235);
    border-radius: 9999px;
    animation: siteSearchSpin 0.7s linear infinite;
}

@keyframes siteSearchSpin {
    to { transform: rotate(360deg); }
}

.site-search-modal__footer {
    border-top: 1px solid rgb(241 245 249);
    padding: 0.625rem 1rem;
    background: rgb(248 250 252);
}

.site-search-modal__footer-hint {
    font-size: 0.6875rem;
    color: rgb(148 163 184);
}

.site-search-modal__footer kbd {
    border-radius: 0.25rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(255 255 255);
    padding: 0.05rem 0.3rem;
    font-size: 0.625rem;
    font-family: inherit;
}

@media (max-width: 640px) {
    .site-search-modal {
        padding-top: 0.75rem;
    }

    .site-search-modal__panel {
        max-height: calc(100vh - 1.5rem);
        border-radius: 0.875rem;
    }

    .site-search-modal__kbd,
    .site-search-modal__footer {
        display: none;
    }

    .site-search-modal__input {
        padding-left: 0.875rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-search-modal__panel {
        animation: none;
    }
}
