/* Simple CSS Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--body-bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px; /* Base font size */
}

/* Define CSS Variables */
:root {
    --body-bg-color: #2d2e32;
    --nav-bg-color: #2d2e32;
    --card-bg-color: #25262a;
    --text-color: #f0f0f0; /* Slightly off-white for better readability */
    --primary-accent-color: #64f4ab;
    --secondary-accent-color: #e8eb33;
    --link-color: #fecd1a;
    --border-color: #444; /* For subtle borders */
    --container-width: 90%;
    --max-container-width: 1200px;
    --header-font-family: 'monospace', 'Poppins', sans-serif;
    --body-font-family: 'Poppins', sans-serif;

    --section-padding: 3rem 0; /* Adjusted padding */
    --card-padding: 1.5rem;
    --grid-gap: 1.5rem;
    --card-border-radius: 10px;
}

/* General Container Styling */
.container {
    width: var(--container-width);
    max-width: var(--max-container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: var(--header-font-family);
    color: var(--primary-accent-color);
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem); /* Responsive font size */
    color: #fff;
    line-height: 1.2; /* From original */
}

h2 { /* General section titles */
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-accent-color); /* Titles like "My Skills", "My Research" */
}

h3 { /* Card titles, sub-project titles */
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--secondary-accent-color);
    font-family: monospace;
    text-align: center;
    margin-top: 1rem; /* Adjusted from 20px */
    margin-bottom: 0.75rem;
}

h4 { /* Subtitles for larger sections like Research/Projects */
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--primary-accent-color);
    font-family: var(--body-font-family);
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
    font-family: var(--body-font-family);
    color: var(--text-color);
    font-size: clamp(0.9rem, 1.5vw, 1rem); /* Responsive paragraph text */
}

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

a:hover, a:focus {
    color: var(--primary-accent-color);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--card-border-radius);
}

