/* ========================================
   CSS Custom Properties & Theme
   ======================================== */

:root {
    /* Typography */
    --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

    /* Spacing */
    --section-padding: 3.75rem 0;
    --container-width: 800px;
    --container-padding: 0 1.5rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #fafaf9;
    --bg-secondary: #f5f5f4;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --bg-code: #f1f5f9;

    --text-primary: #1a1a2e;
    --text-secondary: #57534e;
    --text-muted: #78716c;

    --accent: #1e3a5f;
    --accent-hover: #2d5a8e;
    --accent-light: rgba(30, 58, 95, 0.08);
    --accent-glow: rgba(30, 58, 95, 0.15);

    --border: #e7e5e4;
    --border-light: #f0eeec;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08);

    --nav-bg: rgba(250, 250, 249, 0.85);
    --progress-bg: var(--accent);

    /* Venue colors */
    --venue-icml: #1e40af;
    --venue-iccv: #047857;
    --venue-icdar: #7c3aed;
    --venue-srmc: #64748b;

    --venue-icml-bg: rgba(30, 64, 175, 0.1);
    --venue-iccv-bg: rgba(4, 120, 87, 0.1);
    --venue-icdar-bg: rgba(124, 58, 237, 0.1);
    --venue-srmc-bg: rgba(100, 116, 139, 0.1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0c0f1a;
    --bg-secondary: #151929;
    --bg-card: #1a1f35;
    --bg-card-hover: #1f2541;
    --bg-code: #1e293b;

    --text-primary: #e8eaf0;
    --text-secondary: #94a3b8;
    --text-muted: #8494b2;

    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-light: rgba(96, 165, 250, 0.1);
    --accent-glow: rgba(96, 165, 250, 0.2);

    --border: #2a3050;
    --border-light: #1f2541;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.3);

    --nav-bg: rgba(12, 15, 26, 0.85);
    --progress-bg: var(--accent);

    --venue-icml: #60a5fa;
    --venue-iccv: #34d399;
    --venue-icdar: #a78bfa;
    --venue-srmc: #94a3b8;

    --venue-icml-bg: rgba(96, 165, 250, 0.15);
    --venue-iccv-bg: rgba(52, 211, 153, 0.15);
    --venue-icdar-bg: rgba(167, 139, 250, 0.15);
    --venue-srmc-bg: rgba(148, 163, 184, 0.15);
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-slow), color var(--transition-slow);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    animation: fadeIn 0.6s ease;
}

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

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

html {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-primary);
}

/* Focus styles for keyboard accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ========================================
   Progress Bar
   ======================================== */

#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    z-index: 1001;
    transition: width 0.1s linear;
}

/* ========================================
   Navigation
   ======================================== */

#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 0;
    transition: background var(--transition-base), padding var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

#navbar.scrolled {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    padding: 0.6rem 0;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    position: relative;
}

.nav-logo::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.scrolled .nav-logo::after {
    transform: scaleX(1);
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.875rem;
    font-weight: 450;
    color: var(--text-secondary);
    position: relative;
    letter-spacing: 0.01em;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width var(--transition-base);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

#theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

#theme-toggle i {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#theme-toggle:active i {
    transform: rotate(180deg) scale(0.8);
}

/* Mobile Nav Backdrop */
.nav-backdrop {
    display: none;
}

/* Mobile Nav Toggle */
.nav-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.nav-mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Hero Section
   ======================================== */

#hero {
    min-height: 48vh;
    display: flex;
    align-items: center;
    padding: 4.25rem 0 1.25rem;
    position: relative;
    overflow: hidden;
}

#hero::before {
    content: '';
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, var(--accent-glow), transparent 50%),
        radial-gradient(ellipse at 80% 20%, var(--accent-light), transparent 40%),
        radial-gradient(ellipse at 50% 80%, var(--accent-light), transparent 45%);
    animation: meshFloat 20s ease-in-out infinite;
    opacity: 0.7;
    pointer-events: none;
}

@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2%, -3%) rotate(1deg); }
    50% { transform: translate(-1%, 2%) rotate(-0.5deg); }
    75% { transform: translate(3%, 1%) rotate(0.5deg); }
}

.hero-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2.75rem;
}

.hero-text {
    flex: 1;
}

.hero-name {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 5vw, 3.8rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.05;
    margin-bottom: 0.6rem;
    letter-spacing: -0.03em;
}

