﻿:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --border: rgba(255, 255, 255, 0.08);
    --gradient-start: #6366f1;
    --gradient-end: #8b5cf6;
    --nav-bg: rgba(10, 10, 15, 0.8);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fc;
    --bg-card: rgba(0, 0, 0, 0.02);
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a6e;
    --border: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --shadow-color: rgba(99, 102, 241, 0.15);
}

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

/* Particle Canvas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

html {
    scroll-behavior: smooth;
}

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

/* Scroll Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    z-index: 1001;
    width: 0%;
    transition: width 0.1s ease-out;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}

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

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

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

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

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

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1rem;
}

.theme-toggle:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: rotate(15deg);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    padding: 15vh 2rem 2rem;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

[data-theme="light"] .hero-bg {
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 4rem;
    z-index: 1;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 60px var(--accent-glow);
    padding: 3px;
}

.hero-image::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--gradient-start) 0%, var(--gradient-end) 50%, var(--gradient-start) 100%);
    animation: spin 4s linear infinite;
    z-index: 0;
}

.hero-image::after {
    content: '';
    position: absolute;
    inset: 3px; /* matching padding to form border */
    border-radius: 50%;
    background: var(--bg-primary);
    z-index: 1;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Avatar hover effects */
.hero-image:hover {
    box-shadow: 0 0 80px rgba(99, 102, 241, 0.5), 0 0 120px rgba(139, 92, 246, 0.3);
}

.hero-image:hover::before {
    animation: spin 1.5s linear infinite;
}

.hero-image:hover img {
    transform: scale(1.05);
}

/* Avatar glow pulse on hover */
.hero-image::after {
    transition: all 0.4s ease;
}

.hero-image:hover::after {
    box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.2);
}

.hero-text {
    text-align: left;
}

.hero-text h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: inline-block;
    min-height: 1.5em; /* Pre-allocate height */
}

/* Typewriter Blink Cursor */
.hero-subtitle.typing {
    border-right: 2px solid var(--accent);
    animation: blink 0.75s step-end infinite;
    padding-right: 4px;
}
.hero-subtitle.typing-done {
    border-right: 2px solid transparent;
}
@keyframes blink {
    50% { border-color: transparent; }
}

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

.hero-affiliation .divider {
    margin: 0 0.5rem;
    opacity: 0.5;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    animation: bounce 2s infinite;
    color: var(--text-secondary);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Sections */
.section {
    padding: 6rem 2rem;
}

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

.container {
    max-width: 1000px;
    margin: 0 auto;
}

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

.section-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    border-radius: 2px;
}

/* About */
.about-content {
    margin-bottom: 3rem;
}

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

.highlight {
    color: var(--accent);
    font-weight: 500;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--gradient-start), var(--gradient-end), transparent);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateX(-5px);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

.timeline-date {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.timeline-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

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

/* Research Grid */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.research-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.research-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px var(--shadow-color);
}

.research-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.research-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Publications */
.pub-section {
    margin-bottom: 2rem;
}

.pub-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1rem;
}

.pub-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    margin: 0 -1rem;
    transition: all 0.3s ease;
}

.pub-item:hover {
    background: var(--bg-card);
    transform: translateX(8px);
    box-shadow: -4px 0 0 var(--gradient-end);
    border-bottom-color: transparent;
}

