html {
    /* Prevent in-page anchor targets from being hidden under the sticky navbar */
    scroll-padding-top: 90px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Reset */
:root {
    /* Scholarly Minimalism Color Palette */
    --bg-color: #FDFBF7;           /* Warm off-white (paper-like) */
    --text-color: #1C1C1E;         /* Deep charcoal */
    --heading-color: #1C1C1E;      /* Deep charcoal */
    --card-bg: #FFFFFF;
    --nav-bg: #1E3A5F;             /* Scholarly navy */
    --nav-text: #F5F5F5;
    --nav-hover: #B8860B;          /* Muted gold */
    --link-color: #1E3A5F;         /* Scholarly navy */
    --link-hover: #B8860B;         /* Muted gold */
    --border-color: #E8E4DD;
    --muted-text: #5C5C5E;
    --btn-border: #D4D0C8;
    --btn-bg: #FFFFFF;
    --btn-hover-bg: #F8F6F2;
    --accent: #1E3A5F;             /* Scholarly navy */
    --accent-secondary: #B8860B;   /* Muted gold */
    --accent-light: rgba(30, 58, 95, 0.08);
    --scrollbar-track: #F5F3EF;
    --scrollbar-thumb: #C8C4BC;
    --scrollbar-thumb-hover: #A8A49C;
}

[data-theme="dark"] {
    --bg-color: #0D1117;           /* Deep slate */
    --text-color: #E6E1D9;         /* Soft warm white */
    --heading-color: #F5F3EF;
    --card-bg: #161B22;
    --nav-bg: #0D1117;
    --nav-text: #E6E1D9;
    --nav-hover: #D4A84B;          /* Brighter gold for dark mode */
    --link-color: #7BA3C9;         /* Softer blue for dark mode */
    --link-hover: #D4A84B;
    --border-color: #30363D;
    --muted-text: #8B949E;
    --btn-border: #30363D;
    --btn-bg: #21262D;
    --btn-hover-bg: #30363D;
    --accent: #7BA3C9;
    --accent-secondary: #D4A84B;
    --accent-light: rgba(123, 163, 201, 0.12);
    --scrollbar-track: #161B22;
    --scrollbar-thumb: #30363D;
    --scrollbar-thumb-hover: #484F58;
}

body, h1, h2, h3, p {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.75;
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 1rem;
    transition: color 0.3s ease;
    letter-spacing: 0.01em;
}

/* Basic Styles */
.navbar {
    background-color: var(--nav-bg);
    color: var(--nav-text);
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    border: none;
    border-radius: 0;
    margin-bottom: 50px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 0.6rem 1.5rem;
    backdrop-filter: blur(10px);
}

/* Style for navbar links */
.navbar-nav .nav-item {
    list-style-type: none;
}

.navbar-nav .nav-link {
    color: var(--nav-text) !important;
    padding: 12px 16px !important;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: color 0.2s ease, opacity 0.2s ease;
    opacity: 0.85;
}

/* On Hover */
.navbar-nav .nav-link:hover {
    background-color: transparent;
    color: var(--nav-hover) !important;
    opacity: 1;
}

/* Container */
.container {
    max-width: 1300px;
    margin: auto;
    padding: 0 20px;
}

/* Masonry Gallery Layout - Reverted to Scroll with Filters */
.imgGallery-row {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 15px; /* Space for scrollbar */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
}

/* Custom Scrollbar */
.imgGallery-row::-webkit-scrollbar {
    height: 8px;
}

.imgGallery-row::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
}

.imgGallery-row::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.imgGallery-row::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.imgGallery-column {
    flex: 0 0 300px; /* Fixed width for each image card */
    max-width: 300px;
    padding: 0;
    box-sizing: border-box;
    display: block; /* Default to block for visibility */
}

.imgGallery-column img {
    width: 100%;
    height: 200px; /* Fixed height for uniformity */
    object-fit: cover; /* Crop image to fit */
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    transition: transform .3s ease-in-out, box-shadow .3s ease, border-color .3s ease;
    display: block;
}

.imgGallery-column img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--accent-secondary);
    cursor: pointer;
}

/* Photo Filter Buttons */
.photo-filter-container {
    text-align: center;
    margin-bottom: 24px;
}

.photo-filter-btn {
    display: inline-block;
    padding: 8px 18px;
    margin: 4px;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-text);
    background-color: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.photo-filter-btn:hover {
    background-color: var(--btn-hover-bg);
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

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

/* Back to Top Button */
#backToTop {
    display: none;
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 99;
    border: 1px solid var(--border-color);
    outline: none;
    background-color: var(--card-bg);
    color: var(--accent);
    cursor: pointer;
    padding: 14px;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.25s ease;
    width: 46px;
    height: 46px;
    text-align: center;
    line-height: 18px;
}

#backToTop:hover {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.imgGallery-section-title {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.2rem;
    font-weight: 500;
    text-align: left;
    color: var(--heading-color);
    margin-top: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

.company-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
}

.company-header img {
    width: 48px;
    height: auto;
    object-fit: contain;
    opacity: 0.9;
}

