/* ============================================
   GLOBAL SEARCH MODAL
   ============================================ */

/* Body scroll lock */
body.global-search-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ============================================
   OVERLAY
   ============================================ */

.global-search {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.global-search[hidden] {
    display: none;
}

.global-search.is-open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   BACKDROP
   ============================================ */

.global-search__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   PANEL
   ============================================ */

.global-search__panel {
    position: relative;
    width: 100%;
    max-width: 580px;
    margin: 0 var(--space-m, 16px);
    background: var(--bg-body, #fff);
    border-radius: var(--radius-m, 8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.2s ease;
}

.global-search.is-open .global-search__panel {
    transform: translateY(0);
}

/* ============================================
   INPUT
   ============================================ */

.global-search__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.global-search__icon {
    position: absolute;
    left: var(--space-m, 16px);
    color: var(--text-body-l-3, #999);
    pointer-events: none;
}

.global-search__input {
    width: 100%;
    padding: var(--space-m, 16px) var(--space-xl, 48px);
    padding-left: calc(var(--space-m, 16px) + 28px);
    font-size: var(--text-l, 1.125rem);
    font-family: inherit;
    border: none;
    background: transparent;
    color: var(--text-body, #333);
    outline: none;
}

.global-search__input::placeholder {
    color: var(--text-body-l-3, #999);
}

.global-search__close {
    position: absolute;
    right: var(--space-xs, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-s, 4px);
    background: transparent;
    color: var(--text-body-l-2, #666);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.global-search__close:hover {
    background: var(--bg-body-d-1, #f0f0f0);
    color: var(--text-body, #333);
}

/* ============================================
   HINT BAR
   ============================================ */

.global-search__hint {
    padding: var(--space-xs, 8px) var(--space-m, 16px);
    border-top: 1px solid var(--bg-body-d-2, #e0e0e0);
    font-size: var(--text-xs, 0.75rem);
    color: var(--text-body-l-3, #999);
    display: flex;
    gap: var(--space-s, 12px);
}

.global-search__hint kbd {
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg-body-d-1, #f0f0f0);
    border: 1px solid var(--bg-body-d-2, #e0e0e0);
    border-radius: 3px;
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .global-search {
        padding-top: 10vh;
    }

    .global-search__panel {
        max-width: calc(100% - 32px);
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .global-search,
    .global-search__panel {
        transition: none;
    }

    .global-search__backdrop {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* ============================================
   SEARCH RESULTS PAGE
   ============================================ */

/* Search form */
.search-results__form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-results__form-icon {
    position: absolute;
    left: var(--space-s, 12px);
    color: var(--text-body-l-3, #999);
    pointer-events: none;
}

.search-results__input {
    width: 100%;
    padding: var(--space-s, 12px) var(--space-m, 16px);
    padding-left: calc(var(--space-s, 12px) + 28px);
    font-size: var(--text-l);
    font-family: inherit;
    border: 1px solid var(--bg-body-d-2, #e0e0e0);
    border-radius: var(--radius-s, 4px);
    background: var(--bg-body, #fff);
    color: var(--text-body, #333);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-results__input:focus {
    border-color: var(--primary, #633368);
    box-shadow: 0 0 0 2px rgba(99, 51, 104, 0.15);
}

/* Results wrapper */
.search-results-grouped {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: var(--space-l, 24px) var(--space-m, 16px) var(--space-xxl, 64px);
}

/* Summary */
.search-results__summary {
    font-size: var(--text-s);
    color: var(--text-body-l-2, #666);
    margin: var(--space-m, 16px) 0 var(--space-l, 24px);
}

.search-results__summary strong {
    color: var(--text-body, #333);
}

/* Empty state */
.search-results__empty {
    padding: var(--space-xxl, 64px) 0;
    text-align: center;
    color: var(--text-body-l-2, #666);
}

.search-results__empty p {
    margin: 0 0 var(--space-xs, 8px);
}

.search-results__empty-hint {
    font-size: var(--text-s);
    color: var(--text-body-l-3, #999);
}

/* Group sections */
.search-results__group {
    margin-bottom: var(--space-l, 24px);
}

.search-results__group-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs, 8px);
    font-size: var(--text-s);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary, #633368);
    padding: var(--space-xs, 8px) 0;
    margin: 0 0 var(--space-xs, 8px);
    border-bottom: 2px solid var(--primary--alt, #f5f0f6);
}

.search-results__group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--primary--alt, #f5f0f6);
    color: var(--primary, #633368);
    border-radius: 11px;
}

/* Result items */
.search-results__group-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-results__result {
    border-bottom: 1px solid var(--bg-body-d-2, #e0e0e0);
}

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

.search-results__result-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-block: var(--space-m);
    padding: var(--space-s, 12px) var(--space-s, 12px);
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-s, 4px);
    transition: background 0.1s ease;
}

.search-results__result-link:hover {
    background: var(--primary--alt-l-6);
}

.search-results__result-title {
    font-size: var(--text-l);
    font-weight: 500;
    color: var(--primary);
    line-height: 1.3;
}

.search-results__result-excerpt {
    font-size: var(--text-m);
    color: var(--text-body-l-2, #666);
    line-height: 1.5;
}

/* ============================================
   404 NOT FOUND — SUGGESTIONS
   ============================================ */

.notfound-suggestions {
    margin: 0 auto var(--space-l, 24px);
}

.notfound-suggestions__title {
    font-size: var(--text-xl, 1.5rem);
    font-weight: 700;
    color: var(--text-body, #333);
    margin: 0 0 var(--space-l, 24px);
    text-align: center;
}

.notfound-suggestions__grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-l, 24px);
    justify-content: center;
}

.notfound-suggestions__card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-m, 16px) var(--space-l, 24px);
    min-width: 200px;
    max-width: 300px;
    flex: 1 1 calc(33.333% - var(--space-l, 24px));
    border-radius: var(--radius-m, 8px);
    text-decoration: none;
    font-family: var(--text-heading-font-family, inherit);
    font-weight: 700;
    font-size: var(--text-l, 1.25rem);
    line-height: 1.3;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.notfound-suggestions__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    text-decoration: underline;
}

.notfound-suggestions__card--primary {
    background: var(--primary--alt, #f5f0f6);
    color: var(--primary, #633368);
}

.notfound-suggestions__card--secondary {
    background: var(--secondary--alt, #e0f7ef);
    color: var(--secondary, #0D7377);
}

@media (max-width: 600px) {
    .notfound-suggestions__card {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* ============================================
   404 NOT FOUND — SEARCH FORM (reuses search-results classes)
   Constrain width when inside a 404 / centered context
   ============================================ */

.notfound-search-wrap .search-results-grouped {
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
}
