@charset "utf-8";

/* ==========================================================================
   Palette
   Light is the default. `html[data-theme="dark"]` is applied by
   assets/js/theme.js, and the values below are mirrored for readers whose OS
   asks for dark before they have made a choice.
   ========================================================================== */

:root {
    --page-bg: #f8f9fa;
    --surface: #ffffff;
    --surface-alt: #f1f3f5;
    --text: #212529;
    --text-muted: #6c757d;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: #dee2e6;
    --navbar-bg: rgba(255, 255, 255, 0.62);
    --link: #007bff;
    --link-hover: #0056b3;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.10);
    --gh-ring: #212529;
    --gh-cat: #ffffff;
    --code-bg: #f1f3f5;
    --highlight: #fff8e1;
    --highlight-border: #ffd54f;
}

html[data-theme="dark"] {
    --page-bg: #0d1117;
    --surface: #161b22;
    --surface-alt: #1c2129;
    --text: #e6edf3;
    --text-muted: #9aa5b1;
    --border: rgba(240, 246, 252, 0.10);
    --border-strong: #30363d;
    --navbar-bg: rgba(13, 17, 23, 0.72);
    --link: #6ea8ff;
    --link-hover: #9cc4ff;
    --shadow-sm: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.45);
    --shadow-md: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.55);
    --gh-ring: #e6edf3;
    --gh-cat: #161b22;
    --code-bg: #1c2129;
    --highlight: #2a2411;
    --highlight-border: #8a6d1f;
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
    font-family: "Lato", sans-serif;
    font-weight: 400;
    padding-top: 5.0rem;
    background-color: var(--page-bg);
    color: var(--text);
}

body.bg-light {
    background-color: var(--page-bg) !important;
}

a {
    color: var(--link);
}

a:hover {
    color: var(--link-hover);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 700;
    color: var(--text);
}

.card {
    border-radius: 0.8rem!important;
}

.card-img-overlay {
    border-radius: 0.8rem!important;
}

.rounded-xl {
    border-radius: 0.8rem!important;
}

.rounded-xl-bottom {
    border-bottom-right-radius: 0.8rem !important;
    border-bottom-left-radius: 0.8rem !important;
}

.rounded-xl-top {
    border-top-left-radius: 0.8rem !important;
    border-top-right-radius: 0.8rem !important;
}

.text-profile-position {
    font-weight: 400;
}

.text-profile-bio {
    /* font-family: "Raleway"; */
    font-weight: 400;
}

.inline-badge {
    height: 16px;
    vertical-align: -10%;
    margin-right: 2px;
    line-break: unset;
}

.no-break {
    white-space: nowrap;
}

.cover-image {
    width: 180px;
    max-height: 120px;
}

.abstract-body {
    min-height: 100px;
}

img.lazy {
    background-image: url('images/loading.gif');
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-size: 50px 50px;
    min-height: 80px;
}

div.lazy {
    background-image: url('images/loading.gif');
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-size: 50px 50px;
    min-height: 80px;
}

.badge-publication {
    font-size: 100%;
}

/* ==========================================================================
   Google Scholar citations
   ========================================================================== */

.citation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.05rem 0.55rem 0.05rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.7;
    white-space: nowrap;
    color: var(--link);
    background-color: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    vertical-align: 0.08em;
    transition: color 0.15s ease, background-color 0.15s ease,
                border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.citation-badge i {
    font-size: 0.9em;
    opacity: 0.9;
}

.citation-badge-text {
    font-weight: 400;
    color: var(--text-muted);
}

