/* ===== Theme Variables ===== */
:root {
    --bg: #0a0a0a;
    --text: #c8c8c8;
    --text-heading: #f0f0f0;
    --text-secondary: #e0e0e0;
    --text-muted: #777;
    --text-subtle: #666;
    --text-dim: #555;
    --text-author-strong: #bbb;
    --text-affiliation-link: #888;
    --accent: #7c8aff;
    --accent-hover: #a0aaff;
    --accent-em: #a78bfa;
    --border: rgba(255, 255, 255, 0.06);
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-toggle: rgba(255, 255, 255, 0.08);
    --border-toggle-hover: rgba(255, 255, 255, 0.15);
    --border-toggle-active: rgba(255, 255, 255, 0.2);
    --toggle-active-bg: rgba(255, 255, 255, 0.04);
    --badge-bg: rgba(124, 138, 255, 0.06);
    --badge-border: rgba(124, 138, 255, 0.15);
    --photo-overlay: rgba(10, 10, 10, 0.3);
    --img-grayscale: 15%;
    --name-cn: #999;
    --footer-text: #333;
    --year-heading: #444;
    --contrib-lead: #c0c0c0;
}

[data-theme="light"] {
    --bg: #f7f7f5;
    --text: #333;
    --text-heading: #111;
    --text-secondary: #222;
    --text-muted: #666;
    --text-subtle: #777;
    --text-dim: #888;
    --text-author-strong: #222;
    --text-affiliation-link: #555;
    --accent: #4050c8;
    --accent-hover: #2e3ba8;
    --accent-em: #6b48b0;
    --border: rgba(0, 0, 0, 0.12);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-toggle: rgba(0, 0, 0, 0.18);
    --border-toggle-hover: rgba(0, 0, 0, 0.28);
    --border-toggle-active: rgba(0, 0, 0, 0.35);
    --toggle-active-bg: rgba(0, 0, 0, 0.06);
    --badge-bg: rgba(64, 80, 200, 0.1);
    --badge-border: rgba(64, 80, 200, 0.25);
    --photo-overlay: rgba(247, 247, 245, 0.3);
    --img-grayscale: 5%;
    --name-cn: #555;
    --footer-text: #999;
    --year-heading: #888;
    --contrib-lead: #333;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'General Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== Page ===== */
.page {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

/* ===== Content - Two Column ===== */
.content {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 4rem;
    min-height: 100vh;
    padding: 5rem 0 3rem;
}

/* ===== Sidebar (Left) ===== */
.sidebar {
    position: sticky;
    top: 3rem;
    align-self: start;
}

.photo-frame {
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
}

.photo-frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, var(--photo-overlay), transparent);
    pointer-events: none;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(var(--img-grayscale));
}

.identity {
    padding: 0 0.2rem;
}

.name {
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.name-cn {
    font-weight: 400;
    font-size: 0.85em;
    color: var(--name-cn);
}

.bio {
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
    letter-spacing: -0.01em;
    margin-top: 1.2rem;
    margin-bottom: 2rem;
}

.bio em {
    font-style: normal;
    color: inherit;
    font-weight: 500;
}

.affiliation {
    font-size: 0.8rem;
    color: var(--text-subtle);
    line-height: 1.5;
    margin-bottom: 1.2rem;
}

.affiliation a {
    color: var(--text-affiliation-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.links a {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-subtle);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ===== Main Content (Right) ===== */
.main-content {
    padding-top: 0.5rem;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.section-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    white-space: nowrap;
}

.section-link {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

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

/* ===== Project Grid ===== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
}

.project-card {
    padding: 1.15rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.project-name {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.project-role {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-card .pub-links {
    margin-top: 0.3rem;
}

/* ===== Publications ===== */

.pub-list {
    margin-bottom: 3rem;
}

.pub-item {
    padding: 1.2rem 0;
}

.pub-item:first-child {
    padding-top: 0;
}

.pub-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.pub-venue {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    line-height: 1;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    border-radius: 2px;
    font-size: 0.62rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.pub-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.pub-title a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.pub-authors {
    font-size: 0.82rem;
    color: var(--text-subtle);
    line-height: 1.55;
    margin-bottom: 0;
}

.pub-authors strong {
    color: var(--text-author-strong);
    font-weight: 600;
}

.pub-links {
    display: flex;
    gap: 0.8rem;
}

.pub-links a {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1;
}

.pub-links a:hover {
    color: var(--accent);
}

/* ===== Awards ===== */
.award-list {
    list-style: none;
    margin-bottom: 3rem;
}

.award-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.6rem 0;
    font-size: 0.86rem;
    line-height: 1.5;
}

.award-name {
    color: var(--text);
}

.award-name a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.award-name a:hover {
    color: var(--accent);
}

.award-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    white-space: nowrap;
    margin-left: 1rem;
}

/* ===== Misc ===== */
.misc {
    padding-top: 2rem;
}

.misc .section-label {
    display: block;
    margin-bottom: 0.6rem;
}

.misc-text {
    font-size: 0.88rem;
    color: var(--text-subtle);
    line-height: 1.65;
}

.misc-text em {
    font-style: italic;
    color: var(--accent-em);
}

/* ===== Footer ===== */
footer {
    border-top: 1px solid var(--border-subtle);
    padding: 2rem 2.5rem 3rem;
    text-align: center;
}

footer p {
    font-size: 0.7rem;
    color: var(--footer-text);
}

/* ===== Fade-in Animation ===== */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.85rem;
    transition: color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .page {
        padding: 0 1.5rem;
    }

    .content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 3rem 0 2rem;
    }

    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 1.5rem;
        align-items: end;
    }

    .photo-frame {
        margin-bottom: 0;
    }

    .links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    footer {
        padding: 2rem 1.5rem 3rem;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
}
