/* ========== CSS Variables & Theme ========== */
:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-secondary: #555770;
    --color-primary: #2563eb;
    --color-primary-light: #dbeafe;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-shadow: rgba(0, 0, 0, 0.06);
    --color-shadow-hover: rgba(0, 0, 0, 0.1);
    --color-venue-bg: #eff6ff;
    --color-venue-text: #1e40af;
    --color-tag-bg: #f0f4ff;
    --color-tag-text: #3b5bdb;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-width: 860px;
    --radius: 10px;
    --transition: 0.3s ease;
}

[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-bg-alt: #1e293b;
    --color-surface: #1e293b;
    --color-text: #e2e8f0;
    --color-text-secondary: #94a3b8;
    --color-primary: #60a5fa;
    --color-primary-light: #1e3a5f;
    --color-border: #334155;
    --color-border-light: #1e293b;
    --color-shadow: rgba(0, 0, 0, 0.2);
    --color-shadow-hover: rgba(0, 0, 0, 0.35);
    --color-venue-bg: #1e3a5f;
    --color-venue-text: #93c5fd;
    --color-tag-bg: #1e293b;
    --color-tag-text: #93c5fd;
    --nav-bg: rgba(15, 23, 42, 0.85);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    transition: background-color var(--transition), color var(--transition);
}

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

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

/* ========== Navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition), border-color var(--transition);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.nav-logo:hover {
    text-decoration: none;
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    gap: 1.8rem;
}

.nav-links a {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}

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

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-left: 1rem;
}

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

.icon-moon {
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: none;
}

[data-theme="dark"] .icon-moon {
    display: block;
}

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all var(--transition);
}

/* ========== Hero Section ========== */
.hero {
    padding: 7rem 1.5rem 3rem;
    background: var(--color-bg);
    transition: background var(--transition);
}

.hero-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.hero-photo img {
    width: 140px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px var(--color-shadow);
}

.hero-info h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.3rem;
}

.name-cn {
    font-weight: 400;
    color: var(--color-text-secondary);
    font-size: 1.4rem;
}

.hero-tagline {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.15rem;
}

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

.hero-links {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    color: #fff;
}

.btn-outline {
    border: 1px solid var(--color-border);
    color: var(--color-text);
    background: var(--color-surface);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ========== Main Content ========== */
.content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* ========== Sections ========== */
.section {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

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

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.section p {
    color: var(--color-text-secondary);
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.section a {
    color: var(--color-primary);
}

/* Research Tags */
.research-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: var(--color-tag-bg);
    color: var(--color-tag-text);
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--transition);
}

/* ========== Paper Cards ========== */
.paper-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.paper-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    transition: all var(--transition);
}

.paper-card:hover {
    box-shadow: 0 4px 16px var(--color-shadow-hover);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.paper-venue {
    display: inline-block;
    background: var(--color-venue-bg);
    color: var(--color-venue-text);
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.paper-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.3rem;
    color: var(--color-text);
}

.paper-authors {
    font-size: 0.85rem;
    color: var(--color-text-secondary) !important;
    margin-bottom: 0.4rem !important;
}

.paper-link {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ========== Project Cards ========== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.project-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    transition: all var(--transition);
}

.project-card:hover {
    box-shadow: 0 4px 16px var(--color-shadow-hover);
    transform: translateY(-1px);
}

.project-date {
    font-size: 0.78rem;
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.project-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--color-text);
    line-height: 1.3;
}

.project-card ul {
    list-style: disc;
    padding-left: 1.2rem;
}

.project-card li {
    font-size: 0.83rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

/* ========== Timeline (Education) ========== */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.8rem;
    padding-left: 1.2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.45rem;
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    border: 2px solid var(--color-bg);
    margin-left: -4px;
}

.timeline-date {
    font-size: 0.82rem;
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.timeline-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.15rem;
}

.timeline-place {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
}

.timeline-detail {
    font-size: 0.83rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

/* ========== Experience ========== */
.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.8rem;
    margin-top: 1.5rem;
}

.subsection-title:first-of-type {
    margin-top: 0;
}

.experience-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    margin-bottom: 0.8rem;
    transition: all var(--transition);
}

.experience-card:hover {
    box-shadow: 0 4px 16px var(--color-shadow-hover);
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.15rem;
}

.experience-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.experience-date {
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 500;
    white-space: nowrap;
}

.experience-place {
    font-size: 0.85rem;
    color: var(--color-text-secondary) !important;
    margin-bottom: 0.5rem !important;
}

.experience-card ul {
    list-style: disc;
    padding-left: 1.2rem;
}

.experience-card li {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
    line-height: 1.5;
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--color-border-light);
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

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

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

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0.8rem;
        border-bottom: 1px solid var(--color-border);
    }

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

    .nav-hamburger {
        display: flex;
    }

    .nav-hamburger.open span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-hamburger.open span:nth-child(2) {
        opacity: 0;
    }

    .nav-hamburger.open span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .hero {
        padding: 5.5rem 1.5rem 2rem;
    }

    .hero-container {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .hero-photo img {
        width: 120px;
        height: 170px;
    }

    .hero-info h1 {
        font-size: 1.6rem;
    }

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

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

    .experience-header {
        flex-direction: column;
        gap: 0.2rem;
    }

    .section-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .hero-info h1 {
        font-size: 1.35rem;
    }

    .name-cn {
        font-size: 1.1rem;
    }

    .content {
        padding: 0 1rem 2rem;
    }
}

/* ========== Print ========== */
@media print {
    .navbar,
    .theme-toggle {
        display: none;
    }

    .hero {
        padding-top: 1rem;
    }

    .fade-in {
        opacity: 1;
        transform: none;
    }
}
