/* ---
Theme: Minimalist Green
--- */

/* --- 1. Variables & Global Styles --- */
:root {
    --font-serif: 'Crimson Text', serif;
    --font-sans: 'Manrope', sans-serif; /* For titles */

    /* Light Theme */
    --color-bg: #fdfdfd;
    --color-text: #222; /* Dark Gray */
    --color-accent: #008060; /* Professional Green */
    --color-accent-hover: #00664d; /* Darker Green */
    --color-border: #eee;
    --color-secondary: #777; /* Lighter gray for subtitles/dates */
    --color-card-bg: transparent; /* No card background */
    --color-underline: rgba(0, 128, 96, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 10px;
}

body {
    font-family: var(--font-serif);
    background-color: var(--color-bg);
    color: var(--color-text);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

strong, b {
    font-weight: 600;
}

.page-wrapper {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem 3rem;
    max-width: 800px;
    width: 100%;
    margin: 1rem auto;
    padding: 0 2rem 0 0;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: var(--font-sans);
    margin-bottom: 0.4em;
    color: var(--color-text);
    transition: color 0.3s ease;
    scroll-margin-top: 100px;
}

h1 { font-size: clamp(2.2em, 5vw, 2.8em); }
h3 { font-size: clamp(1.2em, 3vw, 1.4em); margin-top: 1.2em; }
h4 { font-size: 1.1em; margin-bottom: 0.2em; }
p { margin-bottom: 0.7em; font-size: 1.05em; font-family: var(--font-serif); }

/* Links - Light Mode */
a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--color-underline);
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    transition: color 0.2s ease-in-out, text-decoration-color 0.2s ease-in-out;
}
a:hover, a:focus {
    color: var(--color-accent-hover);
    text-decoration-color: var(--color-accent-hover);
    outline: none;
}
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Remove underline from internal links and button-like links */
a[href^="#"],
.publication-links a,
.card-banner .artifact-links a {
    text-decoration: none;
}

img { max-width: 100%; height: auto; display: block; }

.card-banner[id] { scroll-margin-top: 100px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.main-content {
    padding-top: 0rem; /* Align top with header text */
    margin-top: -0.5rem;
}

/* ICLR publication banner */
.iclr-banner {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 128, 96, 0.08);
    border: 1px solid rgba(0, 128, 96, 0.25);
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.2s ease, border-color 0.2s ease;
}
.iclr-banner:hover {
    background: rgba(0, 128, 96, 0.14);
    border-color: rgba(0, 128, 96, 0.4);
    color: var(--color-text);
}
.iclr-banner-text {
    font-size: 0.95em;
    flex: 1;
    min-width: 0;
}
.iclr-banner-link {
    font-family: var(--font-sans);
    font-size: 0.9em;
    color: var(--color-accent);
    white-space: nowrap;
}

/* --- 2. Header & Navigation --- */
.site-header {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 3rem;
    align-self: start;
    align-items: flex-end;
    text-align: right;
    height: calc(100vh - 8rem);
}
.header-profile {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.header-profile .avatar {
    width: 100px;        
    border-radius: 50%;
    margin-bottom: 1rem;
    border: 2px solid var(--color-border);
}
.header-profile .name {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 1em;
    line-height: 1.2;
}
.site-header nav { width: 100%; } /* Pushes footer down */
.site-header nav ul { list-style: none; }
.site-header nav ul li { margin-bottom: 0.1em; }
.site-header nav ul li a { 
    color: var(--color-secondary);
    font-family: var(--font-sans);
    transition: color 0.2s ease-in-out;
}
.site-header nav ul li a.active,
.site-header nav ul li a:hover, .site-header nav ul li a:focus { color: var(--color-accent); }

.header-footer {
    margin-top: 0.2rem;

}

/* Dark Mode Toggle Button */
#darkModeToggle { background: none; border: none; cursor: pointer; transition: transform 0.2s ease-in-out; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; }
#darkModeToggle:hover { transform: scale(1.1); }
#darkModeToggle:focus-visible { outline: 2px solid var(--color-text); outline-offset: 2px; }
#darkModeIcon { margin: 0; padding: 0; line-height: 1; transition: color 0.3s ease; }
#darkModeIcon.fa-moon { color: var(--color-secondary); }

/* --- 3. Page Sections --- */


.profile-links { margin-top: 1.5em; display: flex; flex-wrap: wrap; gap: 0.5rem 1.9rem; align-items: center; }
.profile-links a {
    font-size: 0.8em;
    font-family: var(--font-sans);
}

/* Vertical Section Titles */
.section-title-vertical {
    position: absolute;
    top: 0.5rem;
    right: 0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--font-sans);
    color: var(--color-secondary);
    opacity: 0.7;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    user-select: none;
}

