/* --- Theme Variables --- */
:root {
    /* Default: Dark Theme */
    --bg-color: #1a1a1d;
    --card-bg: #2c2c30;
    --text-color: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent-gradient: linear-gradient(90deg, #8e44ad, #3498db);
    --accent-color-1: #8e44ad;
    --accent-color-2: #3498db;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --link-hover-color: #5dade2;
    --button-bg: var(--card-bg);
    --button-border: var(--border-color);
    --button-text: var(--text-color);
    --button-hover-bg: #3a3a40;
    --image-wrapper-bg: #252528; /* Subtle bg for image container */
}

body.light-theme {
    /* Light Theme Overrides */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --text-secondary: #6c757d;
    /* --accent-gradient: linear-gradient(90deg, #a076d6, #7cc0f0); */
    --accent-color-1: #8e44ad;
    --accent-color-2: #3498db;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --link-hover-color: #2980b9;
    --button-bg: #e9ecef;
    --button-border: #ced4da;
    --button-text: var(--text-color);
    --button-hover-bg: #dde1e4;
    --image-wrapper-bg: #f0f0f0; /* Subtle bg for image container */
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Poppins', sans-serif; background-color: var(--bg-color); color: var(--text-color); line-height: 1.7; overflow-x: hidden; opacity: 0; animation: fadeInBody 0.8s 0.2s ease-out forwards; transition: background-color 0.4s ease, color 0.4s ease; min-height: 100vh; margin: 0; padding: 0; display: flex; flex-direction: column; }
@keyframes fadeInBody { to { opacity: 1; } }
.container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; position: relative; z-index: 1; }

/* --- Typography & Links --- */
h1, h2, h3 { font-weight: 600; margin-bottom: 0.8em; line-height: 1.3; color: var(--text-color); transition: color 0.4s ease; }
h1.name { font-size: 3em; font-weight: 700; text-align: center; background: var(--accent-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 0.3em; }
h2.section-title { font-size: 2.2em; text-align: center; margin-top: 3em; margin-bottom: 1.5em; position: relative; }
h2.section-title::after { content: ''; display: block; width: 80px; height: 3px; background: var(--accent-gradient); margin: 0.3em auto 0; border-radius: 2px; }
p { margin-bottom: 1.2em; color: var(--text-secondary); font-weight: 300; transition: color 0.4s ease; }
p strong { font-weight: 600; color: var(--text-color); }
a { color: var(--accent-color-2); text-decoration: none; transition: color 0.3s ease, transform 0.2s ease; display: inline-block; }
a:hover { color: var(--link-hover-color); text-decoration: underline; transform: translateY(-2px); }

/* --- Header/Profile Section --- */
.hero { 
    display: flex; 
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 80px;
    margin-bottom: 4em;
    padding: 20px 0;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.hero-content {
    flex: 1;
    text-align: left;
    max-width: 700px;
    padding-right: 20px;
}

.hero-image {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 120px;
    padding-right: 40px;
}

.profile-pic-wrapper { 
    width: 350px;
    height: 350px; 
    border-radius: 8px;
    overflow: hidden; 
    border: 4px solid var(--card-bg); 
    box-shadow: 0 5px 15px var(--shadow-color); 
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.4s ease; 
    cursor: pointer; 
}

.name {
    font-size: 2.5em;
    margin-bottom: 0.5em;
    text-align: left;
}

.profile-pic { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block;
    transition: transform 0.3s ease;
}

.profile-pic-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.intro-text { max-width: 700px; text-align: justify; margin-bottom: 1.5em; }
.intro-text p { margin-bottom: 1.5em; }
.social-links p { margin: 0; font-size: 1.1em; }
.social-links a { margin: 0 12px; font-weight: 400; color: var(--text-secondary); position: relative; text-decoration: none; }
.social-links a:hover { color: var(--text-color); transform: translateY(-3px); text-decoration: none; }
.social-links a::after { content: ''; position: absolute; width: 100%; height: 2px; bottom: -4px; left: 0; background: var(--accent-gradient); transform: scaleX(0); transform-origin: bottom right; transition: transform 0.3s ease-out; }
.social-links a:hover::after { transform: scaleX(1); transform-origin: bottom left; }

/* --- Card Layout (Research & Projects) --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.card { background-color: var(--card-bg); border-radius: 12px; padding: 25px; box-shadow: 0 4px 10px var(--shadow-color); transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.4s ease, border-color 0.4s ease; display: flex; flex-direction: column; border: 1px solid var(--border-color); }
.card:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 10px 25px var(--shadow-color); }

/* --- MODIFIED IMAGE WRAPPER & IMAGE --- */
.card-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
    background-color: var(--image-wrapper-bg); /* Background for letter/pillarboxing */
    display: flex; /* Center image within wrapper */
    justify-content: center;
    align-items: center;
}
.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* KEY CHANGE: Fit image inside */
    display: block;
    transition: transform 0.4s ease;
    cursor: pointer;
    /* Removed scale on hover from here */
}
/* Remove specific image zoom on card hover */
/* .card:hover .card-image-wrapper img { transform: scale(1.08); } */
/* --- END MODIFIED IMAGE WRAPPER & IMAGE --- */


.card-content { flex-grow: 1; display: flex; flex-direction: column; }
.card-content h3 { font-size: 1.3em; margin-bottom: 0.5em; transition: color 0.3s ease; position: relative; }
.card-content h3 a { color: inherit; text-decoration: none; }
.card-content h3 a:hover { color: var(--link-hover-color); text-decoration: underline; transform: none; }
.card-content h3.collapsible-trigger { cursor: pointer; padding-right: 25px; }
.card-content h3.collapsible-trigger::after { content: '+'; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); font-size: 1.2em; color: var(--accent-color-2); transition: transform 0.3s ease, color 0.3s ease; }
.card-content h3.collapsible-trigger.active::after { content: '−'; transform: translateY(-50%) rotate(180deg); color: var(--accent-color-1); }
.card-meta { font-size: 0.9em; color: var(--text-secondary); margin-bottom: 1em; font-style: italic; }
.card-meta strong { color: var(--text-secondary); font-weight: 600; }
.papertitle { font-weight: 700; color: var(--accent-color-1); }
.card-content a .papertitle:hover { color: var(--link-hover-color); }
.card-content ul { list-style: none; padding-left: 5px; margin-top: 0.8em; flex-grow: 1; color: var(--text-secondary); font-size: 0.95em; }
.card-content li { margin-bottom: 0.6em; position: relative; padding-left: 20px; }
.card-content li::before { content: '▹'; position: absolute; left: 0; top: 1px; color: var(--accent-color-2); font-weight: bold; }
.card-content li strong { color: var(--text-color); }
.collapsible-content { max-height: 0; overflow: hidden; transition: max-height 0.5s ease-in-out; }

