/* --- Global Styles & Variables --- */
:root {
    --primary-color: #333;
    --secondary-color: #5a67d8; /* A nice blue/purple for links */
    --background-color: #f7f7f7;
    --card-background: #ffffff;
    --text-color: #4a4a4a;
    --light-gray: #e2e8f0;
    --header-font: 'Montserrat', sans-serif;
    --body-font: 'Lato', sans-serif;
}

body {
    margin: 0;
    font-family: var(--body-font);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

p {
  text-align: justify;
}

/* --- Dynamic Background --- */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1; /* Puts it behind all other content */
}

/* --- Main Layout --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
    font-family: var(--header-font);
    color: var(--primary-color);
    font-size: 2.5rem;
    margin: 0;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
}

/* --- Navigation --- */
nav {
    margin-top: 1.5rem;
    border-top: 1px solid var(--light-gray);
    padding-top: 1rem;
}

.nav-link {
    font-family: var(--header-font);
    text-decoration: none;
    color: var(--text-color);
    margin: 0 1rem;
    padding: 0.5rem 0;
    font-weight: 700;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--secondary-color);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

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

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.nav-link.active {
    color: var(--secondary-color);
}

/* --- Page Content Styling --- */
main {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page {
    display: none; /* Hide all pages by default */
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block; /* Show only the active page */
}

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

h2 {
    font-family: var(--header-font);
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-top: 0;
}

/* --- Home Page Specifics --- */
.profile-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--light-gray);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bio {
    flex: 1;
}

.publication-link {
    display: inline-block;
    background-color: transparent;
    color: var(--secondary-color);
    padding: 0.25rem 0.75rem;
    margin-right: 0.5rem;
    border: 1px solid var(--light-gray);
    border-radius: 16px; /* Pill-like shape */
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.publication-link:hover,
.publication-link:focus {
    background-color: var(--secondary-color);
    color: var(--card-background);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}

/* --- CV/Button Styling --- */
.button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    transition: background-color 0.3s, transform 0.2s;
}

.button:hover {
    background-color: #434190;
    transform: translateY(-2px);
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--light-gray);
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.2rem; /* Adjust size of icon if using an icon font */
    transition: all 0.3s ease;
}

.social-link:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-3px);
}

.footer-info {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
}

.footer-info a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer-info a:hover {
    text-decoration: underline;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .profile-container {
        flex-direction: column;
        text-align: center;
    }

    .nav-link {
        margin: 0 0.5rem;
    }

    .research-sub-nav {
        flex-direction: column;
        align-items: stretch;
        border-bottom: none; /* Remove the container's border */
    }

    .sub-nav-link {
        text-align: center;
        border-bottom: 1px solid var(--light-gray);
        margin: 0;
        padding: 0.75rem 1rem; /* Adjust padding for better touch targets */
    }

    .sub-nav-link:last-child {
        border-bottom: none;
    }

    .sub-nav-link::after {
        bottom: 0; /* Adjust underline position */
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    header, main {
        padding: 1.5rem;
    }
    nav {
        display: flex;
        justify-content: space-around;
    }
    .nav-link {
        margin: 0;
    }
}

/* --- Research Sub-Navigation --- */
.research-sub-nav {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}

.sub-nav-link {
    font-family: var(--header-font);
    text-decoration: none;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}

.sub-nav-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -1px; /* Aligns with the container's border */
    left: 0;
    background-color: var(--secondary-color);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

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

.sub-nav-link:hover::after,
.sub-nav-link.active::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.sub-nav-link.active {
    color: var(--secondary-color);
}

.sub-page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.sub-page.active {
    display: block;
}

/* --- Research Content Specifics --- */
.research-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.research-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.research-card h3 {
    font-family: var(--header-font);
    color: var(--secondary-color);
    margin-top: 0;
    font-size: 1.2rem;
}

.research-card p {
    font-size: 1rem;
    line-height: 1.7;
}

.role-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.role-header h3 {
    margin: 0;
}

.role-header .date-range {
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
}

.bordered-highlight {
    background: #f9f9f9;
    border-left: 3px solid var(--secondary-color);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0 4px 4px 0;
}

.bordered-highlight p {
    margin: 0;
}

.publication-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.publication-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.publication-card h3 {
    font-family: var(--header-font);
    color: var(--secondary-color);
    margin-top: 0;
    font-size: 1.2rem;
    padding-right: 30px;
}

.publication-card .authors {
    font-style: italic;
    color: #666;
    margin-bottom: 0.5rem;
}

.publication-card .journal {
    font-weight: 700;
    margin-bottom: 1rem;
}

.publication-card .description {
    font-size: 1rem;
    line-height: 1.7;
}

.publication-card .publication-link {
    margin-top: 1rem;
}

.publication-card .unfold-button {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: 1px solid var(--light-gray);
    color: var(--text-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 22px;
    text-align: center;
    transition: all 0.3s ease;
    transform: rotate(180deg);
}

.publication-card .unfold-button:hover {
    background-color: var(--secondary-color);
    color: white;
}

.publication-card .unfold-button.unfolded {
    transform: rotate(0deg);
}

.foldable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.foldable-content.unfolded {
    max-height: 1000px; /* A large enough value to show all content */
    transition: max-height 0.5s ease-in;
}

.publication-card .toggle-title {
    cursor: pointer;
    display: inline-block;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease, background-color 0.3s ease;
}

.publication-card .toggle-title:hover {
    color: var(--secondary-color);
    text-shadow: 0 0 16px rgba(90, 103, 216, 0.5);
    text-decoration: underline;
}