.hero-title {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.hero-affiliations {
    margin-bottom: 1.25rem;
}

.hero-affiliation {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.affiliation-icon {
    color: var(--accent);
    width: 18px;
    text-align: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.affiliation-sep {
    color: var(--text-muted);
    margin: 0 0.1rem;
}

.affiliation-logo-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.affiliation-logo {
    height: 18px;
    width: auto;
    object-fit: contain;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
    opacity: 0.65;
}

.affiliation-logo-link:hover .affiliation-logo {
    transform: scale(1.1);
    opacity: 1;
}

[data-theme="dark"] .eth-logo,
[data-theme="dark"] .ibm-logo {
    filter: invert(1) brightness(0.85);
}

.eth-logo {
    height: 18px;
}

.ibm-logo {
    height: 24px;
}

.epfl-logo {
    height: 10px;
}

.metu-logo {
    height: 26px;
}

.cambridge-logo {
    height: 30px;
}

.uiuc-logo {
    height: 33px;
}

.docling-logo-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.docling-logo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.docling-logo-link:hover .docling-logo {
    transform: scale(1.15);
}

.hero-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 450;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    background: var(--bg-card);
}

.hero-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.hero-link i {
    font-size: 1rem;
}

.hero-image {
    flex-shrink: 0;
}

.hero-image-ring {
    position: relative;
    padding: 4px;
    border-radius: calc(var(--radius-lg) + 4px);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover), var(--accent));
    background-size: 200% 200%;
    animation: ringShift 6s ease-in-out infinite;
    box-shadow: var(--shadow-lg);
}

@keyframes ringShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-image-wrapper {
    width: 220px;
    height: 220px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
}

.hero-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* ========================================
   Sections – Common
   ======================================== */

section {
    padding: var(--section-padding);
    position: relative;
}

#about {
    padding-bottom: 2rem;
}

#news {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

#publications {
    padding-top: 2rem;
}

section:nth-of-type(even) {
    background: var(--bg-secondary);
}

/* Soft top-edge gradient on alternating sections */
section:nth-of-type(even)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, var(--bg-primary), transparent);
    pointer-events: none;
    z-index: 0;
}

section:nth-of-type(odd):not(#hero)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, var(--bg-secondary), transparent);
    pointer-events: none;
    z-index: 0;
}

.section-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: var(--container-padding);
    position: relative;
    z-index: 1;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.75rem;
    position: relative;
    display: inline-block;
    letter-spacing: -0.01em;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.9rem;
    margin-bottom: 1.5rem;
}

.highlight-name {
    color: var(--accent);
    font-weight: 600;
}

/* ========================================
   About Section
   ======================================== */

.about-content p {
    margin-bottom: 0.75rem;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.about-content p:last-of-type {
    margin-bottom: 1rem;
}

.about-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.about-content a {
    text-decoration-line: underline;
    text-decoration-color: var(--accent-light);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
}

.about-content a:hover {
    text-decoration-color: var(--accent);
}

.research-areas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.research-tag {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    letter-spacing: 0.01em;
}

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

.news-list {
    display: flex;
    flex-direction: column;
}

.news-item {
    display: flex;
    gap: 1.25rem;
    padding: 0.65rem 0.65rem;
    border-bottom: 1px solid var(--border-light);
    align-items: baseline;
    transition: background 0.2s ease;
    border-radius: var(--radius-sm);
}

.news-item:hover {
    background: var(--accent-light);
}

.news-item:last-child {
    border-bottom: none;
}

.news-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 90px;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.news-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.news-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.news-text a {
    font-weight: 500;
}

/* ========================================
   Publications Section
   ======================================== */

.pub-card {
    display: flex;
    gap: 1.25rem;
    padding: 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-card);
}

.pub-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

/* Venue-colored left border on hover */
.pub-card:has(.pub-venue.icml):hover { border-left-color: var(--venue-icml); }
.pub-card:has(.pub-venue.iccv):hover { border-left-color: var(--venue-iccv); }
.pub-card:has(.pub-venue.icdar):hover { border-left-color: var(--venue-icdar); }
.pub-card:has(.pub-venue.srmc):hover { border-left-color: var(--venue-srmc); }

.pub-image {
    flex-shrink: 0;
    width: 220px;
    height: 155px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
    border: 1px solid var(--border-light);
}

.pub-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    position: relative;
    z-index: 2;
    transition: transform var(--transition-base), filter 0.6s ease, opacity 0.6s ease;
}

.pub-image.contain-image img {
    object-fit: contain;
    background: var(--bg-card);
}

.pub-image img:not(.loaded) {
    filter: blur(5px);
    opacity: 0.6;
}

.pub-image img.loaded {
    filter: blur(0);
    opacity: 1;
}

.pub-card:hover .pub-image img {
    transform: scale(1.03);
}

.pub-card:hover .pub-image.contain-image img {
    transform: none;
}

.pub-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    background:
        radial-gradient(circle at 30% 40%, var(--accent-light), transparent 60%),
        linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: var(--radius-sm);
}

.pub-image-placeholder i {
    font-size: 2.2rem;
    opacity: 0.25;
    color: var(--accent);
}

.pub-image-placeholder span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    opacity: 0.4;
}