/* --- Experience Timeline Section (Simplified to a list) --- */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.timeline-item + .timeline-item {
    margin-top: 2rem;
}

.timeline-item {
    list-style: none;
    padding: 0;
}

.timeline-details-hidden {
    display: none;
}

.timeline-content {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    position: relative;
    padding: 0;
}

.timeline-content:hover { background-color: var(--color-card-bg); }

.center-side {
    flex-grow: 1;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.timeline-dates {
    color: var(--color-secondary);
    font-size: 0.9em;
    flex-shrink: 0;
}
.timeline-company { font-size: 1.1em; font-weight: 600; line-height: 1.2; margin-bottom: 0.1em; }

/* New wrapper for flex alignment */
.timeline-role-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: baseline; /* Aligns the text baseline of the role and the [more] button */
}

.timeline-role {
    color: var(--color-secondary);
    font-size: 1em;
    margin-bottom: 0; /* Remove bottom margin as it's now in a flex container */
}
.timeline-role a.interactive-link { position: relative; z-index: 2;} /* Keep nested links clickable */
.timeline-description { font-size: 1em; margin-top: 0.4em; margin-bottom: 0; color: var(--color-text); }
.timeline-description {
    font-size: 1em;
    margin-top: 0.4em;
    margin-bottom: 0;
    color: var(--color-text);
    padding: 0;
    border-radius: 4px;
    transition: padding 0.2s ease, background-color 0.2s ease, margin-top 0.2s ease;
}
.timeline-content.is-expanded .timeline-description {
    background-color: rgba(0, 128, 96, 0.07);
    padding: 0.8em 1em;
    margin-top: 0.6em;
}
.timeline-description ul {
    list-style: disc;
    padding-left: 1.5em;
    margin: 0;
    font-size: 1em;
    line-height: 1.4;
}
.timeline-description ul li {
    margin-bottom: 0.4em;
}

/* The link is now a flex item, not a full-card overlay */
.timeline-role-wrapper a.timeline-link-overlay {
    /* Reset any potential inherited link styles */
    text-decoration: none;
    /* Style it to look like the button text */
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-secondary);
    cursor: pointer;
}

.timeline-content.is-expandable .timeline-role-wrapper a.timeline-link-overlay::after {
    content: '[more]';
}
.timeline-content.is-expanded .timeline-role-wrapper a.timeline-link-overlay::after {
    content: '[less]';
}

.experience-timeline-section {
    margin-bottom: 4rem;
}

.about-section,
.publications-section,
.research-section,
.projects-experiences-section,
.contact-section {
    position: relative;
    padding-right: 3rem; /* Space for vertical title */
    margin-bottom: 4rem;
}

.experience-timeline-section h3,
.publications-section h3,
.research-section h3,
.projects-experiences-section h3 { margin-top: 2.5em; margin-bottom: 1em; font-size: 1.1em; font-weight: 600; border-bottom: 1px solid var(--color-border); padding-bottom: 0.5em; }
h3 { margin-top: 1.2em; margin-bottom: 1em;  }
.research-section .featured-projects-section h3 { margin-top: 0; }
.research-section > p:first-of-type { font-size: 0.9em; font-style: italic; color: var(--color-secondary); margin-top: -0.8em; margin-bottom: 1.5em; transition: color 0.3s ease; }
.featured-projects-section { margin-bottom: 2.5em; }
.project-horizontal-list { display: flex; flex-direction: column; gap: 1.5em; }

