/* ===================================================================
   Shared stylesheet — search / information-retrieval themed
   =================================================================== */

:root {
    --text-dark: #16181d;
    --text-medium: #444852;
    --text-light: #6b7280;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.08);
    --accent-ring: rgba(37, 99, 235, 0.18);
    --border: #e5e7eb;
    --bg: #ffffff;
    --bg-subtle: #f8fafc;
    --mark-bg: #dbeafe;
    --mark-text: #1d4ed8;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
    --sans: "Segoe UI", Calibri, Candara, Optima, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    line-height: 1.55;
    color: var(--text-dark);
    background: var(--bg);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent);
    color: #fff;
}

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 16px 40px;
    position: relative;
    z-index: 1;
}

.retrieve-stats {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 6px;
    margin-bottom: 4px;
}

.retrieve-stats strong {
    color: var(--accent);
    font-weight: 650;
}

.retrieve-stats em {
    color: var(--text-medium);
    font-style: normal;
}

/* Search highlights */
.query-hit,
.hl {
    background-color: var(--mark-bg);
    color: var(--mark-text);
    border-radius: 3px;
    padding: 0 2px;
    box-shadow: inset 0 -2px 0 var(--accent-ring);
    transition: background-color 0.35s ease, color 0.35s ease;
}

.about-text p {
    border-left: 2px solid transparent;
    padding-left: 10px;
    margin-left: -12px;
    transition: border-color 0.45s ease;
}

.about-text p.is-retrieved,
.update.is-retrieved {
    border-left-color: var(--accent-ring);
}

.about-text p.is-top,
.update.is-top {
    border-left-color: var(--accent);
}

.update-date[data-rank]::after {
    content: ' · rank #' attr(data-rank);
    color: var(--accent);
    font-weight: 650;
}

.about-text p.is-top[data-rank]::before {
    content: 'rank #' attr(data-rank) ' · ';
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 650;
    margin-right: 2px;
}

/* ------------------------------------------------------------------
   Header / navigation
   ------------------------------------------------------------------ */

.header {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.tagline {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text-medium);
    margin-bottom: 16px;
}

.tagline .prompt {
    color: var(--accent);
    font-weight: 700;
}

.tagline::after,
#query-typer::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 0.95em;
    background: var(--accent);
    margin-left: 3px;
    vertical-align: text-bottom;
    animation: blink 1.1s steps(2, start) infinite;
}

/* When the typewriter is present, the cursor lives inside the quotes. */
.tagline:has(#query-typer)::after {
    display: none;
}

@keyframes blink {
    50% { opacity: 0; }
}

.navigation {
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.navigation a {
    font-family: var(--mono);
    color: var(--text-medium);
    text-decoration: none;
    font-size: 0.83rem;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.navigation a:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.navigation a.active {
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-color: var(--accent-ring);
    font-weight: 600;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.contact-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.05rem;
    transition: color 0.15s ease, transform 0.15s ease;
}

.contact-links a:hover {
    color: var(--accent);
    transform: translateY(-1px);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--text-dark);
}

/* ------------------------------------------------------------------
   Sections
   ------------------------------------------------------------------ */

.content {
    display: grid;
    gap: 28px;
}

.section {
    opacity: 0;
    transform: translateY(8px);
    animation: fadeIn 0.35s ease forwards;
}

.section + .section,
.about-updates-grid .section:last-child {
    animation-delay: 0.08s;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-family: var(--mono);
    font-size: 1.05rem;
    font-weight: 650;
    margin-bottom: 14px;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    letter-spacing: -0.01em;
}

.section-title::before {
    content: '/';
    color: var(--accent);
    margin-right: 1px;
}

/* ------------------------------------------------------------------
   About / updates (index)
   ------------------------------------------------------------------ */

.about-updates-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 36px;
    align-items: start;
}

.about-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 24px;
    align-items: start;
}

.profile-image {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.about-text p {
    margin-bottom: 10px;
}

.about-text p a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
    transition: border-bottom-style 0.15s ease;
}

.about-text p a:hover {
    border-bottom-style: solid;
}

.research-interests {
    margin-top: 14px;
}

.research-interests h4 {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 650;
    margin-bottom: 8px;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.interests-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.interest-tag {
    font-family: var(--mono);
    background: var(--bg-subtle);
    color: var(--text-medium);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    border: 1px solid var(--border);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

button.interest-tag {
    appearance: none;
    cursor: pointer;
}

.interest-tag[data-query]:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.interest-tag.is-active-query {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 600;
}

.updates-list {
    display: grid;
    gap: 10px;
    counter-reset: update-rank;
}

.update {
    padding: 8px 0 8px 10px;
    margin-left: -12px;
    border-left: 2px solid transparent;
    border-bottom: 1px solid var(--border);
    counter-increment: update-rank;
    transition: transform 0.15s ease, border-color 0.45s ease;
}

.update:hover {
    transform: translateX(3px);
}

.update .update-date::before {
    content: 'doc #' counter(update-rank) ' \00b7 ';
    color: var(--text-light);
    font-weight: 500;
}

.update:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.update-date {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 0.72rem;
    margin-bottom: 3px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.update-text {
    color: var(--text-medium);
    font-size: 0.92rem;
}

.update-text strong {
    font-weight: 500;
    color: var(--text-dark);
}

.update-text a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
    transition: border-bottom-style 0.15s ease;
}

.update-text a:hover {
    border-bottom-style: solid;
}

/* ------------------------------------------------------------------
   Publications: search panel
   ------------------------------------------------------------------ */

.search-panel {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-light);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--text-dark);
    padding: 11px 64px 11px 40px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.search-kbd {
    position: absolute;
    right: 12px;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-light);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 1px 7px;
    background: var(--bg-subtle);
    pointer-events: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.chip {
    appearance: none;
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 550;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-medium);
    cursor: pointer;
    transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.result-stats {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--text-light);
    margin-top: 10px;
}