.pub-image:not(.pub-image-fallback) .pub-image-placeholder {
    z-index: 1;
}

.pub-image.pub-image-fallback .pub-image-placeholder {
    z-index: 2;
}

.pub-details {
    flex: 1;
    min-width: 0;
}

.pub-venue-line {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.pub-venue {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.03em;
}

a.pub-venue {
    transition: opacity var(--transition-fast), box-shadow var(--transition-fast);
}

a.pub-venue:hover {
    opacity: 0.85;
    box-shadow: 0 0 0 1px currentColor;
}

.pub-venue.icml {
    background: var(--venue-icml-bg);
    color: var(--venue-icml);
}

.pub-venue.iccv {
    background: var(--venue-iccv-bg);
    color: var(--venue-iccv);
}

.pub-venue.icdar {
    background: var(--venue-icdar-bg);
    color: var(--venue-icdar);
}

.pub-venue.srmc {
    background: var(--venue-srmc-bg);
    color: var(--venue-srmc);
}

.pub-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.pub-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.pub-authors {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.55rem;
}

.pub-authors strong {
    color: var(--text-primary);
    font-weight: 600;
}

.pub-tldr {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.65rem;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--accent);
}

.pub-tldr-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.4rem;
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pub-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* Primary link (Paper) gets filled style */
.pub-link:first-child {
    background: var(--accent-light);
    border-color: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.pub-link:first-child:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pub-link i {
    font-size: 0.8rem;
}

/* ========================================
   Open Source Projects
   ======================================== */

.projects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
}

.project-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

.project-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    letter-spacing: -0.01em;
    min-width: 0;
}

.project-name i {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.project-card:hover .project-name,
.project-card:hover .project-name i {
    color: var(--accent);
}

.project-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.1rem 0.5rem;
    background: var(--accent-light);
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.project-stars i {
    color: #f59e0b;
    font-size: 0.68rem;
}

.project-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* ========================================
   Experience / Timeline
   ======================================== */

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    bottom: 8px;
    width: 1.5px;
    background: linear-gradient(to bottom, var(--accent), var(--border) 30%);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    z-index: 1;
    transition: all var(--transition-fast);
}

.timeline-item:hover .timeline-marker {
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.timeline-content {
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-card);
}

.timeline-item:hover .timeline-content {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent-light);
}