ul {
    list-style: none;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.section-subtitle {
    color: var(--primary-accent-color);
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    font-weight: bold;
    margin-bottom: 0.75rem;
    font-family: var(--body-font-family);
}


/* Image credit style */
.image-credit {
    color: #ccc; /* Slightly dimmer */
    font-size: 0.85em;
    display: block;
    margin-top: 1rem;
    text-align: right;
}
.image-credit a {
    color: #ccc;
}
.image-credit a:hover {
    color: var(--link-color);
}

blockquote {
    margin: 1.5rem 0 1.5rem 1.5rem; /* Adjusted margin */
    padding-left: 1.5rem;
    border-left: 4px solid var(--primary-accent-color);
    font-style: italic;
    color: #ddd; /* Slightly lighter for quotes */
}
blockquote p {
    margin-bottom: 0.5rem;
    font-size: clamp(0.95rem, 1.8vw, 1.05rem);
}
blockquote q {
    quotes: "“" "”" "‘" "’";
}
blockquote q::before {
    content: open-quote;
    margin-right: 0.25em;
}
blockquote q::after {
    content: close-quote;
    margin-left: 0.25em;
}


/* Basic structure for project layouts (2-column) */
.project-layout .container {
    display: grid; /* Using grid for more robust layout */
    grid-template-columns: 1fr; /* Default to single column for mobile */
    gap: var(--grid-gap);
    align-items: flex-start;
}

@media (min-width: 768px) { /* Two columns for tablet and up */
    .project-layout .container {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    /* Alternate image and text for visual interest if needed */
    .project-layout:nth-child(odd) .project-image-column {
        order: 1; /* Image on right for odd sections */
    }
     .project-layout:nth-child(odd) .project-text-column {
        order: 2;
    }
    .project-layout:nth-child(even) .project-image-column {
        order: 2; /* Image on left for even sections */
    }
     .project-layout:nth-child(even) .project-text-column {
        order: 1;
    }
}


.project-text-column,
.project-image-column {
    padding: 1rem;
}
.project-image-column img {
    border: 1px solid var(--border-color); /* Subtle border for images */
}

.project-image-column img + img {
    margin-top: var(--grid-gap);
}

.project-links {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem; /* Slightly larger padding */
    background-color: var(--card-bg-color);
    border-radius: var(--card-border-radius);
    border: 1px solid var(--border-color);
    color: var(--link-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}
.project-link:hover {
    background-color: var(--link-color) ;
    color: var(--body-bg-color); /* Dark text on hover */
    text-decoration: none;
}
.project-link:hover i {
    color: var(--body-bg-color);
}

.project-link i {
    font-size: 1.2em;
    transition: color 0.3s ease;
}

/* Specific style for i2 tag (used for SimCLR, percentages) */
i2 {
    color: var(--secondary-accent-color);
    font-style: italic;
    font-weight: bold;
}


/* Animations */
.animated-img, .animatedcard, .anime { /* Base state for elements that will be animated */
    opacity: 0;
    will-change: transform, opacity; /* Performance hint for browser */
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* This class will be added by JavaScript (IntersectionObserver) to trigger the animation */
.animate-in {
    animation: fadeInUp 0.7s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards; /* Added easing and slightly faster */
}

/* Navigation Bar Styles */
nav {
    background-color: var(--nav-bg-color);
    padding: 1rem 0; /* Adjusted padding */
    position: sticky; /* Make nav sticky */
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Subtle shadow for sticky nav */
}

nav .nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: var(--container-width);
    max-width: var(--max-container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

nav .logo a {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--header-font-family);
}

nav .nav-links {
    display: flex;
    align-items: center;
    gap: 1rem; /* Spacing between nav items */
}

nav .nav-links li a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--card-border-radius);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-weight: 500; /* Slightly bolder nav links */
}

nav .nav-links li a:hover,
nav .nav-links li a.active { /* For active link styling if implemented via JS */
    background-color: var(--primary-accent-color);
    color: var(--body-bg-color);
    text-decoration: none;
}

/* Mobile Navigation - Sidebar Toggle */
.sidebarOpen, .sidebarClose {
    display: none; /* Hidden by default */
    color: var(--text-color);
    font-size: 1.8rem; /* Larger icon */
    cursor: pointer;
}

@media (max-width: 768px) {
    nav .nav-links {
        position: fixed;
        top: 0;
        left: -100%; /* Hidden off-screen */
        width: 280px; /* Sidebar width */
        height: 100vh;
        background-color: var(--card-bg-color); /* Darker sidebar background */
        flex-direction: column;
        padding: 3rem 1rem 1rem; /* More padding at the top */
        gap: 1.5rem; /* Increased gap for vertical items */
        transition: left 0.3s ease-in-out;
        z-index: 1001; /* Above nav shadow */
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }

    nav .nav-links.active {
        left: 0; /* Slide in */
    }

    nav .logo-toggle { /* Container for logo and close button in sidebar */
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 1rem;
        position: absolute;
        top: 0;
        left: 0;
        background-color: var(--nav-bg-color); /* Match nav bar color */
    }

    nav .logo-toggle .logo a { /* Ensure logo in sidebar is visible */
        color: var(--text-color);
    }

    .sidebarOpen {
        display: block; /* Show hamburger icon */
    }

    .sidebarClose { /* Displayed inside the .logo-toggle when sidebar is active */
        display: block;
    }
}


/* Header Section Styles */
.header-section {
    padding: var(--section-padding) 0;
    min-height: calc(100vh - 70px); /* Attempt to fill viewport height minus nav */
    display: flex;
    align-items: center;
    background-color: var(--body-bg-color); /* Ensure it has a background */
}

.header-section .container {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for smaller screens */
    align-items: center;
    gap: 2rem; /* Gap between image and text sections */
}

.header-section .left-section,
.header-section .right-section {
    flex: 1;
    min-width: 300px; /* Prevent excessive squishing */
}

.header-section .left-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-section .left-section img {
    max-width: 450px; /* Control max size of image */
    width: 100%;
    border: 3px solid var(--primary-accent-color); /* Accent border */
}

.header-section .right-section .main-text h1 {
    font-size: clamp(2.8rem, 6vw, 4.5rem); /* Larger, responsive hero text */
    line-height: 1.1;
    margin-bottom: 1.5rem;
}
.header-section .right-section .intro .section-subtitle {
    margin-bottom: 0.5rem; /* Tighter spacing for "About me" */
}

@media (max-width: 768px) {
    .header-section {
        min-height: auto; /* Remove min-height on mobile */
        padding: 2rem 0; /* Reduced padding on mobile */
    }
    .header-section .container {
        flex-direction: column; /* Stack image and text on mobile */
        text-align: center;
    }
    .header-section .left-section img {
        max-width: 300px; /* Smaller image on mobile */
        margin-bottom: 1.5rem;
    }
    .header-section .right-section .main-text h1 {
        font-size: clamp(2.2rem, 8vw, 3rem);
    }
}

/* Skills Section Styles */
.skills-section {
    padding: var(--section-padding) 0;
    background-color: var(--body-bg-color); /* Ensure consistent background */
}

.skills-section .content-section { /* Text part above cards */
    text-align: center;
    margin-bottom: 3rem;
}
.skills-section .content-section p {
    max-width: 800px; /* Limit width of introductory text */
    margin-left: auto;
    margin-right: auto;
    font-size: clamp(1rem, 1.8vw, 1.1rem);
}

.cards-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: var(--grid-gap);
}

.card {
    background-color: var(--card-bg-color);
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.card .card-content h3 { /* Already styled by general h3 */
    margin-top: 0; /* Remove top margin if it's the first element in card-content */
}
.card .card-content p {
    font-family: monospace; /* Monospace for card content from original */
    color: #E8E8E8; /* Specific color from original card text */
    font-size: 0.9rem;
    line-height: 1.5;
}
.card .card-content p br { /* Ensure <br> tags are handled well for line breaks */
    display: block; /* Or 'content: "\A"; white-space: pre-wrap;' if needed */
    margin-bottom: 0.5em;
}


/* Consultancy Stats Section Styles */
.consultancy-stats-section {
    padding: var(--section-padding) 0;
    background-color: var(--card-bg-color); /* Slightly different background for this section */
}

.consultancy-stats-section .section-title { /* "Consultancy Stats" heading */
    color: var(--secondary-accent-color); /* Yellowish */
    margin-bottom: 3rem;
}

.stats-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--grid-gap);
}

