/* ===== CSS Variables ===== */
:root {
    --bg: #ffffff;
    --text: #111111;
    --text-muted: #555555;
    --border: #e0e0e0;
    --link: #1a56a0;
    --link-hover: #0d3a72;
    --accent: #b91c1c;
    --badge-bg: #f3f4f6;
    --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Lora', Georgia, serif;
    --max-width: 860px;
}

[data-theme="dark"] {
    --bg: #111827;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #374151;
    --link: #60a5fa;
    --link-hover: #93c5fd;
    --accent: #f87171;
    --badge-bg: #1f2937;
}

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

html {
    scroll-behavior: smooth;
}

/* ===== Base ===== */
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: background 0.2s, color 0.2s;
}

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

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

strong {
    font-weight: 600;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--badge-bg);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--border);
}

/* ===== Page Layout ===== */
.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

/* ===== Profile Header ===== */
.profile-header {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.portrait {
    width: 180px;
    height: 220px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.profile-info {
    flex: 1;
}

.name {
    font-family: var(--font-serif);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.position {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

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

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

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.contact-links a {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

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

.bio {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

/* ===== Divider ===== */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ===== Sections ===== */
.section {
    margin-bottom: 0.5rem;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.section-note {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.subsection-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
    color: var(--text);
}


/* ===== Publications ===== */
.pub-group {
    margin-bottom: 1.75rem;
}

.venue-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.award-badge {
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--accent);
}

.publication {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border);
}

.pub-image {
    width: 180px;
    height: auto;
    flex-shrink: 0;
    border-radius: 6px;
}

.pub-content {
    flex: 1;
}

.pub-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
    line-height: 1.5;
}

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

.pub-venue {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.4rem;
}

.pub-links {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.pub-links a {
    color: var(--link);
    font-weight: 500;
}

/* ===== Teaching ===== */
.teaching-item {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.teaching-role {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.teaching-meta {
    display: block;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    margin-left: 0.5rem;
}

.mentoring-note {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--border);
}

/* ===== CV ===== */
.cv-item {
    margin-bottom: 1rem;
}

.cv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    flex-wrap: wrap;
}

.cv-date {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 400;
    white-space: nowrap;
}

.cv-detail {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.simple-list {
    list-style: none;
    font-size: 0.95rem;
}

.simple-list li {
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

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

/* ===== Footer ===== */
.footer {
    margin-top: 3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
    }

    .portrait {
        width: 140px;
        height: 170px;
    }

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

    .cv-row {
        flex-direction: column;
        gap: 0.1rem;
    }

    .publication {
        flex-direction: column;
    }

    .pub-image {
        width: 100%;
        height: auto;
        max-width: 200px;
        margin: 0 auto;
    }

    .theme-toggle {
        top: 0.75rem;
        right: 0.75rem;
    }
}