.timeline-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.timeline-header h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-logo,
.edu-logo {
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.timeline-item:hover .timeline-logo {
    opacity: 1;
}

[data-theme="dark"] .timeline-logo.ibm-invert {
    filter: invert(1) brightness(0.85);
}

.timeline-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.timeline-location i {
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

.timeline-role {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 450;
    margin-bottom: 0.2rem;
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    display: inline-block;
    margin-bottom: 0.3rem;
}

.timeline-detail {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* ========================================
   Education Section
   ======================================== */

.edu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.edu-card {
    display: flex;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-card);
}

.edu-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.edu-card-accent {
    width: 5px;
    flex-shrink: 0;
}

.edu-card-accent.eth { background: linear-gradient(to bottom, #1e3a5f, #2d5a8e); }
.edu-card-accent.epfl { background: linear-gradient(to bottom, #c4122f, #e6354b); }
.edu-card-accent.metu { background: linear-gradient(to bottom, #8B0000, #c0392b); }

.edu-card-content {
    padding: 1.25rem 1.5rem;
    flex: 1;
}

.edu-card-content h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


.edu-card:hover .edu-logo {
    opacity: 1;
}

.edu-degree {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 450;
    margin-bottom: 0.15rem;
}

.edu-department {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.edu-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.edu-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.edu-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.edu-stat {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.2rem 0.7rem;
    background: var(--accent-light);
    border-radius: var(--radius-full);
}

.edu-stat strong {
    color: var(--accent);
    font-weight: 600;
}

/* ========================================
   Awards Section
   ======================================== */

.awards-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.award-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    align-items: flex-start;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-card);
}

.award-item:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

.award-icon {
    color: var(--accent);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.award-content h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.award-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.award-content strong {
    color: var(--text-primary);
}

.award-year {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: inline-block;
}

/* ========================================
   Footer
   ======================================== */

#footer {
    padding: 3rem 0 2rem;
    background: var(--bg-secondary);
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg, transparent, var(--accent), transparent) 1;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: var(--container-padding);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.footer-name {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

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

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.footer-bottom p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========================================
   Scroll Indicator
   ======================================== */

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.6;
    transition: opacity var(--transition-base);
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-indicator i {
    font-size: 1rem;
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(6px); }
    60% { transform: translateY(3px); }
}

/* ========================================
   Animations
   ======================================== */

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for hero elements */
#hero .hero-text .reveal:nth-child(1) { transition-delay: 0s; }
#hero .hero-text .reveal:nth-child(2) { transition-delay: 0.1s; }
#hero .hero-text .reveal:nth-child(3) { transition-delay: 0.2s; }
#hero .hero-text .reveal:nth-child(4) { transition-delay: 0.3s; }
#hero .hero-text .reveal:nth-child(5) { transition-delay: 0.4s; }

.hero-image.reveal { transition-delay: 0.15s; }

/* Animated section title underline */
.section-title::after {
    width: 0;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.section-title.revealed::after {
    width: 40px;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    :root {
        --section-padding: 3rem 0;
    }

    /* Mobile Navigation */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-card);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: right var(--transition-base);
        box-shadow: var(--shadow-lg);
        border-left: 1px solid var(--border);
        z-index: 1000;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        z-index: 999;
    }

    .nav-backdrop.open {
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: 1rem;
    }

    .nav-mobile-toggle {
        display: flex;
        z-index: 1001;
    }

    /* Hero */
    #hero {
        min-height: auto;
        padding: 4.75rem 0 1.5rem;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 1.5rem;
    }

    .hero-image-wrapper {
        width: 155px;
        height: 155px;
    }

    .hero-affiliations {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-affiliation {
        justify-content: center;
    }

    .hero-links {
        justify-content: center;
    }

    .hero-name {
        font-size: 2.4rem;
    }

    .scroll-indicator {
        display: none;
    }

    /* Section titles */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.4rem;
    }

    /* Publications */
    .pub-card {
        flex-direction: column;
    }

    .pub-image {
        width: 100%;
        height: 200px;
    }

    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Timeline */
    .timeline {
        padding-left: 1.5rem;
    }

    .timeline-marker {
        left: -1.5rem;
    }

    .timeline-header {
        flex-direction: column;
        gap: 0.25rem;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    /* News */
    .news-item {
        flex-direction: column;
        gap: 0.3rem;
    }

    .news-date {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 2rem;
    }

    .hero-link span {
        display: none;
    }

    .hero-link {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
    }

    .hero-link i {
        margin: 0;
    }

    .edu-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hero-image-wrapper {
        width: 200px;
        height: 200px;
    }
}

/* ========================================
   BibTeX Modal
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    transform: translateY(20px) scale(0.96);
    transition: transform var(--transition-base);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-code {
    margin: 0;
    padding: 1.25rem;
    background: var(--bg-code);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-light);
}

.modal-code code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre;
}

.modal-copy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 1.25rem 1rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-copy:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.modal-copy.copied {
    background: #059669;
}

/* Cite button styling */
.cite-btn {
    cursor: pointer;
    font-family: var(--font-sans);
    background: none;
}

/* ========================================
   Back to Top Button
   ======================================== */

#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    z-index: 100;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   Dark Mode Image Treatment
   ======================================== */

[data-theme="dark"] .pub-image img.loaded {
    filter: brightness(0.9);
}

[data-theme="dark"] .pub-image img:not(.loaded) {
    filter: blur(5px) brightness(0.9);
}

[data-theme="dark"] .pub-image {
    background: var(--bg-card);
}

[data-theme="dark"] .hero-image-ring {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover), #818cf8);
    background-size: 200% 200%;
}

/* Subtle glow on pub card hover in dark mode */
[data-theme="dark"] .pub-card:hover {
    box-shadow: var(--shadow-card-hover), 0 0 30px rgba(96, 165, 250, 0.05);
}

[data-theme="dark"] .edu-card:hover {
    box-shadow: var(--shadow-card-hover), 0 0 20px rgba(96, 165, 250, 0.04);
}

/* Hero name glow + gradient in dark mode */
[data-theme="dark"] .hero-name {
    text-shadow: 0 0 60px rgba(96, 165, 250, 0.15);
    background: linear-gradient(135deg, #e8eaf0 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Image Lightbox
   ======================================== */

.pub-image img.loaded {
    cursor: zoom-in;
}

#image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
    padding: 2rem;
}

#image-lightbox.active {
    opacity: 1;
    visibility: visible;
}

#image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#image-lightbox.active img {
    transform: scale(1);
}

/* ========================================
   Active / Press States
   ======================================== */

.hero-link:active,
.pub-link:active,
.research-tag:active {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

.award-item:active,
.edu-card:active,
.pub-card:active {
    transform: scale(0.99);
    transition-duration: 0.1s;
}

/* ========================================
   Reduced Motion
   ======================================== */

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

    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .hero-content {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    #navbar, #progress-bar, #theme-toggle, .nav-mobile-toggle,
    #back-to-top, .scroll-indicator, #bibtex-modal, .nav-backdrop {
        display: none !important;
    }

    #hero::before {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    section:nth-of-type(even) {
        background: white;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    a {
        color: #1e3a5f;
        text-decoration: underline;
    }

    section {
        page-break-inside: avoid;
    }
}
