/* Site-wide nav search. Injected by site-search.js into the top nav of every page. */

.site-search {
    position: relative;
    flex: 0 1 320px;
    min-width: 180px;
    margin-left: auto;
}

.site-search-form {
    display: flex;
    align-items: center;
    gap: 0;
}

.site-search-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid #ccd6e0;
    border-radius: 999px;
    padding: 8px 16px 8px 38px;
    font: inherit;
    font-size: 0.95em;
    color: #333;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
    background-size: 16px 16px;
    -webkit-appearance: none;
    appearance: none;
}

.site-search-input:focus {
    outline: 2px solid rgba(26, 115, 232, 0.25);
    border-color: #1a73e8;
}

.site-search-input::-webkit-search-cancel-button { cursor: pointer; }

.site-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(460px, calc(100vw - 32px));
    max-height: min(70vh, 560px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dbe6f4;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    z-index: 200;
    padding: 6px;
    display: none;
    text-align: left;
}

.site-search-panel.open { display: block; }

.site-search-group {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8a94a6;
    padding: 10px 12px 4px;
}

a.site-search-hit {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    border-bottom: 0;
}

a.site-search-hit:hover,
a.site-search-hit.active {
    background: #e8f0fe;
    text-decoration: none;
}

.site-search-hit-title {
    color: #1a73e8;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.35;
}

.site-search-hit-meta {
    color: #666;
    font-size: 0.85em;
    line-height: 1.45;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-search-hit mark {
    background: #fff3c4;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.site-search-empty,
.site-search-status {
    padding: 14px 12px;
    color: #666;
    font-size: 0.92em;
}

a.site-search-all {
    display: block;
    margin-top: 4px;
    padding: 11px 12px;
    border-top: 1px solid #eef2f7;
    color: #1a73e8;
    font-weight: 600;
    font-size: 0.92em;
    text-decoration: none;
    text-align: center;
    border-radius: 0 0 8px 8px;
}

a.site-search-all:hover { background: #f5f9ff; text-decoration: none; }

/* The publications page header is a centered button row rather than a sticky nav. */
.nav-buttons .site-search {
    flex: 0 1 320px;
    margin-left: 0;
}

.nav-buttons .site-search-panel {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 780px) {
    .site-search {
        flex: 1 1 100%;
        margin-left: 0;
        order: 3;
    }
    .site-search-panel {
        right: auto;
        left: 0;
        width: 100%;
    }
    .nav-buttons .site-search-panel {
        left: 0;
        transform: none;
    }
}

/* Landing highlight, so a jump-to result is obvious on arrival. */
.publication-item:target,
.presentation-item:target,
.project:target {
    animation: site-search-flash 2.4s ease-out 1;
}

@keyframes site-search-flash {
    0%, 55% { box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.55); }
    100% { box-shadow: 0 0 0 3px rgba(26, 115, 232, 0); }
}

.publication-item,
.presentation-item {
    scroll-margin-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
    .publication-item:target,
    .presentation-item:target,
    .project:target { animation: none; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.45); }
}
