/* ═══════════════════════════════════════════════════════════════
   SEARCH — Digital Rust
   ═══════════════════════════════════════════════════════════════ */

.search-container { margin: var(--dr-space-xs) 0 0 0; padding: 0 4px; }

.search-box {
    width: 100%;
    padding: var(--dr-space-sm) var(--dr-space-sm);
    border: 2px solid var(--dr-surface-highlight);
    border-radius: var(--dr-radius);
    background: var(--dr-surface-base);
    color: var(--dr-text-primary);
    font-size: var(--dr-text-sm);
    font-family: var(--dr-font-body);
    transition: all var(--dr-transition-fast);
    box-sizing: border-box;
}

.search-box:focus {
    outline: none;
    border-color: var(--dr-accent);
    box-shadow: 0 0 0 2px rgba(var(--dr-accent-rgb), 0.2);
}

.search-box::placeholder { color: var(--dr-text-tertiary); font-style: italic; }

/* Search results panel */
.search-results {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    bottom: 0;
    background: var(--bg-color);
    z-index: 1000;
    max-width: var(--content-max-width);
    width: calc(100% - var(--sidebar-width));
    padding: var(--dr-space-xl) 3rem;
    overflow-y: auto;
    display: none;
    animation: dr-search-slide 0.25s var(--dr-ease-out-expo);
    box-sizing: border-box;
}

.search-results.active { display: block; }

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--dr-space-lg);
    padding-bottom: var(--dr-space-md);
    border-bottom: var(--dr-border-subtle);
    position: relative;
}

.search-results-title {
    font-size: var(--dr-text-xl);
    font-family: var(--dr-font-heading);
    font-weight: var(--dr-font-weight);
    flex: 1;
    text-align: center;
    padding: 0 40px;
}

.search-actions { display: flex; align-items: center; gap: 8px; }

.search-close {
    padding: var(--dr-space-sm);
    background: none;
    border: 2px solid transparent;
    border-radius: var(--dr-radius);
    cursor: pointer;
    color: var(--dr-text-primary);
    transition: all var(--dr-transition-fast);
}

[dir="rtl"] .search-close { right: auto; left: 0; }

.search-close svg, .return-to-search svg { width: 24px; height: 24px; fill: currentColor; }

.search-close:hover, .return-to-search:hover {
    background: var(--dr-surface-highlight);
    border-color: var(--dr-dark-packet);
}

.search-result-item {
    margin-bottom: var(--dr-space-lg);
    padding-bottom: var(--dr-space-lg);
    border-bottom: var(--dr-border-subtle);
}

.search-result-title {
    font-size: var(--dr-text-lg);
    font-weight: var(--dr-font-weight);
    margin-bottom: 8px;
    color: var(--dr-text-link);
    text-decoration: underline;
    text-decoration-color: var(--dr-phantom-current);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    line-height: 1.4;
    display: inline-block;
}

.search-result-title:hover { text-decoration-thickness: 2px; }

.search-result-path {
    font-size: var(--dr-text-xs);
    font-family: var(--dr-font-mono);
    color: var(--dr-text-tertiary);
    margin-bottom: 8px;
    word-break: break-all;
}

.search-result-excerpt {
    font-size: var(--dr-text-sm);
    line-height: 1.6;
    color: var(--dr-text-secondary);
    word-wrap: break-word;
}

.search-result-highlight {
    background: var(--dr-stack-overglow);
    color: var(--dr-horizon);
    padding: 1px 4px;
    margin: 0 2px;
    border-radius: var(--dr-radius-sm);
    font-weight: 600;
    display: inline-block;
}

[data-theme="light"] .search-result-highlight {
    background-color: var(--dr-stack-overglow-bright);
    color: var(--dr-text-primary);
}

@keyframes dr-search-slide {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Mobile */
@media (max-width: 950px) {
    .search-results {
        left: 0; padding: var(--dr-space-md); padding-top: 60px; width: 100%;
    }

    .search-results-header {
        position: fixed; top: 0; left: 0; right: 0;
        background: var(--bg-color); padding: var(--dr-space-md); z-index: 1001;
        height: 48px; box-sizing: border-box; margin-bottom: 0;
    }

    .search-result-item { padding-bottom: var(--dr-space-md); margin-bottom: var(--dr-space-md); }
    .search-result-title { font-size: var(--dr-text-base); line-height: 1.5; }
    .search-result-excerpt { line-height: 1.5; }
}