/* Publication List Styling */
.publications-list { list-style: none; padding-left: 0; }
.publications-list li { margin-bottom: 1.5em; padding-left: 0; position: relative; line-height: 1.5; display: flex; flex-direction: column; align-items: flex-start; }
.publication-title { display: block; font-style: normal; margin-bottom: 0.1em; font-size: 1.1em; font-weight: normal; }
.publication-title strong { color: var(--color-text); }
.publication-authors { display: block; margin-bottom: 0.1em; font-size: 1em; color: var(--color-secondary); transition: color 0.3s ease; }
.publication-authors strong { color: var(--color-text); }
.publication-venue { display: block; font-size: 1em; font-style: italic; color: var(--color-secondary); margin-top: 0.1em; margin-bottom: 0.2em; transition: color 0.3s ease; }
.publication-description { display: block; margin-bottom: 0.1em; font-size: 1.05em; transition: color 0.3s ease; }

/* Make description text secondary color only in the miscellaneous/recognition section */
#honors .publication-description { color: var(--color-secondary); }
.publication-links { flex-shrink: 0; margin-top: 0.3em; font-size: 0.85em; white-space: normal; align-self: flex-start; }

.publication-links a,
.card-banner .artifact-links a {
    display: inline-block;
    font-size: 0.85em;
    line-height: 0.9rem;
    color: var(--color-accent);
    padding: 0.25em 0.6em;
    border: 1px solid var(--color-accent);
    border-radius: 15px;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    margin-right: 0.8em;
    margin-bottom: 0.5em;
}
.publication-links a:hover, .publication-links a:focus,
.card-banner .artifact-links a:hover, .card-banner .artifact-links a:focus { background-color: var(--color-accent); color: var(--color-bg); outline: none; }
.publication-links a i, .project-links a i { color: var(--color-accent); vertical-align: -0.1em; margin: 0; line-height: 1; }
.publication-links a:hover i, .project-links a:hover i, .publication-links a:focus i, .project-links a:focus i { color: var(--color-accent); }

.projects-experiences-section h3:first-of-type { margin-top: 0; }
.card-banner-container { display: flex; flex-direction: column; gap: 2rem; margin-bottom: 2.5em; }
.card-banner { background-color: transparent; border: none; padding: 0; display: flex; align-items: flex-start; gap: 1.5em; }
.card-banner img { display: none; }
.card-banner-text { flex-grow: 1; }
.card-banner h4 { margin-bottom: 0.1em; font-size: 1.1em; font-weight: 600; }
.card-banner .role-dates { color: var(--color-secondary); font-size: 1em; margin-bottom: 0.6em; transition: color 0.3s ease; }
.card-banner .artifact-links { margin-bottom: 0.6em; line-height: 1.2; }
.card-banner ul { list-style: disc; padding-left: 1.5em; margin-bottom: 0; margin-top: 0.5em; }
.card-banner ul li { font-size: 1.05em; margin-bottom: 0.4em; line-height: 1.3; }

/* --- 5. Footer & Contact --- */
.contact-section p { line-height: 1.7; }

/* Use sans-serif for the intro sentence in the contact section */
.contact-section p:first-of-type {
    font-family: var(--font-sans);
    font-size: 0.95em;
}
.contact-section .linkedin-icon {
    display: inline;
    vertical-align: middle;
    padding: 0 3px;
    width: 21px;
}

/* Footer */
.site-footer { text-align: left; margin-top: 5rem; padding-top: 2rem; border-top: 1px solid var(--color-border); font-size: 0.9em; color: var(--color-secondary); transition: border-top-color 0.3s ease, color 0.3s ease, background-color 0.3s ease; }
.site-footer p { margin-bottom: 0.2em; }

