/* --- Color Variables for Light & Dark Mode --- */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --heading-color: #222222;
    --border-color: #eaeaea;
    --link-color: #0056b3;
    --link-hover: #000000;
    --footer-text: #666666;
}

body.dark-mode {
    --bg-color: #1a1a1a; 
    --text-color: #d1d1d1;
    --heading-color: #ffffff;
    --border-color: #333333;
    --link-color: #58a6ff; 
    --link-hover: #79c0ff;
    --footer-text: #999999;
}

/* --- Base Layout & Centered Column --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 300; 
    line-height: 1.6;
    font-size: 1.1rem;
    
    max-width: 920px;
    margin: 0 auto;
    padding: 0 20px; 
    
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease; 
}

a {
    color: var(--link-color);
}

/* --- Clean Minimalist Academic Menu --- */
.nav-menu {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 15px; 
    padding: 30px 0 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    
    /* Sticky Navigation */
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-color);
}
.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 300; 
    font-size: 1.05em;
}
.nav-menu a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}
.nav-menu a.nav-name {
    font-size: 1.5em;
    font-weight: 600; 
    color: var(--heading-color);
}
.nav-menu a[href="./research.html"] {
    margin-left: auto; 
}
.nav-menu a.no-op {
    pointer-events: none; 
    cursor: default;
    color: var(--heading-color);
    text-decoration: none;
}

/* --- Jump Menu --- */
.jump-menu {
    text-align: center;
    font-size: 0.95em;
    margin-bottom: 35px;
    font-weight: 300;
}
.jump-menu a {
    text-decoration: none;
    color: var(--text-color);
    padding: 0 6px;
    white-space: nowrap; /* Prevents the text from splitting across lines */
}
.jump-menu a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}


/* Dark Mode Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    color: var(--text-color);
}

/* --- Profile Picture Text Wrapping (Right Aligned) --- */
.profile-pic {
    float: right; 
    width: 100%;
    max-width: 260px; 
    height: auto;
    margin: 5px 0 20px 30px; 
    border-radius: 6px; 
}

/* --- Typography --- */
h3 {
    font-size: 1.25em; 
    font-weight: 600;
    color: var(--heading-color);
    margin-top: 25px; 
    margin-bottom: 10px; 
    scroll-margin-top: 100px; /* Prevents sticky nav from covering headings */
}

#foundations, #ddg, #feec {
    scroll-margin-top: 20vh; 
}

h4 {
    font-size: 1.2em; 
    font-weight: 500;
    color: var(--heading-color);
    margin-top: 15px; 
    margin-bottom: 5px; 
}
strong {
    font-weight: 500; /* Softened bold */
    color: var(--heading-color);
}

hr {
    clear: both; 
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 30px 0;
}

/* --- Description Lists (News & Talks Grid) --- */
.news-container {
    max-height: 300px; 
    overflow-y: auto;
    margin: 0 0 20px 0; 
}
.news-list {
    display: grid;
    grid-template-columns: 100px 1fr; 
    margin: 0;
    padding: 0;
}
.talks-list {
    display: grid;
    grid-template-columns: 75px 1fr; 
    row-gap: 4px;
    margin: 0;
    padding: 0;
}

/* Shared styles for both lists */
.news-list dt, .talks-list dt,
.news-list dd, .talks-list dd {
    padding: 8px 0;
    margin: 0;
}
.news-list dt, .talks-list dt {
    font-weight: 300; 
    color: var(--text-color);
}

/* --- Footer --- */
.footer {
    text-align: center;
    font-size: 0.85em; 
    color: var(--footer-text);
    line-height: 1.5;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .profile-pic {
        float: none; 
        display: block;
        margin: 0 auto 20px auto; 
    }
    
    h3, #foundations, #ddg, #feec {
        scroll-margin-top: 180px; 
    }
    
    .nav-menu {
        justify-content: center;
    }
    .nav-menu a.nav-name {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    .nav-menu a[href="./research.html"] {
        margin-left: 0; 
    }
    
    /* Stack grid elements vertically on mobile */
    .news-list, .talks-list {
        grid-template-columns: 1fr; 
        row-gap: 0;
    }
    .news-list dt, .talks-list dt {
        padding-bottom: 0;
        font-weight: 400;
        color: var(--heading-color);
    }
    .news-list dd, .talks-list dd {
        padding-top: 0;
        margin-bottom: 8px;
    }
}