/* --- Global Styles & Variables --- */
:root {
    --text-color: #333333;
    --background-color: #FFFFFF;
    --primary-color: #0056b3;
    --primary-hover-color: #003d82;
    --header-footer-bg: #f8f9fa;
    --border-color: #dee2e6;
}

html {
    scrollbar-gutter: stable;
}

/* --- Reset and Base Typography --- */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Link and Heading Styles --- */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

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

h1, h2 {
    line-height: 1.2;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2.2rem;
    margin: 0;
    text-align: center;
}

h2 {
    font-size: 1.8rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

h3 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 0.5em;
}

/* --- Main Layout Structure --- */
.container {
    width: 90%;
    max-width: 1024px;
    margin: 0 auto;
}

header h2 {
    font-size: 1.0rem;
    font-weight: normal;
    margin: 18px 0;
    text-align: center;
    color: #6c757d;
}

header, footer {
    background-color: var(--header-footer-bg);
    padding: 20px 0;    
    border-bottom: 1px solid var(--border-color);    
}

footer {
    margin-top: auto; /* Pushes footer to the bottom */
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    font-size: 0.9em;
    color: #6c757d;
    padding: 0;
    margin-top: 20px;
}

footer .container {
    padding: 10px 0;
    text-align: center;    
}


nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 20px;
}

nav li {
    width: 120px;
    text-align: center;
    padding: 0;
}

nav a {
    padding: 0px 10px;
    border-radius: 4px;
    font-weight: 500;
}

/* Style for the active page link */
nav a.active {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- Components --- */

/* About Section (Home Page) */
.about-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 30px;    
    /* margin-top: 1.5em; */
}

.about-text {
    flex: 1;
    min-width: 300px;
}



.profile-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    flex-shrink: 0; /* Prevent image from shrinking */
}

/* Publication Card (Publications Page) */
.significant-publications-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 1.5em;
}

.publication-card {    
    flex: 1 1 100%; /* On small screens, take full width */
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.publication-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
/* On larger screens, create a 3-column grid */
@media (min-width: 768px) {
    .publication-card {
        flex-basis: calc(33.333% - 14px); /* 33.333% minus a portion of the gap */
    }
}

.publication-card .toc-figure {
    width: 100%;
    height: 180px;
    background-color: var(--header-footer-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.publication-card .toc-figure img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    border-radius: 4px; /* Match the container's border-radius */
}

.publication-card p {    
    text-align: center;
    margin: 0; /* Remove default paragraph margin for better alignment */
}

.publication-card a {
    color: var(--text-color);
}

/* Publication List (Publications Page) */
.publications-list {
    list-style: decimal-leading-zero;
    padding-left: 2em;
}

.publications-list li {
    margin-bottom: 1.5em;
}

.publications-list a {
    color: var(--text-color);
}

.publications-list li em {
    font-style: italic;
}

/* CV Download Button */
.cv-download-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--background-color);
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    margin-top: 1em;
    transition: background-color 0.2s ease-in-out;
}

.cv-download-link:hover {
    background-color: var(--primary-hover-color);
    color: var(--background-color);
    text-decoration: none;
}

/* Contact List */
.contact-list {
    margin-top: 1.5em;
}

.contact-list dt {
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 1em;
}

.contact-list dd {
    margin-left: 0;
    margin-bottom: 0.5em;
}

/* --- Page-Specific Layouts --- */

/* Project Item Layout (Used on Home and Projects pages) */
.projects-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.project-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 1em 0;
    font-size: 0.95em;
    color: #555;
}

.project-meta li {
    margin-bottom: 0.3em;
}

.project-item p {
    text-align: justify;
}

/* Latest Publications List (Home Page) */
.latest-publication ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.latest-publication li {
    margin-bottom: 0.5em;
}

/* Two-Column Layout (Home Page) */
.two-column-container {
    display: flex;
    flex-wrap: wrap;
    column-gap: 40px;    
    row-gap: 0px;
}

.current-project, .latest-publications {
    flex: 1;
    min-width: 300px; /* Ensures columns wrap on smaller screens */
}

@media (max-width: 550px) {
    .about-section {
        flex-direction: column-reverse; /* Stack image on top of text */
        align-items: center;
        margin-top: 1em;   
        row-gap: 0px;     
        column-gap: 0px;
    }
    .about-section h2{
        margin-top: 0.5em;
    }
    
    /* .two-column-container {
        gap: 0px;    
        row-gap: 0px;     
        column-gap: 0px;
    
    } */
}