.company-title {
    margin: 0;
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--heading-color);
    letter-spacing: 0.01em;
}

.location-time {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    color: var(--muted-text);
    font-size: 13px;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.position-advisors {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 16px;
    font-size: 15px;
}

.project-list {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    margin-top: 16px;
    text-align: justify;
    padding-left: 20px;
    line-height: 1.7;
}

.project-list li {
    margin-bottom: 14px;
}

.publication-img {
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-right: 20px;
    border: 1px solid var(--border-color);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background-color: #FFFFFF;
}

.publication-img:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.justified-text {
    text-align: justify;
}

/* Link Styles */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Underline links in body text for better accessibility */
.project-list a,
.updates-card a {
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
}

.project-list a:hover,
.updates-card a:hover {
    border-bottom-color: var(--accent-secondary);
}

/* Filter Buttons */
.filter-container {
    text-align: center;
    margin-bottom: 32px;
}

.filter-btn {
    display: inline-block;
    padding: 10px 22px;
    margin: 5px;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-text);
    background-color: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.filter-btn:hover {
    background-color: var(--btn-hover-bg);
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.filter-btn.active {
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--accent-light);
}

/* Button/Link Badges */
.pub-link {
    display: inline-block;
    padding: 6px 14px;
    margin: 4px 6px 4px 0;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pub-link:hover {
    background-color: var(--accent);
    color: white !important;
    border-color: var(--accent);
    text-decoration: none;
    box-shadow: 0 2px 6px var(--accent-light);
}

.pub-link.disabled {
    color: var(--muted-text);
    border-color: var(--border-color);
    cursor: default;
    pointer-events: none;
    opacity: 0.6;
}

.pub-link.disabled:hover {
    background-color: transparent;
    color: var(--muted-text) !important;
    box-shadow: none;
    transform: none;
}

.pub-link i {
    margin-right: 4px;
}

/* Publication text spacing */
.pub-list .custom-col-text p {
    margin-bottom: 0.5rem;
}

.pub-list .custom-col-text p.justified-text {
    margin-top: 0.8rem;
}

/* Publication item styling */
.publication-item {
    border-radius: 6px;
}

/* First author emphasis - underlined bold name */
.pub-list .custom-col-text u b {
    color: var(--heading-color);
}

/* Publication title styling */
.pub-list .custom-col-text > p:first-child b {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--heading-color);
}

/* Default (Mobile First) */
.custom-col-img,
.custom-col-text {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Wider screens (768px+) */
@media screen and (min-width: 768px) {
    .custom-col-img {
        flex: 0 0 45%;
        max-width: 45%;
    }

    .custom-col-text {
        flex: 0 0 55%;
        max-width: 55%;
        padding-left: 20px;
        text-align: justify;
    }
}

/* Small screens */
@media screen and (max-width: 767px) {
    .custom-col-img {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 20px;
    }

    .custom-col-text {
        flex: 0 0 100%;
        max-width: 100%;
        text-align: justify;
    }
}

ul.vert {
    padding: 0;
    background-color: transparent;
    list-style-type: none;
}

ul.vert > li {
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 32px;
    margin-bottom: 28px;
    list-style-type: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

ul.vert > li:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: var(--accent);
}

/* Header Refinements */
h2 {
    border-bottom: 2px solid var(--accent-secondary);
    padding-bottom: 12px;
    margin-top: 60px;
    margin-bottom: 36px;
    font-weight: 500;
    font-size: 2rem;
    color: var(--heading-color);
    display: inline-block;
    letter-spacing: 0.02em;
}

p {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    line-height: 1.75em;
}


/* Refinements for Profile and Mobile */
.profile-name {
    font-size: 1.8rem;
    color: var(--heading-color);
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.profile-subtitle {
    font-size: 11px;
    color: var(--muted-text);
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    margin-top: 12px;
    line-height: 1.6;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

/* Profile photo styling */
.profile-photo {
    max-width: 90%;
    height: auto;
    border-radius: 8px;
    border: 3px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    margin-top: 16px;
}

.profile-photo:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .profile-name {
        font-size: 1.5rem;
    }

    .justified-text {
        text-align: left;
    }
}

/* Social Icons */
.social-icons {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.social-icons a {
    font-size: 16px;
    color: var(--muted-text);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

.social-icons a:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Hero Section */
#about {
    position: relative;
    padding: 40px 0;
    margin-bottom: 50px;
}

.profile-column {
    text-align: center;
}

.bio-column {
    padding-left: 30px;
}

@media (max-width: 768px) {
    .bio-column {
        padding-left: 15px;
    }
}

/* Recent Updates Card */
.updates-card {
    margin-top: 3%;
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-secondary);
}

.updates-card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 600;
    color: var(--heading-color);
    letter-spacing: 0.02em;
}

.updates-card ul {
    margin-bottom: 0;
    padding-left: 20px;
}

.updates-card li {
    margin-bottom: 8px;
}

.updates-card li:last-child {
    margin-bottom: 0;
}

/* Section Spacing */
.bio-text {
    margin-top: 3%;
    text-align: justify;
    font-size: 15px;
    line-height: 1.8;
}

.bio-text strong {
    color: var(--heading-color);
    font-weight: 600;
}

.bio-text a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.bio-text a:hover {
    color: var(--accent-secondary);
    border-bottom-color: var(--accent-secondary);
}

/* ========================================
   Scroll-triggered Fade-in Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    opacity: 0;
}

.fade-in-up.visible {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger delays for children */
.fade-in-up.visible:nth-child(1) { animation-delay: 0s; }
.fade-in-up.visible:nth-child(2) { animation-delay: 0.08s; }
.fade-in-up.visible:nth-child(3) { animation-delay: 0.16s; }
.fade-in-up.visible:nth-child(4) { animation-delay: 0.24s; }
.fade-in-up.visible:nth-child(5) { animation-delay: 0.32s; }
.fade-in-up.visible:nth-child(6) { animation-delay: 0.4s; }

/* ========================================
   Photography Gallery — Masonry Grid
   ======================================== */
.imgGallery-masonry {
    columns: 4 240px;
    column-gap: 16px;
}

.imgGallery-masonry .imgGallery-column {
    flex: none;
    max-width: 100%;
    break-inside: avoid;
    margin-bottom: 16px;
    display: inline-block;
    width: 100%;
}

.imgGallery-masonry .imgGallery-column img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    transition: transform .3s ease-in-out, box-shadow .3s ease, border-color .3s ease;
    display: block;
}

.imgGallery-masonry .imgGallery-column img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--accent-secondary);
    cursor: pointer;
}