/* --- 6. Responsive Adjustments --- */
@media (max-width: 900px) {
    .page-wrapper {
        display: block;
        margin: 0;
        padding: 2rem 1.5rem;
    }
    .site-header {
        position: static;
        height: auto;
        margin-bottom: 3rem;
        align-items: flex-start;
        text-align: left;
    }
    .header-profile {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    .header-profile .avatar {
        width: 70px;
        margin-bottom: 0;
    }
    .header-profile .subtitle { display: none; }
    .site-header nav { margin-bottom: 1rem; }
    .site-header nav ul {
        display: grid;
        /* Automatically fit columns, with a minimum width, creating a dynamic grid */
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 0.5rem 1rem;
    }
    .header-footer { display: none; } /* Hide toggle, can be repositioned if needed */

    .section-title-vertical {
        position: static;
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 1.2em;
        font-weight: 600;
        opacity: 1;
        color: var(--color-text);
        border-bottom: 1px solid var(--color-border);
        padding-bottom: 0.5rem;
        margin-bottom: 1.5rem;
        letter-spacing: normal;
        text-transform: none;
    }

    /* On mobile, hide redundant headings to prevent duplicates. */
    /* For Research, hide the first h3 as it's redundant with the main section title. */
    .research-section h3:first-of-type {
        display: none;
    }
    /* For Projects and Honors, the h3 is the desired heading, so hide the vertical title instead. */
    #projects-experiences .section-title-vertical,
    #honors .section-title-vertical {
        display: none;
    }
    .main-content section { padding-right: 0; }

    .profile-links { justify-content: flex-start; margin-top: 1em; gap: 1.2em; }

    .site-footer {
        text-align: center;
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    body { font-size: 0.95em; }
    .site-header nav ul li { margin-right: 1em; margin-bottom: 0.5em; }
    #darkModeToggle { top: 0.4em; right: 10px; padding: 0.3em; }
    .publication-title, .publication-authors, .publication-venue { font-size: 0.95em; }
    .publication-links { font-size: 0.8em; }
    .publication-links a { padding: 0.15em 0.4em; margin-right: 0.5em; min-width: 2.2em; min-height: 2.2em; }
    .card-banner .artifact-links a { font-size: 0.8em; padding: 0.2em 0.5em; }
    .about-photo img { max-width: 150px; }
}

/* --- 7. Dark Mode Theme --- */
body.dark-mode {
    --color-bg: #1a1a1a;
    --color-text: #ddd;
    --color-accent: #34d399; /* Brighter Green */
    --color-accent-hover: #6ee7b7;
    --color-border: #333;
    --color-secondary: #888;
    --color-card-bg: transparent;
    --color-underline: rgba(52, 211, 153, 0.4); /* From #34d399 */
}

body.dark-mode .iclr-banner {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.3);
}
body.dark-mode .iclr-banner:hover {
    background: rgba(52, 211, 153, 0.16);
    border-color: rgba(52, 211, 153, 0.45);
}

body.dark-mode #darkModeIcon.fa-sun { color: #f9e2af; }
body.dark-mode #darkModeIcon.fa-moon { color: var(--color-secondary); }

body.dark-mode .timeline-content.is-expanded .timeline-description {
    background-color: rgba(52, 211, 153, 0.1);
}

body.dark-mode .company-logo-timeline { filter: brightness(.8) contrast(1.2); }

body.dark-mode .publication-links a:hover,
body.dark-mode .publication-links a:focus { background-color: var(--color-card-bg); border-color: var(--color-accent); color: var(--color-accent); }

body.dark-mode .card-banner img { filter: brightness(.8) contrast(1.2); }

body.dark-mode .card-banner .artifact-links a:hover,
body.dark-mode .card-banner .artifact-links a:focus {
    background-color: var(--color-accent);
    color: var(--color-bg);
    outline: none;
}