/* ============================================
   CSS Variables & Theme
   ============================================ */
:root {
    /* Light theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fc;
    --bg-card: #ffffff;
    --bg-nav: rgba(255, 255, 255, 0.85);
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8a8aa0;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --accent-dark: #5348d6;
    --accent-gradient: linear-gradient(135deg, #6c5ce7, #a29bfe);
    --accent-gradient-hover: linear-gradient(135deg, #5348d6, #6c5ce7);
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(108, 92, 231, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --shadow-accent: 0 8px 30px rgba(108, 92, 231, 0.15);
    --badge-spotlight: linear-gradient(135deg, #f59e0b, #fbbf24);
    --badge-gold: linear-gradient(135deg, #eab308, #facc15);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 16px;
    --radius-sm: 10px;
    --max-width: 1200px;
}

[data-theme="dark"] {
    --bg-primary: #0d0d1a;
    --bg-secondary: #14142b;
    --bg-card: #1a1a2e;
    --bg-nav: rgba(13, 13, 26, 0.85);
    --text-primary: #e8e8f0;
    --text-secondary: #b0b0c8;
    --text-muted: #6a6a80;
    --accent: #a29bfe;
    --accent-light: #c4b8fd;
    --accent-dark: #6c5ce7;
    --accent-gradient: linear-gradient(135deg, #6c5ce7, #a29bfe);
    --accent-gradient-hover: linear-gradient(135deg, #5348d6, #6c5ce7);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(162, 155, 254, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 8px 30px rgba(162, 155, 254, 0.2);
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

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

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

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

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================
   Navigation
   ============================================ */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}

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

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-logo span {
    color: var(--accent);
    transition: transform var(--transition);
}

.nav-logo:hover span {
    transform: rotate(15deg) scale(1.2);
}

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

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    padding: 0.25rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width var(--transition);
}

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

.nav-links a:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
}

#theme-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

#mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
}

/* ============================================
   Hero Section
   ============================================ */
#hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 120px 0 60px;
}

.hero-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.hero-name {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    opacity: 0;
    animation: fadeInUp 0.6s 0.1s forwards;
}

.hero-name-zh {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-family: 'Lora', serif;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 0.6s 0.2s forwards;
}

.hero-bio {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 0.8rem;
    opacity: 0;
    animation: fadeInUp 0.6s 0.3s forwards;
}

.hero-bio:nth-of-type(2) {
    animation-delay: 0.4s;
}

.hero-bio a {
    font-weight: 500;
}

.hero-bio strong {
    color: var(--text-primary);
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeInUp 0.6s 0.5s forwards;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition);
}

.hero-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
    border-color: var(--accent);
    color: var(--accent);
}

.hero-link.email:hover { color: #ea4335; border-color: #ea4335; }
.hero-link.github:hover { color: #333; border-color: #333; }
[data-theme="dark"] .hero-link.github:hover { color: #fff; border-color: #fff; }
.hero-link.scholar:hover { color: #4285f4; border-color: #4285f4; }

/* ============================================
   Sections
   ============================================ */
.section {
    padding: 6rem 0;
    position: relative;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.subsection-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 4rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    position: relative;
    padding-left: 1rem;
}

.subsection-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* ============================================
   About
   ============================================ */
.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: start;
}

.about-text p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.about-text a {
    font-weight: 500;
}

.about-interests {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.about-interests h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.interest-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(108, 92, 231, 0.08);
    color: var(--accent);
    border: 1px solid rgba(108, 92, 231, 0.15);
    transition: all var(--transition);
    cursor: default;
}

.tag:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* ============================================
   News Timeline
   ============================================ */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

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

.timeline-item {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
}

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

.timeline-date {
    width: 100px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    padding-top: 2px;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
    padding-left: 2rem;
    position: relative;
}

.timeline-content::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent);
}

.section-alt .timeline-content::before {
    border-color: var(--bg-secondary);
}

.timeline-content p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.badge-spotlight {
    background: var(--badge-spotlight);
}

.badge-gold {
    background: var(--badge-gold);
    color: #1a1a2e;
}

/* ============================================
   Publication Filters
   ============================================ */
.pub-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.pub-filter {
    padding: 0.5rem 1.1rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.pub-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pub-filter.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

/* ============================================
   Authorship Toggle
   ============================================ */
.pub-authorship {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.authorship-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 0.25rem;
}

.authorship-btn {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.authorship-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.authorship-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

/* ============================================
   Publication Cards
   ============================================ */
.publications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.pub-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}

.pub-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.pub-card-spotlight {
    border-color: rgba(245, 158, 11, 0.3);
}

.pub-card-spotlight:hover {
    border-color: rgba(245, 158, 11, 0.5);
}

.pub-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.pub-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.pub-card:hover .pub-image img {
    transform: scale(1.08);
}

.pub-overlay {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pub-overlay span {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.spotlight-badge {
    background: var(--badge-spotlight) !important;
    color: #1a1a2e !important;
}

.pub-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pub-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.pub-authors {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.pub-venue {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.pub-abstract {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex: 1;
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.pub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition);
}

.pub-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
}

.pub-stars {
    height: 18px;
}

/* ============================================
   Services
   ============================================ */
.services-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
}

.service-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition);
}

.service-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.service-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.service-detail h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.service-tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(108, 92, 231, 0.08);
    color: var(--accent);
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.footer-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: all var(--transition);
}

.footer-links a:hover {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.footer-bottom p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    33% { transform: translateY(-20px) translateX(10px); }
    66% { transform: translateY(10px) translateX(-10px); }
}

/* Scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .hero-name {
        font-size: 2.5rem;
    }

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

@media (max-width: 600px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border);
        padding: 1rem 2rem;
        gap: 1rem;
    }

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

    #mobile-menu-btn {
        display: block;
    }

    .container {
        padding: 0 1.5rem;
    }

    .section {
        padding: 4rem 0;
    }

    .hero-name {
        font-size: 2rem;
    }

    .hero-name-zh {
        font-size: 1.1rem;
    }

    .hero-bio {
        font-size: 0.95rem;
    }

    .hero-links {
        gap: 0.5rem;
    }

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

    .timeline::before {
        left: 70px;
    }

    .timeline-date {
        width: 60px;
        font-size: 0.8rem;
    }

    .timeline-content {
        padding-left: 1.5rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}