@media (max-width: 600px) {
    .imgGallery-masonry {
        columns: 2 150px;
    }
}

/* ========================================
   Publication Venue Badges
   ======================================== */
.venue-badge {
    display: inline-block;
    padding: 5px 12px;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background-color: var(--accent-light);
    border-radius: 4px;
    letter-spacing: 0.05em;
    vertical-align: middle;
    text-transform: uppercase;
    border: 1px solid rgba(30, 58, 95, 0.15);
}

[data-theme="dark"] .venue-badge {
    border-color: rgba(123, 163, 201, 0.2);
}

.venue-badge.oral {
    color: #8B4513;
    background-color: rgba(184, 134, 11, 0.12);
    border-color: rgba(184, 134, 11, 0.25);
}

/* Collapsible Abstract */
.abstract-toggle {
    display: inline-block;
    padding: 5px 14px;
    margin-top: 8px;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-text);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.abstract-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background-color: var(--accent-light);
}

.abstract-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
    opacity: 0;
    margin-top: 12px;
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
}

.abstract-content.expanded {
    max-height: 2000px;
    opacity: 1;
}

/* ========================================
   Teaching & Service Sections
   ======================================== */
.info-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.info-row-icon {
    font-size: 18px;
    margin-top: 4px;
    flex-shrink: 0;
    opacity: 0.85;
}

.info-row-icon.teaching { color: var(--accent-secondary); }
.info-row-icon.award { color: var(--accent-secondary); }
.info-row-icon.conf-review { color: var(--accent); }
.info-row-icon.journal-review { color: var(--accent); }

[data-theme="dark"] .info-row-icon.teaching { color: var(--accent-secondary); }
[data-theme="dark"] .info-row-icon.award { color: var(--accent-secondary); }

.info-row-title {
    margin-bottom: 4px;
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-color);
    letter-spacing: 0.01em;
}

.info-row-subtitle {
    margin-bottom: 4px;
    color: var(--muted-text);
    font-size: 13px;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
}

.info-row-detail {
    color: var(--heading-color);
    font-size: 14px;
}

.info-row-inline {
    color: var(--text-color);
    line-height: 1.7;
    font-size: 14px;
}

/* ========================================
   Text Selection
   ======================================== */
::selection {
    background-color: rgba(30, 58, 95, 0.15);
    color: var(--heading-color);
}

[data-theme="dark"] ::selection {
    background-color: rgba(212, 168, 75, 0.25);
    color: var(--heading-color);
}

/* ========================================
   Focus States for Accessibility
   ======================================== */
a:focus-visible,
button:focus-visible,
.filter-btn:focus-visible,
.photo-filter-btn:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
    text-align: center;
    padding: 48px 24px 36px;
    margin-top: 80px;
    border-top: 1px solid var(--border-color);
    color: var(--muted-text);
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 0.8rem;
    background-color: var(--bg-color);
    letter-spacing: 0.02em;
}

.site-footer .footer-links {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 28px;
    flex-wrap: wrap;
}

.site-footer .footer-links a {
    color: var(--muted-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color 0.2s;
}

.site-footer .footer-links a:hover {
    color: var(--accent-secondary);
}

.site-footer .footer-social {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 18px;
}

.site-footer .footer-social a {
    color: var(--muted-text);
    font-size: 15px;
    transition: color 0.2s;
}

.site-footer .footer-social a:hover {
    color: var(--accent-secondary);
}
