/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b1a0a;
    --accent: #c4401a;
    --accent-light: #d4572f;
    --text: #2d2d2d;
    --text-light: #555;
    --bg: #fafafa;
    --bg-card: #ffffff;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --radius: 6px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', 'Segoe UI', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

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

a:hover {
    color: var(--accent-light);
}

/* ── Container ───────────────────────────────────── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ── Navigation ──────────────────────────────────── */
.navbar {
    background: var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.nav-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 60px;
}

.nav-name {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nav-name:hover {
    color: rgba(255,255,255,0.85);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 400;
    transition: background 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    margin: 5px 0;
    transition: 0.3s;
}

/* ── About Section ───────────────────────────────── */
.about-section {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    padding: 3rem 0 2rem;
}

.about-photo {
    flex-shrink: 0;
}

.about-photo img {
    width: 200px;
    height: 240px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.about-text h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.bio {
    margin-bottom: 1rem;
    color: var(--text);
}

.bio-link {
    color: var(--text-light);
    text-decoration: underline;
}

.bio-link:hover {
    color: var(--accent);
}

.contact-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.25rem;
}

.contact-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.2s;
}

.contact-links a:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

/* ── Page Header ─────────────────────────────────── */
.page-header {
    padding: 2.5rem 0 1rem;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── Research Sections ───────────────────────────── */
.research-category {
    margin-bottom: 2.5rem;
}

.research-category h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.paper {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.paper:last-child {
    border-bottom: none;
}

.paper-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.paper-authors {
    font-size: 0.92rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.paper-venue {
    font-size: 0.92rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.paper-status {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 3px;
    background: #fdf0ec;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.paper-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.paper-links a {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    transition: all 0.2s;
}

.paper-links a:hover {
    background: var(--accent);
    color: #fff;
}

/* Abstract toggle */
details.paper-abstract {
    margin-top: 0.5rem;
}

details.paper-abstract summary {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    display: inline-block;
    transition: all 0.2s;
    list-style: none;
}

details.paper-abstract summary::-webkit-details-marker {
    display: none;
}

details.paper-abstract summary:hover {
    background: var(--accent);
    color: #fff;
}

details.paper-abstract .abstract-content {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #fdf5f2;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.93rem;
    line-height: 1.65;
    color: var(--text-light);
}

/* ── Works in Progress ───────────────────────────── */
.wip-list {
    list-style: none;
}

.wip-list li {
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.98rem;
}

.wip-list li:last-child {
    border-bottom: none;
}

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

/* ── Teaching ────────────────────────────────────── */
.course {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 3px solid var(--accent);
}

.course h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.course-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.course p {
    font-size: 0.95rem;
    color: var(--text);
}

/* ── CV Page ─────────────────────────────────────── */
.cv-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s;
}

.cv-download:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}

.cv-embed {
    margin-top: 2rem;
    width: 100%;
    height: 800px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ── Footer ──────────────────────────────────────── */
footer {
    margin-top: auto;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--text-light);
    text-decoration: underline;
}

/* ── Dark Mode ───────────────────────────────────── */
[data-theme="dark"] {
    --primary: #e0e0e0;
    --accent: #e8784a;
    --accent-light: #f09070;
    --text: #e0e0e0;
    --text-light: #aaa;
    --bg: #1a1a1a;
    --bg-card: #242424;
    --border: #3a3a3a;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .navbar {
    background: #111;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

[data-theme="dark"] .paper {
    border-bottom-color: #333;
}

[data-theme="dark"] .wip-list li {
    border-bottom-color: #333;
}

[data-theme="dark"] .paper-status {
    background: #3a2015;
}

[data-theme="dark"] details.paper-abstract .abstract-content {
    background: #2e1a10;
}

[data-theme="dark"] .contact-links a {
    background: #333;
}

[data-theme="dark"] footer {
    border-top-color: #333;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
    margin-left: 0.75rem;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 700px) {
    .about-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
        padding: 2rem 0;
    }

    .about-photo img {
        width: 160px;
        height: 200px;
    }

    .contact-links {
        justify-content: center;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--primary);
        flex-direction: column;
        padding: 1rem 2rem;
        gap: 0;
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 1rem;
    }

    .course {
        padding: 1rem;
    }
}