.citation-badge-count {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.citation-badge:hover,
.citation-badge:focus-visible {
    color: var(--link-hover);
    background-color: var(--surface);
    border-color: var(--link);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transform: translateY(-1px);
}

.citation-badge:hover .citation-badge-text,
.citation-badge:focus-visible .citation-badge-text {
    color: var(--text);
}

.scholar-summary {
    gap: 0.25rem 0.9rem;
    padding: 0.55rem 0.95rem;
    margin: 0.5rem 0 0.25rem;
    font-size: 0.9rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.scholar-summary-brand {
    font-weight: 700;
    color: var(--text);
}

.scholar-summary-brand:hover,
.scholar-summary-brand:focus {
    color: var(--link);
    text-decoration: none;
}

.scholar-summary-brand i {
    margin-right: 0.35rem;
    color: #4285f4;
}

html[data-theme="dark"] .scholar-summary-brand i {
    color: #8ab4f8;
}

.scholar-stat {
    color: var(--text-muted);
}

.scholar-stat b {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.scholar-summary-updated {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.85;
}

.email-text {
    font-family: Source Code Pro, monospace;
}

/* ==========================================================================
   Surfaces, borders and Bootstrap overrides (light + dark)
   ========================================================================== */

.card,
.bg-white,
.modal-content {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text);
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

hr {
    border-top-color: var(--border-strong);
}

.border-top,
.border-bottom,
.border,
.border-gray {
    border-color: var(--border-strong) !important;
}

.text-muted,
.text-muted a,
.small.text-muted {
    color: var(--text-muted) !important;
}

.text-body {
    color: var(--text) !important;
}

mark {
    background-color: var(--highlight);
    border-bottom: 1px solid var(--highlight-border);
    color: var(--text);
    padding: 0 2px;
}

code, kbd, pre, samp {
    background-color: var(--code-bg);
    color: var(--text);
}

pre {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    overflow-x: auto;
}

.form-control,
input,
textarea,
select {
    background-color: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-outline-secondary {
    color: var(--text);
    border-color: var(--border-strong);
}

.table {
    color: var(--text);
}

.alert-warning {
    background-color: var(--highlight);
    border-color: var(--highlight-border);
    color: var(--text);
}

.nav-pills .nav-link {
    color: var(--text-muted);
}

.nav-pills .nav-link.active {
    background-color: var(--link);
    color: #fff;
}

.footer {
    background-color: var(--surface) !important;
    border-top-color: var(--border-strong) !important;
}

.footer .text-muted {
    color: var(--text-muted) !important;
}

/* Publication / blog item on small screens: the overlay used to be hard-coded
   white, which is unreadable once the theme flips. */
.item-overlay-mobile {
    background-color: var(--surface) !important;
}

/* ==========================================================================
   Navbar + theme toggle
   ========================================================================== */

.navbar {
    background-color: var(--navbar-bg) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.navbar-light .navbar-brand,
.navbar-light .navbar-brand:hover {
    color: var(--text);
}

.navbar-light .navbar-nav .nav-link {
    color: var(--text-muted);
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link:focus {
    color: var(--text);
}

.navbar-light .navbar-nav .nav-item.active .nav-link {
    color: var(--link) !important;
    font-weight: 700;
}

.navbar-light .navbar-toggler {
    color: var(--text-muted);
    border-color: var(--border-strong);
}

.navbar-tools {
    flex: none;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

/* Pinned to the far right corner of the bar, outside the centred content
   column, so it never reads as another navigation item. */
.navbar > .theme-toggle {
    position: absolute;
    top: 0.75rem;
    right: 1.75rem;
}

/* On narrow screens the Menu button sits at the container's right edge, so keep
   the content clear of the corner control. */
@media (max-width: 575.98px) {
    .navbar > .container,
    .navbar > .container-lg,
    .navbar > .container-md,
    .navbar > .container-sm,
    .navbar > .container-xl {
        padding-right: 3.75rem;
    }

    .navbar > .theme-toggle {
        right: 0.75rem;
    }
}

.theme-toggle:hover,
.theme-toggle:focus {
    color: var(--text);
    border-color: var(--text-muted);
    background-color: var(--surface);
    outline: none;
}

.theme-toggle i {
    font-size: 0.85rem;
}

/* Light mode offers the moon (switch to dark); dark mode offers the sun. */
.theme-toggle .theme-toggle-sun {
    display: none;
}

html[data-theme="dark"] .theme-toggle .theme-toggle-moon {
    display: none;
}

html[data-theme="dark"] .theme-toggle .theme-toggle-sun {
    display: inline-block;
}

/* ==========================================================================
   Social logos
   ========================================================================== */

.social-link {
    display: inline-block;
    vertical-align: middle;
    text-decoration: none !important;
}

.social-icon {
    height: 1em;
    width: 1em;
    vertical-align: -0.125em;
    display: inline-block;
}

.social-icon-compact {
    height: 1.05em;
    width: 1.05em;
}

/* GitHub: the official mark, filled with the current text colour. The cat is a
   cut-out, so it always shows the card behind it: dark badge with a light cat
   in light mode, and the reverse in dark mode. */
.social-icon-github {
    fill: var(--gh-ring);
}

.social-link-github {
    color: var(--gh-ring);
}

/* LinkedIn and ORCID keep their official brand colours in both themes. */
.social-link-linkedin,
.social-link-linkedin:hover {
    color: #0a66c2;
}

.social-link-orcid,
.social-link-orcid:hover {
    color: #a6ce39;
}

.social-row .social-link {
    margin: 0 0.25rem;
}

/* ==========================================================================
   Portrait
   ========================================================================== */

.portrait-round {
    width: 100%;
    max-width: 230px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center 22%;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    display: inline-block;
}

/* ==========================================================================
   Project showcase
   ========================================================================== */

.project-item + .project-item {
    border-top: 1px solid var(--border-strong);
}

.project-figure {
    overflow: hidden;
    border-radius: 0.6rem;
    background-color: #ffffff;
    border: 1px solid var(--border);
}

.project-figure img {
    display: block;
    width: 100%;
    height: auto;
}

/* A figure lifted from a paper or notebook keeps its own white page, so give it
   an explicit matte instead of letting it float on the dark surface. */
.project-figure-detail {
    max-width: 800px;
}

.project-tags {
    margin: 0.35rem 0 0.5rem;
}

.project-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    background-color: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    margin: 0 0.25rem 0.25rem 0;
}

.project-tag-primary {
    color: #fff;
    background-color: var(--link);
    border-color: var(--link);
}

.project-metrics {
    margin: 0.5rem 0 0.5rem;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.project-metrics li {
    margin-bottom: 0.1rem;
}

.project-metrics i {
    width: 1rem;
    color: var(--link);
}

.project-links {
    font-size: 0.9rem;
}

.project-links a {
    margin-right: 0.85rem;
    white-space: nowrap;
}

.project-summary {
    color: var(--text-muted);
}

/* ==========================================================================
   News
   ========================================================================== */

.news-flag {
    color: var(--highlight-border);
    margin-right: 0.35rem;
}

html[data-theme="dark"] .news-flag {
    color: #e3b341;
}

.news-item-highlight {
    font-weight: 700;
}

/* Publication links (Paper / arXiv / Code ...): bold and blue so they read
   as links at a glance, on every screen size. */
.abstract-links a {
    font-weight: 700;
    color: var(--link) !important;
    text-decoration: none;
}

.abstract-links a:hover,
.abstract-links a:focus {
    color: var(--link-hover) !important;
    text-decoration: underline;
}

/* ==========================================================================
   Mobile refinements
   The desktop grid is dense; on phones the same content needs breathing room,
   readable tap targets, and long abstracts kept short until asked for.
   ========================================================================== */

@media (max-width: 767.98px) {
    /* --- Publications ------------------------------------------------- */

    /* Collapsed abstract, expanded by assets/js/pub_abstract.js. */
    .pub-abstract.is-collapsed {
        display: -webkit-box;
        -webkit-line-clamp: 5;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .pub-abstract-toggle {
        display: inline-block;
        margin: 0.35rem 0 0;
        padding: 0.22rem 0.7rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--link);
        background-color: var(--surface-alt);
        border: 1px solid var(--border);
        border-radius: 999px;
        cursor: pointer;
    }

    .pub-abstract-toggle:hover,
    .pub-abstract-toggle:focus-visible {
        color: var(--link-hover);
        background-color: var(--surface);
        border-color: var(--link);
        outline: none;
    }

    /* Link labels become comfortable tap targets instead of tiny [text]. */
    .abstract-links a {
        display: inline-block;
        margin: 0.35rem 0.35rem 0 0;
        padding: 0.28rem 0.7rem;
        font-size: 0.78rem;
        font-weight: 600;
        color: var(--link);
        background-color: var(--surface-alt);
        border: 1px solid var(--border);
        border-radius: 999px;
        text-decoration: none;
    }

    .abstract-links a:hover,
    .abstract-links a:focus {
        color: var(--link-hover);
        background-color: var(--surface);
        border-color: var(--link);
        text-decoration: none;
    }

    .citation-badge {
        margin-top: 0.25rem;
    }

    /* --- News timeline ------------------------------------------------- */

    /* Stack the year above its entries rather than stealing width from them. */
    .news-card .media {
        display: block;
    }

    .news-card .media > .mr-3 {
        margin: 0 0 0.35rem !important;
        font-weight: 700;
        color: var(--text);
    }

    .news-card .media-body .my-1 {
        flex-direction: column;
    }

    .news-card .media-body .my-1 > .ml-auto {
        margin-left: 0 !important;
        margin-top: 0.1rem;
    }

    /* --- Publication cards: keep long titles and metadata readable ----- */

    .item-overlay-mobile .d-flex {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* --- Long chart/image thumbnails stay inside the card ------------- */

    .project-item img,
    .item-overlay-mobile img {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 767.98px) {
    /* Education / experience: put the date on its own line instead of
       letting it crowd the degree or role. */
    .card-body .small.d-flex {
        flex-direction: column;
    }

    .card-body .small.d-flex > .ml-auto {
        margin-left: 0 !important;
        margin-top: 0.15rem;
    }
}
