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

:root {
    --primary: #0f1419;
    --secondary: #ffffff;
    --accent: #2563eb;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --light-bg: #f9fafb;
    --border: #e5e7eb;
    --spacing: 1rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #f3f4f6;
        --secondary: #111827;
        --accent: #60a5fa;
        --text: #f3f4f6;
        --text-secondary: #d1d5db;
        --light-bg: #1f2937;
        --border: #374151;
    }
}

html.dark-mode {
    --primary: #f3f4f6;
    --secondary: #111827;
    --accent: #60a5fa;
    --text: #f3f4f6;
    --text-secondary: #d1d5db;
    --light-bg: #1f2937;
    --border: #374151;
}

html.light-mode {
    --primary: #0f1419;
    --secondary: #ffffff;
    --accent: #2563eb;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --light-bg: #f9fafb;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.65;
    color: var(--text);
    background: var(--secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    scroll-padding-top: 120px;
}

header {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--secondary);
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

nav {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.2rem 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

nav > .spacer {
    flex: 1;
}

.logo {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.3px;
    cursor: pointer;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    flex-wrap: wrap;
}

.nav-links button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
}

.nav-links a,
.nav-links button {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.25s ease;
    white-space: nowrap;
    cursor: pointer;
}

.nav-links a:hover,
.nav-links button:hover {
    color: var(--accent);
}

.nav-links a.active,
.nav-links button.active {
    color: var(--accent);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.25s ease, transform 0.25s ease;
    width: 28px;
    height: 28px;
}

.theme-toggle:hover {
    color: var(--accent);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 3.5rem 1rem;
}

.hero {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.hero-content h1 {
    font-size: 2.4rem;
    margin-bottom: 0.75rem;
    line-height: 1.1;
    word-break: break-word;
    font-weight: 400;
    letter-spacing: -0.5px;
    font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.hero-content .title {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.hero-content .subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.hero-content .contact {
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.hero-content .contact a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-word;
    font-weight: 500;
}

.hero-content .contact a:hover {
    text-decoration: underline;
}

.hero-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    margin-bottom: 0;
}

.hero-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.hero-links a:hover {
    text-decoration: underline;
}

.hero-image {
    text-align: center;
}

.hero-image img {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    object-fit: cover;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.bio p {
    margin-bottom: 1.25rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.bio a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.bio a:hover {
    text-decoration: underline;
}

section {
    margin-bottom: 4rem;
    scroll-margin-top: 120px;
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
    font-weight: 400;
    letter-spacing: -0.3px;
    font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.publication {
    margin-bottom: 2rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
}

.publication:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.publication h3 {
    font-size: 0.98rem;
    margin-bottom: 0.5rem;
    line-height: 1.45;
    font-weight: 600;
}

.publication h3 a {
    color: var(--accent);
    text-decoration: none;
}

.publication h3 a:hover {
    text-decoration: underline;
}

.publication .authors {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.55;
    word-break: break-word;
    font-weight: 500;
}

.publication .venue {
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-style: italic;
    word-break: break-word;
}

.pub-links {
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.pub-link,
.bibtex-btn {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin-right: 1rem;
}

.pub-link:hover {
    text-decoration: underline;
}

.bibtex-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
    transition: text-decoration 0.2s ease;
}

.bibtex-btn:hover {
    text-decoration: underline;
}

.bibtex-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.bibtex-modal.active {
    display: flex;
}

.bibtex-modal-content {
    background: var(--secondary);
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.bibtex-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.bibtex-modal-header h3 {
    font-size: 1.2rem;
    margin: 0;
}

.bibtex-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bibtex-close:hover {
    color: var(--text);
}

.bibtex-text {
    background: var(--light-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.bibtex-copy-btn {
    background: var(--accent);
    color: var(--secondary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.bibtex-copy-btn:hover {
    opacity: 0.9;
}

.bibtex-copy-btn.copied {
    background: #10b981;
}

.teaching-list {
    list-style: none;
}

.teaching-list li {
    margin-bottom: 2.5rem;
    padding-left: 0;
}

.teaching-list li:last-child {
    margin-bottom: 0;
}

.teaching-list h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: -0.2px;
}

.teaching-list .course {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.teaching-list .course a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.teaching-list .course a:hover {
    text-decoration: underline;
}

.teaching-list .institution {
    font-size: 1.05rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.teaching-list .course-title {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.2px;
}

.teaching-list .terms {
    margin-left: 0.5rem;
}

.teaching-list li:not(:last-child) {
    border-bottom: 1px solid var(--border);
    padding-bottom: 2.5rem;
}

footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }

    .logo {
        font-size: 1rem;
    }

    .nav-links {
        gap: 1.5rem;
        font-size: 0.85rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 2.5rem;
        padding-bottom: 2rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content .title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }

    .hero-image {
        display: none;
    }

    h2 {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    section {
        margin-bottom: 3rem;
    }

    .publication {
        margin-bottom: 1.75rem;
        padding-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    nav {
        padding: 0.75rem 1rem;
    }

    .logo {
        font-size: 0.95rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.8rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .hero-content h1 {
        font-size: 1.6rem;
        margin-bottom: 0.5rem;
    }

    .hero-content .title {
        font-size: 0.9rem;
    }

    .hero-content .subtitle {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .bio p {
        font-size: 0.9rem;
    }

    h2 {
        font-size: 1.05rem;
        margin-bottom: 1.25rem;
    }

    section {
        margin-bottom: 2.25rem;
    }

    .publication {
        margin-bottom: 1.5rem;
        padding-bottom: 1.25rem;
    }

    .publication h3 {
        font-size: 0.9rem;
    }

    .publication .authors,
    .publication .venue {
        font-size: 0.8rem;
    }

    .teaching-list li {
        margin-bottom: 1.25rem;
    }

    .teaching-list .course {
        font-size: 0.85rem;
    }

    .teaching-list .institution {
        font-size: 0.8rem;
    }
}
