/* CSS Variables */
:root {
    --primary-color: #2c3e50;
    /* Deep Blue/Slate */
    --accent-color: #3498db;
    /* Bright Blue for links/actions */
    --bg-color: #ffffff;
    --sidebar-bg: #f8f9fa;
    /* Light Gray for Sidebar */
    --text-color: #333333;
    --light-text: #666666;
    --border-color: #e0e0e0;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
    --sidebar-width: 300px;
    --content-max-width: 1100px;
    /* Increased width */
}

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

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

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

a:hover {
    color: #1d6fa5;
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* Layout Grid */
.container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    background-color: var(--sidebar-bg);
    padding: 3rem 2rem;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.profile-section {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-photo-container {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.name {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.title {
    font-weight: 700;
    color: var(--light-text);
    margin-bottom: 0.2rem;
}

.university {
    color: var(--light-text);
    font-size: 0.9rem;
}

.contact-section {
    margin-top: 1rem;
}

.contact-list li {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    color: var(--link-text);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

/* About Section Layout */
.about-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 900px) {
    .about-container {
        grid-template-columns: 2fr 1fr;
        /* Text takes more space, images on the right */
        align-items: start;
    }
}

.about-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.about-img {
    width: 100%;
    aspect-ratio: 4/3;
    /* Standard photo ratio */
    background-color: #eee;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.img-copyright {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.5rem;
}

.about-bottom-img {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.contact-list i {
    color: var(--light-text);
    width: 20px;
    text-align: center;
}

.social-links {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.social-links a {
    color: var(--primary-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.social-links a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--light-text);
    text-align: center;
}

/* Main Content Styles */
.main-content {
    padding: 4rem 5rem;
}

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
    display: none;
}

/* Top Navigation */
.top-nav {
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.top-nav ul {
    display: flex;
    gap: 2rem;
}

.top-nav a {
    color: var(--light-text);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    padding-bottom: 5px;
    position: relative;
}

.top-nav a:hover,
.top-nav a.active {
    color: var(--primary-color);
    text-decoration: none;
}

.top-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
}

/* Section Styles */
.content-section {
    margin-bottom: 5rem;
    max-width: var(--content-max-width);
    scroll-margin-top: 100px;
    /* Offset for sticky headers if added later */
}

h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #444;
}

/* CV Entries */
.cv-entry {
    margin-bottom: 2rem;
}

.cv-date {
    font-weight: 700;
    color: var(--light-text);
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.cv-loc {
    font-style: italic;
    color: #555;
}

/* Citation List */
.citation-list li {
    display: flex;
    flex-wrap: wrap;
    /* Allows items to wrap if needed */
    align-items: baseline;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid #eee;
}

.citation-title {
    width: 100%;
    /* Forces title to its own line */
    font-weight: 700;
    margin-bottom: 0.3rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}


.citation-title a {
    color: inherit;
    text-decoration: none;
}

.citation-title a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.citation-year {
    font-weight: normal;
    font-size: 0.95rem;
    color: var(--light-text);
    margin-left: 1rem;
    white-space: nowrap;
}

.citation-authors {
    margin-right: auto;
    /* Pushes subsequent items (journal, DOI) to the far right */
    font-size: 0.95rem;
}

.citation-journal {
    color: var(--light-text);
    font-size: 0.95rem;
    /* margin-left removed */
}

.link-doi,
.link-pdf {
    font-size: 0.85rem;
    font-weight: 700;
    margin-left: 1rem;
    /* Space between journal and DOI */
}

.first-author {
    background-color: #fff9c4;
    /* Light yellow highlight */
    padding: 0 3px;
    border-radius: 2px;
}

.citation-note {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-bottom: 1rem;
    font-style: italic;
    display: block;
    text-align: right;
}

/* Award List */
.award-list li {
    display: flex;
    margin-bottom: 1rem;
    align-items: baseline;
}

.award-year {
    font-weight: 700;
    width: 60px;
    flex-shrink: 0;
    color: var(--primary-color);
}

/* Buttons */
.btn-download {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-weight: 700;
    margin-top: 1rem;
    text-decoration: none;
}

.btn-download:hover {
    background-color: #34495e;
    color: #fff;
    text-decoration: none;
}

/* Education & Experience Grid */
.education-grid {
    display: grid;
    grid-template-columns: 1.3fr 1.6fr 2.3fr 2fr 1.5fr;
    /* 5 columns: Date, Role, Dept, Location, Advisor */
    gap: 1rem;
    align-items: baseline;
    padding: 0.3rem 0;
}

.education-grid:last-child {
    border-bottom: none;
}


.education-grid:last-child {
    border-bottom: none;
}

.edu-role {
    font-weight: 700;
    color: var(--primary-color);
}

.edu-dept {
    font-weight: 700;
    color: var(--primary-color);
}

.edu-date {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: 700;
    text-align: left;
}

.edu-loc {
    text-align: left;
    /* Centered as requested */
    color: #444;
    margin-left: -0.5rem;
}

.edu-advisor {
    text-align: right;
    /* Right aligned as requested */
    font-style: normal;
    font-size: 0.9rem;
    color: #666;
}

.edu-note {
    grid-column: 2 / -1;
    font-size: 0.9rem;
    color: var(--light-text);
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

/* Service Grid - Matching Teaching Grid */
.service-grid {
    display: grid;
    grid-template-columns: 0.8fr 3fr 1.5fr;
    gap: 1rem;
    align-items: baseline;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.service-date {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.service-role {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1rem;
}

.service-note {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--light-text);
}

.service-loc {
    text-align: right;
    /* Right aligned as requested */
    color: #555;
    font-size: 0.9rem;
    font-style: italic;
}

/* Teaching Grid */
.teaching-grid {
    display: grid;
    grid-template-columns: 0.8fr 3fr 1.5fr;
    gap: 1rem;
    align-items: baseline;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.teach-date {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.teach-role {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1rem;
}

.teach-note {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--light-text);
}

.teach-loc {
    text-align: right;
    color: #555;
    font-size: 0.9rem;
    font-style: italic;
}

/* Awards Grid - Matching Teaching Grid */
.award-grid {
    display: grid;
    grid-template-columns: 0.8fr 3fr 1.5fr;
    gap: 1rem;
    align-items: baseline;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.award-date {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.award-role {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1rem;
}

.award-note {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--light-text);
}

.award-loc {
    text-align: right;
    color: #555;
    font-size: 0.9rem;
    font-style: italic;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        /* Transform sidebar into mobile header/drawer style in real implementation, 
           or stack it. For now, we'll stack it but make it collapsible or simpler */
        position: relative;
        height: auto;
        padding: 2rem;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
        text-align: center;
    }

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

    .contact-list li {
        justify-content: center;
    }

    .main-content {
        padding: 2rem;
        /* Reduced padding on mobile */
    }

    .education-grid {
        grid-template-columns: 1fr;
        /* Stack on small screens */
        text-align: left;
        gap: 0.5rem;
    }

    .edu-loc,
    .edu-advisor {
        text-align: left;
    }

    .edu-date {
        display: block;
        margin-left: 0;
        margin-top: 0.2rem;
    }

    .teaching-grid {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .teach-loc {
        text-align: left;
    }

    .award-grid {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .award-loc {
        text-align: left;
    }

    .top-nav {
        display: none;
        /* Hide top nav on mobile, use hamburger or simple stack */
    }

    /* Mobile Menu (simplified for this iteration: shows items in sidebar or top) 
        A better mobile nav requires JS to toggle.
        For this step, we'll just stack everything naturally. 
     */

    /* Responsive citations */
    .citation-list li {
        flex-direction: column;
    }

    .citation-authors,
    .citation-journal,
    .link-doi {
        margin: 0 0 0.2rem 0;
        text-align: left;
    }
}

/* Better Mobile Menu with JS Interaction */
@media (max-width: 768px) {
    .sidebar {
        display: none;
        /* Hide full sidebar initially on mobile to reduce scroll */
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
        background-color: var(--primary-color);
        color: white;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .mobile-title {
        font-family: var(--font-heading);
        font-weight: 700;
        font-size: 1.2rem;
    }

    .menu-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }

    .main-content {
        padding: 2rem 1.5rem;
    }

    /* Open State for Mobile Navigation (toggled by JS) */
    .sidebar.open {
        display: flex;
        position: fixed;
        top: 60px;
        /* Below mobile header */
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        z-index: 999;
    }
}

.service-subsection {
    color: black;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}