/* ============================================
   Henghui Du - Academic Homepage Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --accent: #0ea5e9;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 900px;
    --nav-height: 64px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

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

/* --- Navigation --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

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

.nav-logo {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

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

.nav-menu {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav-link {
    display: block;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

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

/* --- Hero Section --- */
.hero {
    padding-top: calc(var(--nav-height) + 60px);
    padding-bottom: 60px;
    background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 48px;
}

.hero-text {
    flex: 1;
}

.hero-name {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

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

.hero-title {
    font-size: 1.15rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.hero-affiliation {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.hero-affiliation a {
    color: var(--text-light);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
}

.hero-affiliation a:hover {
    color: var(--primary);
    text-decoration-color: var(--primary);
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    transition: var(--transition);
}

.hero-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.hero-link i {
    font-size: 0.9rem;
}

.hero-photo {
    flex-shrink: 0;
}

.profile-img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.profile-img:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
}

/* --- Section Base --- */
.section {
    padding: 64px 0;
}

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

.section-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

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

.section-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: -16px;
    margin-bottom: 32px;
}

.section-subtitle a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --- About --- */
.about-content p {
    margin-bottom: 16px;
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.8;
}

.about-content p:last-child {
    margin-bottom: 0;
}

.about-content strong {
    color: var(--text);
    font-weight: 600;
}

.about-content a {
    text-decoration: underline;
    text-decoration-color: var(--primary-light);
    text-underline-offset: 3px;
}

.about-content a:hover {
    text-decoration-color: var(--primary);
}

/* --- News --- */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.news-item {
    display: flex;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    align-items: flex-start;
    transition: var(--transition);
}

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

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-item:hover {
    background: rgba(37, 99, 235, 0.02);
    border-radius: var(--radius-sm);
    padding-left: 12px;
    margin-left: -12px;
    padding-right: 12px;
    margin-right: -12px;
}

.news-date {
    flex-shrink: 0;
    width: 80px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    padding-top: 1px;
}

.news-content {
    font-size: 0.93rem;
    color: var(--text);
    line-height: 1.6;
}

.news-content em {
    color: var(--text);
}

.news-content strong {
    color: var(--primary-dark);
}

/* --- Publications --- */
.pub-category {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
    margin-top: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.pub-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: var(--transition);
}

.pub-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.pub-thumb {
    flex-shrink: 0;
    width: 180px;
    height: 110px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pub-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pub-info {
    flex: 1;
    min-width: 0;
}

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

.pub-authors {
    font-size: 0.87rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 4px;
}

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

.pub-venue {
    font-size: 0.87rem;
    color: var(--text-lighter);
    margin-bottom: 10px;
}

.pub-venue strong {
    color: var(--primary);
    font-weight: 600;
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pub-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 100px;
    transition: var(--transition);
}

.pub-link:hover {
    background: var(--primary);
    color: #fff;
}

.pub-link i {
    font-size: 0.75rem;
}

/* --- Timeline (Education) --- */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--primary-light));
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    padding-bottom: 32px;
}

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

.timeline-dot {
    position: absolute;
    left: -27px;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border: 3px solid var(--bg-alt);
    border-radius: 50%;
    z-index: 1;
}

.timeline-content {
    background: var(--bg-card);
    padding: 20px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.timeline-content:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

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

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

.timeline-desc {
    font-size: 0.92rem;
    color: var(--text-light);
}

.timeline-detail {
    font-size: 0.88rem;
    color: var(--text-lighter);
    margin-top: 2px;
}

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

/* --- Awards --- */
.awards-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.award-item {
    display: flex;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.award-item:last-child {
    border-bottom: none;
}

.award-year {
    flex-shrink: 0;
    width: 60px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

.award-text {
    font-size: 0.93rem;
    color: var(--text);
}

/* --- Footer --- */
.footer {
    padding: 40px 0;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-light);
}

.footer-content {
    text-align: center;
}

.footer-content p {
    font-size: 0.88rem;
    color: var(--text-lighter);
}

.footer-note {
    margin-top: 8px;
    font-size: 0.82rem !important;
}

.footer-visitor {
    margin-top: 16px;
}

/* --- Back to Top --- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 999;
}

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

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

.hero-text {
    animation: fadeInUp 0.6s ease 0.1s forwards;
}

.hero-photo {
    animation: fadeInUp 0.6s ease 0.3s forwards;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --nav-height: 56px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 16px 24px;
        border-bottom: 1px solid var(--border);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        box-shadow: var(--shadow);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 30px;
    }

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

    .hero-name-cn {
        font-size: 1.1rem;
        display: block;
        margin-top: 4px;
    }

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

    .profile-img {
        width: 160px;
        height: 160px;
    }

    .section {
        padding: 48px 0;
    }

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

    .news-item {
        flex-direction: column;
        gap: 4px;
    }

    .news-date {
        width: auto;
    }

    .pub-item {
        flex-direction: column;
        padding: 16px;
    }

    .pub-thumb {
        width: 100%;
        height: 160px;
    }

    .timeline-header {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

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

    .hero-link {
        font-size: 0.82rem;
        padding: 6px 12px;
    }

    .pub-title {
        font-size: 0.93rem;
    }
}

/* --- Selection --- */
::selection {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-lighter);
}