.result-stats strong {
    color: var(--accent);
    font-weight: 650;
}

.empty-state {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
    padding: 48px 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.empty-state .empty-code {
    display: block;
    color: var(--accent);
    font-weight: 650;
    margin-bottom: 6px;
}

/* ------------------------------------------------------------------
   Publications: results list
   ------------------------------------------------------------------ */

.publications-list {
    display: grid;
    gap: 4px;
}

.year-group.is-hidden {
    display: none;
}

.year-divider {
    font-family: var(--mono);
    margin: 14px 0 4px;
    color: var(--text-dark);
    font-weight: 650;
    font-size: 0.95rem;
}

.year-divider::before {
    content: '##';
    color: var(--accent);
    margin-right: 6px;
    font-weight: 700;
}

.publication {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
    align-items: start;
    padding: 16px 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 10px;
    transition: background 0.15s ease;
}

.publication:hover {
    background: var(--bg-subtle);
    border-bottom-color: transparent;
}

.publication.is-hidden {
    display: none;
}

.pub-media {
    cursor: zoom-in;
}

.pub-media img,
.pub-media video {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: cover;
    display: block;
}

.pub-details {
    display: flex;
    flex-direction: column;
}

.pub-title {
    font-weight: 650;
    margin-bottom: 4px;
    line-height: 1.35;
    font-size: 1rem;
}

.pub-title a {
    color: var(--accent);
    text-decoration: none;
}

.pub-title a:hover {
    text-decoration: underline;
}

.pub-authors {
    color: var(--text-medium);
    margin-bottom: 4px;
    font-size: 0.88rem;
}

.pub-authors--compact {
    line-height: 1.55;
}

.pub-venue {
    color: var(--text-light);
    font-size: 0.84rem;
    font-style: italic;
}

.pub-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.pub-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    font-size: 0.7rem;
    font-weight: 650;
    font-family: var(--mono);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tag--published {
    background: #e0f2fe;
    color: #0c4a6e;
    border-color: #bae6fd;
}

.tag--preprint {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.tag--award {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde047;
}

.tag--oral {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.cat-tag {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 550;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    border: 1px solid var(--accent-ring);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.cat-tag:hover {
    background: var(--accent);
    color: #fff;
}

/* Abstract toggle */

.pub-abstract-toggle {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--accent);
    cursor: pointer;
    display: inline-block;
    margin-top: 8px;
    font-weight: 650;
}

.pub-abstract-toggle::before {
    content: '+ ';
}

.pub-abstract-toggle.open::before {
    content: '\2212\00a0';
}

.pub-abstract-toggle:hover {
    text-decoration: underline;
}

.pub-abstract-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease, margin-top 0.25s ease;
    margin-top: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-medium);
}

.pub-abstract-content p {
    overflow: hidden;
    margin-bottom: 0;
}

.pub-abstract-content.expanded {
    grid-template-rows: 1fr;
    margin-top: 8px;
}

/* Author ellipsis reveal */

.author-reveal {
    display: none;
    opacity: 0;
}

.author-reveal.is-visible {
    display: inline;
    animation: authorFadeIn 0.3s ease both;
    opacity: 1;
}

@keyframes authorFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.author-ellipsis {
    appearance: none;
    background: var(--accent-soft);
    border: 1px solid var(--accent-ring);
    border-radius: 999px;
    color: var(--accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 700;
    line-height: 1;
    margin: 0 3px;
    padding: 1px 8px 4px;
    transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.author-ellipsis:hover {
    background: rgba(37, 99, 235, 0.14);
    transform: translateY(-1px);
}

.author-ellipsis.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92);
    width: 0;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    border-width: 0;
}

/* ------------------------------------------------------------------
   Lightbox
   ------------------------------------------------------------------ */

.lightbox {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.lightbox-content img,
.lightbox-content video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 85vh;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: 8px;
    color: #f1f1f1;
    font-size: 38px;
    font-weight: bold;
    transition: color 0.2s ease;
    cursor: pointer;
    z-index: 1001;
    font-family: var(--mono);
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
}

body.lightbox-active {
    overflow: hidden;
}

/* ------------------------------------------------------------------
   Blog list
   ------------------------------------------------------------------ */

.blog-list {
    display: grid;
    gap: 16px;
}

.blog-item {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.blog-item:hover {
    border-color: var(--accent);
    background: var(--bg-subtle);
    transform: translateY(-2px);
}

.blog-date {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--accent);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.blog-title {
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.blog-description {
    font-size: 0.92rem;
    color: var(--text-medium);
    line-height: 1.45;
}

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */

.site-footer {
    margin-top: 40px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-light);
}

.site-footer .prompt {
    color: var(--accent);
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */

@media (max-width: 768px) {
    .container {
        padding: 20px 14px 32px;
    }

    .header h1 {
        font-size: 1.7rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 18px;
        text-align: center;
    }

    .about-updates-grid {
        grid-template-columns: 1fr;
    }

    .profile-image {
        max-width: 140px;
        margin: 0 auto;
    }

    .interests-list,
    .about-grid .research-interests .interests-list {
        justify-content: center;
    }

    .publication {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pub-media {
        max-width: 240px;
        margin: 0 auto;
    }

    .search-kbd {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
