/* Color System */
:root {
    --bg-color: #faf9f6;          /* Soft paper background */
    --text-main: #1c1917;         /* Warm charcoal text */
    --text-muted: #78716c;        /* Muted brown-grey */
    --link-color: #1d4ed8;        /* Subtle blue link */
    --border-color: #e7e5e4;      /* Light border */
    --btn-hover: #f5f5f4;
    
    --font-serif: 'Newsreader', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
}

/* Dark Mode Palette */
[data-theme="dark"] {
    --bg-color: #18181b;          /* Soft matte black */
    --text-main: #f4f4f5;         /* Soft off-white */
    --text-muted: #a1a1aa;        /* Muted slate grey */
    --link-color: #60a5fa;        /* Light blue link */
    --border-color: #27272a;      /* Dark border */
    --btn-hover: #27272a;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    /* transition: background-color 0.2s ease, color 0.2s ease; */
}

/* Page Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* Balanced Header & Navigation */
.site-header {
    margin-bottom: 3.5rem;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.nav-brand {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
}

.nav-brand:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.nav-links a:hover {
    color: var(--text-main);
}

/* Dark Mode Button */
.theme-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.theme-btn:hover {
    background-color: var(--btn-hover);
    color: var(--text-main);
}

/* Headings */
h1 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 0.2rem;
}

h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 1.2rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2.5rem 0;
}

/* Intro Section */
.intro-grid {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 2rem;
    align-items: start;
}

.affiliation {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.bio {
    margin-bottom: 1rem;
    font-size: 0.98rem;
}

.intro-image img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.quick-links {
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.quick-links a {
    margin: 0 0.2rem;
}

/* News List */
.news-list {
    list-style: none;
}

.news-list li {
    font-size: 0.92rem;
    margin-bottom: 0.5rem;
}

.news-list span {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.85rem;
    margin-right: 0.75rem;
}

.section-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -0.8rem;
    margin-bottom: 1rem;
}

/* Publications */
.pub-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pub-item {
    font-size: 0.95rem;
}

.pub-title a {
    color: var(--text-main);
    font-weight: 500;
}

.pub-title a:hover {
    color: var(--link-color);
}

.pub-authors {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.2rem 0;
}

.pub-authors strong {
    color: var(--text-main);
}

.pub-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.venue {
    color: var(--text-muted);
    font-style: italic;
}

.pub-links a {
    font-family: monospace;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
    font-size: 0.92rem;
}

.time-period {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.time-content p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

/* Simple List */
.simple-list {
    list-style: none;
}

.simple-list li {
    font-size: 0.92rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.simple-list .year {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Footer */
footer {
    margin-top: 4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    .nav-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .intro-grid {
        grid-template-columns: 1fr;
    }
    
    .intro-image {
        order: -1;
    }

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

    .pub-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .pub-links a {
        margin-left: 0;
        margin-right: 0.5rem;
    }
}

/* Project Feed & Cards */
.project-feed {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.project-card {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 1.5rem;
    align-items: start;
    padding-bottom: 2rem;
    border-bottom: 1px dashed var(--border-color);
}

.project-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-image img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--btn-hover);
}

.project-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-header {
    margin-bottom: 0.2rem;
}

.project-title {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.project-title a {
    color: var(--text-main);
}

.project-title a:hover {
    color: var(--link-color);
}

.project-role {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.15rem;
}

.project-text {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.project-text strong {
    font-weight: 600;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tech-tags span {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: var(--btn-hover);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

/* Responsive adjustment for mobile screens */
@media (max-width: 600px) {
    .project-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .project-image img {
        height: 160px;
    }
    
    .project-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Collapsible Project Details */
.project-details {
    margin-top: 0.5rem;
}

/* Remove default browser arrow marker */
.project-details summary::-webkit-details-marker {
    display: none;
}

.details-toggle {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--link-color);
    cursor: pointer;
    user-select: none;
    padding: 0.2rem 0;
    transition: opacity 0.15s ease;
}

.details-toggle:hover {
    text-decoration: underline;
}

.toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

/* Rotate arrow icon when open */
.project-details[open] .toggle-icon {
    transform: rotate(180deg);
}

.project-details[open] .toggle-text::after {
    content: " (Hide)";
}

/* Expanded Content Styling */
.details-content {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: fadeIn 0.25s ease-in-out;
}

.project-highlights {
    font-size: 0.88rem;
    color: var(--text-main);
    background-color: var(--btn-hover);
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-top: 0.2rem;
}

.project-highlights ul {
    margin-top: 0.3rem;
    padding-left: 1.2rem;
}

.project-highlights li {
    margin-bottom: 0.2rem;
}

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