.pub-year {
    flex-shrink: 0;
    width: 60px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

.pub-content h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

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

.pub-venue {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.pub-rank {
    display: inline-block;
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.pub-rank.ccf-a {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.pub-rank.ccf-b {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.pub-rank.ccf-c {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.pub-rank.ei {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.pub-note {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .hero-content {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-text {
        text-align: center;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-links {
        justify-content: center;
    }
    
    .nav-links {
        gap: 1rem;
        font-size: 0.8rem;
    }
    
    .pub-item {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Focus Accessibility */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Scroll Spy Active State */
.nav-links a.active {
    color: var(--accent);
    font-weight: 600;
}

/* Mobile Navigation Toggle Button */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle svg line, .menu-toggle svg path {
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Transform hamburger to X when active */
.menu-toggle[aria-expanded="true"] .top { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .middle { opacity: 0; }
.menu-toggle[aria-expanded="true"] .bottom { transform: translateY(-6px) rotate(-45deg); }

/* Responsive adjustments for mobile navigation */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 60px; /* Adjust based on your nav height */
        left: 0;
        right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        align-items: center;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 30px var(--shadow-color);
        /* Hide by default */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .nav-links.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-links a {
        font-size: 1.1rem;
    }
}

/* Recent News in Hero */
.hero-news {
    margin-top: 4rem;
    margin-bottom: 4rem;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    animation: fade-in-up 1s ease 0.5s both;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.hero-news-title {
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.hero-news-scroll-hint {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
    animation: scroll-hint-bounce 2s ease-in-out infinite;
}

@keyframes scroll-hint-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

.hero-news-timeline {
    position: relative;
    max-height: 320px;
    overflow: hidden;
}

.hero-news-scroll {
    max-height: 320px;
    overflow-y: hidden;
    overflow-x: hidden;
    padding: 0 1.5rem 20px 1.5rem; /* 左侧增加 padding 防止时间轴被切掉，右侧增加保持放大时右侧不受限 */
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.hero-news-scroll::-webkit-scrollbar {
    width: 4px;
}

.hero-news-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.hero-news-scroll::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
}

.hero-news-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-end);
}

.hero-news-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.hero-news-item {
    display: flex;
    gap: 1.25rem;
    align-items: baseline;
    font-size: 0.9rem;
    padding: 1.25rem; /* 变成更有实质感的Card */
    margin-right: 0.5rem; /* 避免横向挤占边框 */
    background: var(--bg-secondary); /* 增加背景色 */
    border: 1px solid var(--border); /* 增加边框 */
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    width: calc(100% - 1rem); /* 留出放大空间 */
    box-sizing: border-box;
    word-break: break-word; /* 保证文字自动换行不超出卡片 */
}

/* 时间轴线 */
.hero-news-item::before {
    content: '';
    position: absolute;
    left: -12px; /* 调整时间轴位置 */
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.hero-news-item::after {
    content: '';
    position: absolute;
    left: -15px; /* 调整圆点位置 */
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
    transition: all 0.3s ease;
}

/* 点击选中效果 */
.hero-news-item.selected {
    transform: scale(1.03) translateX(6px);
    background: var(--bg-card);
}

.hero-news-item.selected::after {
    transform: translateY(-50%) scale(1.8);
    box-shadow: 0 0 15px var(--accent-glow);
    opacity: 1;
}

.hero-news-item.selected::before {
    opacity: 1;
    background: linear-gradient(180deg, var(--gradient-start), var(--gradient-end));
}

.hero-news-item.selected .hero-news-date {
    color: var(--accent);
}

.hero-news-item.selected .hero-news-text {
    color: var(--text-primary);
}

/* hover效果 */
.hero-news-item:hover {
    transform: scale(1.02) translateX(4px);
    background: rgba(99, 102, 241, 0.05);
}

.hero-news-item:hover::after {
    transform: translateY(-50%) scale(1.4);
    box-shadow: 0 0 10px var(--accent-glow);
    opacity: 0.9;
}

.hero-news-item:hover::before {
    opacity: 0.8;
    background: var(--accent);
}

.hero-news-item:hover .hero-news-date {
    color: var(--accent);
}

.hero-news-date {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 85px;
    flex-shrink: 0;
    padding-left: 12px;
    transition: color 0.3s ease;
}

.hero-news-text {
    color: var(--text-secondary);
    line-height: 1.5;
    transition: color 0.3s ease;
}

@media (max-width: 768px) {
    .hero-news {
        margin-top: 3rem;
    }

    .hero-news-timeline {
        max-height: 350px;
    }

    .hero-news-scroll {
        max-height: 350px;
    }

    .hero-news-item {
        flex-direction: column;
        gap: 0.25rem;
        padding: 1rem;
    }

    .hero-news-date {
        padding-left: 0;
    }

    .hero {
        padding-top: 12vh;
    }
}