.stat-item {
    background-color: #21242b; /* Darker background from original .containerx */
    padding: 2rem 1.5rem;
    border-radius: var(--card-border-radius);
    text-align: center;
    flex-grow: 1; /* Allow items to grow */
    min-width: 200px; /* Minimum width for each stat item */
    max-width: 300px; /* Maximum width */
    border: 1px solid var(--border-color);
}
/* Specific styles for first and last item to match rounded corners from num1, num2 */
.stats-wrapper .stat-item:first-child {
    border-radius: 40px 0 0 40px; /* As per original .num1 */
}
.stats-wrapper .stat-item:last-child {
    border-radius: 0 40px 40px 0; /* As per original .num2 */
}
/* If there are only two items, they should also get these specific roundings */
.stats-wrapper .stat-item:first-child:nth-last-child(2),
.stats-wrapper .stat-item:first-child:nth-last-child(2) ~ .stat-item {
    /* This would need more complex logic if the number of items is dynamic.
       For a fixed 3 items, the above is fine.
       If only 2 items: first gets left-rounded, second gets right-rounded.
       Let's assume 3 items for now as in the HTML.
       If only 2 items, the :last-child will naturally apply.
    */
}


.stat-number {
    display: block;
    font-size: clamp(3rem, 7vw, 4.5rem); /* Large, responsive number */
    font-weight: 600;
    color: var(--primary-accent-color);
    margin-bottom: 0.5rem;
    font-family: var(--header-font-family);
}

.stat-label {
    display: block;
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: #e0e0e0; /* From original .text */
    font-weight: 400;
}

@media (max-width: 768px) {
    .stats-wrapper .stat-item {
        min-width: 150px; /* Adjust for smaller screens */
        padding: 1.5rem 1rem;
    }
    .stats-wrapper .stat-item:first-child,
    .stats-wrapper .stat-item:last-child { /* Reset specific border-radius for stacked mobile view */
        border-radius: var(--card-border-radius);
    }
}

/* Research, Projects, Papers Sections (using .project-layout) */
.research-section,
.projects-section,
.papers-section {
    padding: var(--section-padding) 0;
}

.research-section h2, /* Main title for the research section */
.projects-section h2, /* Main title for projects if it had one (it uses h4 now) */
.papers-section h2 { /* Main title for papers */
    margin-bottom: 2.5rem; /* More space after main section titles */
}

.project-layout .project-text-column h2 { /* Titles of individual projects/papers */
    text-align: left; /* Align these specific h2s to the left */
    font-size: clamp(1.5rem, 3.5vw, 2rem); /* Slightly smaller than main section titles */
    color: var(--primary-accent-color); /* Greenish */
    margin-bottom: 0.75rem;
}
.project-layout .project-text-column .section-subtitle { /* "MSc. Final Project", "My Research" */
    text-align: left;
    margin-bottom: 0.25rem;
    font-size: clamp(1rem, 2vw, 1.1rem); /* Smaller than h4 default */
}


.paper-entry { /* For individual paper entries within .papers-section */
    margin-bottom: 2.5rem;
}
.paper-entry:last-child {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    /* Ensure consistent alternating layout for all project-layout sections */
    .research-section .project-image-column,
    .projects-section .project-text-column, /* Project section starts with text on left */
    .papers-section .project-image-column { /* Papers section starts with image on left */
        order: 1;
    }
    .research-section .project-text-column,
    .projects-section .project-image-column,
    .papers-section .project-text-column {
        order: 2;
    }
}


/* Footer Styles */
.footer-section {
    background-color: var(--card-bg-color); /* Darker footer background */
    padding: 2rem 0;
    margin-top: 3rem; /* Space above footer */
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.copyright-text {
    font-size: 0.9rem;
    color: #bbb; /* Lighter text for copyright */
    margin-bottom: 0; /* Remove bottom margin if it's the only item */
}
.copyright-text a {
    color: #bbb;
    text-decoration: underline;
}
.copyright-text a:hover {
    color: var(--link-color);
}

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

.social-links a {
    color: #bbb;
    font-size: 1.5rem; /* Size of social icons */
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-accent-color);
    text-decoration: none; /* No underline for icons */
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
}