/* --- Footer --- */
.site-footer {
    width: 100%;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 2em 0;
    margin-top: 4em;
    transition: background-color 0.4s ease, border-color 0.4s ease;
    position: relative;
    left: 0;
    right: 0;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-content {
    width: 100%;
    text-align: center;
    padding: 0 20px;
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0;
    width: 100%;
    display: block;
    text-decoration: none;
    pointer-events: none;
    cursor: default;
}

/* --- Lightbox Styles --- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: default;
}

.lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    cursor: default;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    height: auto;
    display: block;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1001;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background-color: var(--accent-color-1);
    color: white;
    transform: scale(1.1);
}

.lightbox-visible {
    display: flex !important;
}

/* --- Scroll Animation --- */
.fade-in-section { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.fade-in-section.is-visible { opacity: 1; transform: translateY(0); }

/* --- Theme Toggle Button --- */
#theme-toggle { position: fixed; top: 20px; right: 20px; background-color: var(--button-bg); border: 1px solid var(--button-border); color: var(--button-text); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; font-size: 1.2em; z-index: 1001; box-shadow: 0 2px 5px var(--shadow-color); transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.3s ease, transform 0.2s ease; }
#theme-toggle:hover { background-color: var(--button-hover-bg); transform: scale(1.1); }
#theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .hero {
        gap: 40px;
        padding: 20px;
    }

    .hero-image {
        padding-right: 0;
    }

    .profile-pic-wrapper {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 768px) {
    .hero {
        flex-direction: column-reverse;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .hero-content {
        text-align: center;
        padding-right: 0;
    }

    .hero-image {
        margin-top: 0;
        padding-right: 0;
    }

    .profile-pic-wrapper {
        width: 250px;
        height: 250px;
    }

    .name {
        text-align: center;
    }

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

    h1.name { font-size: 2.5em; }
    h2.section-title { font-size: 1.8em; }
    .container { padding: 30px 15px; }
    .card-grid { grid-template-columns: 1fr; }
    #theme-toggle { top: 15px; right: 15px; width: 36px; height: 36px; font-size: 1.1em; }
}

/* --- Professional Experience Section --- */
.experience-grid {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    padding: 20px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.experience-card {
    flex: 0 0 calc(33.333% - 20px);
    min-width: 350px;
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 10px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    scroll-snap-align: start;
}

.experience-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow-color);
}

.experience-header {
    margin-bottom: 15px;
}

.experience-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.experience-position {
    color: var(--accent-color-1);
    font-size: 1em;
    margin-bottom: 5px;
}

.experience-duration {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-style: italic;
}

.experience-points {
    list-style: none;
    padding-left: 0;
    margin: 15px 0;
}

.experience-points li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 0.95em;
}

.experience-points li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-color-2);
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.tech-item {
    background: var(--bg-color);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.tech-item img {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .experience-grid {
        flex-direction: column;
        gap: 20px;
    }

    .experience-card {
        flex: 1;
        min-width: 100%;
    }
}
