/* ===========================================================================
   Spotlight — site-wide command palette
   Self-contained styles; no dependency on the per-page design tokens so it
   looks identical on light, refined, edition and the bespoke dark pages.
   =========================================================================== */

.spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(3.5rem, 12vh, 9rem) 1rem 1rem;
    background: rgba(8, 15, 12, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease;
}

.spotlight-overlay.open {
    opacity: 1;
    visibility: visible;
}

.spotlight-panel {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transform: translateY(-12px) scale(0.985);
    transition: transform 0.16s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.spotlight-overlay.open .spotlight-panel {
    transform: translateY(0) scale(1);
}

.spotlight-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid #eceef0;
}

.spotlight-search svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    color: #10b981;
}

.spotlight-input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    color: #111827;
    font-family: inherit;
}

.spotlight-input::placeholder {
    color: #9ca3af;
}

.spotlight-hint-key {
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
    letter-spacing: 0.03em;
}

.spotlight-results {
    max-height: min(56vh, 460px);
    overflow-y: auto;
    padding: 0.4rem;
}

.spotlight-group-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    padding: 0.6rem 0.75rem 0.3rem;
}

.spotlight-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.spotlight-item.active,
.spotlight-item:hover {
    background: #ecfdf5;
}

.spotlight-item-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #f0fdf4;
    color: #059669;
}

.spotlight-item-icon svg {
    width: 18px;
    height: 18px;
}

.spotlight-item-body {
    min-width: 0;
    flex: 1 1 auto;
}

.spotlight-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-item-sub {
    font-size: 0.8rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-item-go {
    flex: 0 0 auto;
    color: #d1d5db;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.spotlight-item.active .spotlight-item-go {
    opacity: 1;
    color: #10b981;
}

.spotlight-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
}

.spotlight-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.55rem 1.1rem;
    border-top: 1px solid #eceef0;
    font-size: 0.72rem;
    color: #9ca3af;
}

.spotlight-footer kbd {
    font-family: inherit;
    font-weight: 700;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    padding: 0.05rem 0.35rem;
    margin: 0 0.15rem;
}

/* Nav trigger button (search affordance in the nav). */
.nav-spotlight-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: inherit;
    border-radius: 9px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    opacity: 0.85;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.nav-spotlight-trigger:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.14);
}

.nav-spotlight-trigger svg {
    width: 16px;
    height: 16px;
}

.nav-spotlight-trigger .nav-spotlight-kbd {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 5px;
    padding: 0.05rem 0.35rem;
    letter-spacing: 0.03em;
}

@media (max-width: 768px) {
    .nav-spotlight-trigger .nav-spotlight-label,
    .nav-spotlight-trigger .nav-spotlight-kbd {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
   Enter transition: "Searching // <Type> // <name>" left-to-right reveal
   --------------------------------------------------------------------------- */
.spotlight-transition {
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 6vh, 3rem) 1.25rem;
    min-height: 96px;
}

.spotlight-transition-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: clamp(1.1rem, 3.6vw, 1.6rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #ffffff;
    text-shadow: 0 2px 18px rgba(16, 185, 129, 0.45);
}

.spotlight-transition .st-seg,
.spotlight-transition .st-sep {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    white-space: nowrap;
}

.spotlight-transition .st-sep {
    color: #34d399;
    font-weight: 900;
}

.spotlight-transition .st-seg-3 {
    color: #6ee7b7;
    max-width: 70vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-transition.reveal-1 .st-seg-1,
.spotlight-transition.reveal-1 .st-sep-1,
.spotlight-transition.reveal-2 .st-seg-2,
.spotlight-transition.reveal-2 .st-sep-2,
.spotlight-transition.reveal-3 .st-seg-3 {
    opacity: 1;
    transform: translateX(0);
}

.spotlight-transition .st-caret {
    color: #34d399;
    opacity: 0;
    animation: spotlight-blink 0.8s steps(1) infinite;
    font-weight: 400;
}

.spotlight-transition.reveal-3 .st-caret {
    opacity: 1;
}

@keyframes spotlight-blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .spotlight-transition .st-seg,
    .spotlight-transition .st-sep {
        transition: none;
    }
    .spotlight-transition .st-caret {
        animation: none;
    }
}

/* Dark scheme adaptation for the panel itself. */
@media (prefers-color-scheme: dark) {
    .spotlight-panel {
        background: #161b22;
        border-color: rgba(255, 255, 255, 0.08);
    }
    .spotlight-search { border-bottom-color: #232a33; }
    .spotlight-input { color: #f1f5f9; }
    .spotlight-item.active,
    .spotlight-item:hover { background: rgba(16, 185, 129, 0.14); }
    .spotlight-item-title { color: #f1f5f9; }
    .spotlight-item-icon { background: rgba(16, 185, 129, 0.16); }
    .spotlight-hint-key,
    .spotlight-footer kbd { background: #232a33; border-color: #2d3640; color: #cbd5e1; }
    .spotlight-footer { border-top-color: #232a33; }
}

@media (prefers-reduced-motion: reduce) {
    .spotlight-overlay,
    .spotlight-panel,
    .spotlight-item-go {
        transition: none;
    }
}
