/* CSS Variables for Theme */
:root {
    --bg-color: #fff;
    --text-color: #333;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    --card-bg: #fff;
    --border-color: #e5e7eb;
    --section-bg: #f9fafb;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --nav-bg-scrolled: rgba(255, 255, 255, 0.98);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.2);
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-light: #cbd5e1;
    --text-lighter: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
    --section-bg: #1e293b;
    --nav-bg: rgba(15, 23, 42, 0.95);
    --nav-bg-scrolled: rgba(15, 23, 42, 0.98);
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.6);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.7;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: var(--nav-bg-scrolled);
    box-shadow: 0 2px 20px var(--shadow-medium);
}

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

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    padding: 120px 0 80px;
    background: var(--section-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    align-items: center;
}

.hero-image {
    text-align: center;
}

.profile-image {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 8px solid white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.hero-title {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

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

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--card-bg);
    border-radius: 50%;
    color: var(--text-light);
    box-shadow: 0 4px 6px var(--shadow-medium);
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.social-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-heavy);
}

/* Section Styles */
section {
    padding: 80px 0;
}

.section-title {
      text-align: center;
    margin-bottom: 3rem;
    color: var(--text-color);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
}

/* Combined Profile & Timeline Section */
.profile-timeline {
    padding: 100px 0 60px;
    background: var(--bg-color);
    min-height: 100vh;
}

.profile-header {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 4rem;
    padding-bottom: 4rem;
    max-width: 600px; /* Smaller max-width to center the group */
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.profile-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 900px; /* Match timeline width */
    height: 1px;
    background: var(--border-color);
    max-width: 90vw; /* Responsive limit */
}

.profile-image-container {
    flex-shrink: 0;
}

.profile-timeline .profile-image {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.profile-info {
    flex: 1;
    padding-top: 1rem;
}

.profile-name {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 700;
}

.profile-tagline {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 400;
    /* font-style: italic; */
}

.profile-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.profile-tagline a,
.profile-description a {
    color: inherit; /* Use same color as parent text */
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.profile-tagline a:hover,
.profile-description a:hover {
    text-decoration-thickness: 2px;
}

/* Timeline Section */
.timeline { background: var(--section-bg); }

.timeline .container { max-width: 1000px; }

/* Timeline within profile-timeline */
.profile-timeline .timeline-grid {
    background: none;
    padding: 0;
}

.timeline-grid {
    display: grid;
    grid-template-columns: 160px 100px 1fr; /* year | marker | card */
    gap: 1rem 2rem;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline-grid::before {
    content: "";
    position: absolute;
    top: 0;
    left: calc(160px + 50px); /* center of marker column */
    width: 2px;
    height: 100%;
    /* dotted vertical line with evenly spaced dots */
    background-image: radial-gradient(var(--border-color) 3px, transparent 3px);
    background-size: 2px 14px;
    background-repeat: repeat-y;
    background-position: center top;
}
.timeline-year {
    color: var(--text-lighter);
    font-weight: 400;
    padding-top: 0.4rem;
    white-space: nowrap;
    font-size: 0.9rem;
}

.timeline-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    min-height: 48px; /* allow variable heights based on logo */
    background: transparent;
    border: none;
    border-radius: 0;
    z-index: 1;
}

.timeline-logo {
    width: 100%;
    height: auto; /* preserve aspect ratio */
    max-height: 72px; /* keep within lane and clearly visible */
    object-fit: contain;
    display: block;
    border: 0;
    border-radius: 0;
}

.timeline-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--shadow-light);
    padding: 1rem 1.25rem;
    position: relative;
    max-width: 600px; /* Constrain text width for better readability */
}

.timeline-card p { 
    margin: 0; 
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    font-weight: 400;
}

.timeline-card a {
    color: inherit; /* Use same color as parent text */
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.timeline-card a:hover {
    text-decoration-thickness: 2px;
}

/* horizontal connector from vertical line to card */
.timeline-card::before { content: none; }

/* dot marker on the horizontal connector */
.timeline-card::after {
    content: none;
}

/* Mobile Styles for Profile-Timeline */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .profile-timeline .profile-image {
        width: 150px;
        height: 150px;
    }
    
    .profile-name {
        font-size: 2rem;
    }
    
    .profile-tagline {
        font-size: 1.1rem;
    }
    
    .profile-description {
        font-size: 0.95rem;
    }
    
    .timeline-grid { grid-template-columns: 110px 60px 1fr; gap: 1rem 1.5rem; }
    .timeline-grid::before { left: calc(110px + 30px); }
    .timeline-marker { width: 60px; }
    .timeline-logo { max-height: 48px; }
    .timeline-card::before { content: none; }
    .timeline-card::after { content: none; }
}

/* Research Section */
.publications {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.publication-card {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.publication-card:hover {
    box-shadow: 0 20px 40px var(--shadow-medium);
    transform: translateY(-5px);
}

.publication-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--section-bg);
    padding: 2rem;
    overflow: hidden;
}

.publication-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    object-fit: contain;
}

.publication-image img:hover {
    transform: scale(1.2);
}

.publication-content {
    padding: 2rem;
}

.publication-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
}

.publication-authors {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.publication-venue {
    font-size: 1rem;
    color: #059669;
    font-style: italic;
    margin-bottom: 1rem;
    font-weight: 500;
}

.publication-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

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

.pub-link {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pub-link:hover {
    background: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
}

.pub-link.disabled {
    background: var(--text-lighter);
    cursor: not-allowed;
}

/* Blogs Section */
.blogs {
    background: var(--section-bg);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.blog-card:hover {
    box-shadow: 0 20px 40px var(--shadow-medium);
    transform: translateY(-5px);
}

.blog-image {
    height: 200px;
    overflow: hidden;
    background: var(--section-bg);
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-image img {
    transform: scale(1.05);
}

.blog-content {
    padding: 1.5rem;
}

.blog-date {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.blog-title {
    margin-bottom: 1rem;
}

.blog-title a {
    color: var(--text-color);
    font-weight: 600;
}

.blog-title a:hover {
    color: var(--primary-color);
}

.blog-description {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* Footer */
.footer {
    background: var(--text-color);
    color: var(--bg-color);
    text-align: center;
    padding: 2rem 0;
}

/* Responsive Design */
@media (max-width: 1024px) and (min-width: 769px) {
    .publication-image {
        padding: 1.8rem;
        min-height: 220px;
    }

    .publication-image img {
        min-height: 160px;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-color);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px var(--shadow-light);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero {
        padding: 100px 0 60px;
    }

    .profile-image {
        width: 250px;
        height: 250px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .publication-card {
        grid-template-columns: 1fr;
    }

    .publication-image {
        padding: 1.5rem;
        min-height: 250px;
    }

    .publication-image img {
        min-height: 180px;
        max-height: 250px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    section {
        padding: 60px 0;
    }

    .container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .profile-timeline .profile-image {
        width: 120px;
        height: 120px;
    }
    
    .profile-name {
        font-size: 1.8rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

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

    .publication-content,
    .blog-content {
        padding: 1.5rem;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.publication-card,
.blog-card {
    animation: fadeInUp 0.6s ease forwards;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Dark Mode Toggle */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    margin-left: 1rem;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

/* Selection color */
::selection {
    background: var(--primary-color);
    color: white;
}