/* ============================================
   Academic Personal Website - Main Stylesheet
   ============================================ */

/* CSS Variables - Light Theme (Default) */
:root {
    --primary-color: #1e3a5f;
    --secondary-color: #2d5a87;
    --accent-color: #4a7fb5;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-light: #718096;
    --bg-primary: #ffffff;
    --bg-secondary: #faf9f7;
    --bg-tertiary: #f5f4f2;
    --bg-body: #f0eeeb;
    --border-color: #e8e6e3;
    --link-color: #2d5a87;
    --link-hover: #1e3a5f;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --max-width: 900px;
    --border-radius: 6px;
    
    /* Font */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary-color: #8bb3dd;
    --secondary-color: #6b9bc7;
    --accent-color: #5a8ab8;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-light: #718096;
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --bg-body: #0f1419;
    --border-color: #4a5568;
    --link-color: #8bb3dd;
    --link-hover: #a8c8e8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 40px 0 0;
    margin-top: 30px;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Profile Section */
.profile-section {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 30px;
}

.profile-image-wrapper {
    flex-shrink: 0;
}

.profile-image {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.profile-info {
    flex: 1;
}

.profile-info h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.name-separator {
    color: var(--border-color);
    font-weight: 300;
}

.chinese-name {
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.profile-info .title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.profile-info .institution {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.profile-info .email {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

/* Social Links with Icons */
.social-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.social-link svg {
    width: 18px;
    height: 18px;
    fill: var(--text-secondary);
    transition: all 0.2s ease;
}

/* Unified hover style: border highlight with subtle background shift */
.social-link:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(74, 127, 181, 0.25), 0 0 0 1px var(--accent-color);
    text-decoration: none;
}

.social-link:hover svg {
    fill: var(--accent-color);
}

/* Light mode: simple border highlight */
[data-theme="light"] .social-link:hover {
    background: var(--bg-primary);
    box-shadow: 0 0 0 1px var(--accent-color);
}

[data-theme="dark"] .social-link {
    background: transparent;
    border-color: var(--border-color);
}

[data-theme="dark"] .social-link:hover svg {
    fill: var(--accent-color);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: fill 0.3s ease;
}

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

/* Navigation - Full width spread */
.nav {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 0;
}

.nav-link {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 15px 10px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color);
    text-decoration: none;
}

/* Main Content */
.main {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 40px;
    margin-bottom: 30px;
}

/* Sections */
.section {
    margin-bottom: 50px;
    padding-top: 10px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* Bio */
.bio-text {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.position-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Experience List - Full height left border with hover */
.experience-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.experience-item {
    padding: 18px 20px 18px 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.experience-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-color);
    border-radius: 2px 0 0 2px;
}

.experience-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(74, 127, 181, 0.15), 0 0 0 1px var(--accent-color);
}

[data-theme="light"] .experience-item:hover {
    background: var(--bg-primary);
    box-shadow: 0 0 0 1px var(--accent-color);
}

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

.experience-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.experience-org {
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 4px;
}

.experience-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    gap: 8px;
}

.meta-item {
    position: relative;
    padding-right: 10px;
}

.meta-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background-color: var(--border-color);
}

.experience-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    line-height: 1.7;
}

/* Publications List - Full height left border with hover */
.publications-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.publication-item {
    padding: 18px 20px 18px 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.publication-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--secondary-color);
    border-radius: 2px 0 0 2px;
}

.publication-item:hover {
    background: var(--bg-secondary);
    border-color: var(--secondary-color);
    box-shadow: 0 0 12px rgba(74, 127, 181, 0.15), 0 0 0 1px var(--secondary-color);
}

[data-theme="light"] .publication-item:hover {
    background: var(--bg-primary);
    box-shadow: 0 0 0 1px var(--secondary-color);
}

.publication-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.5;
}

.publication-authors {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.publication-venue {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 12px;
}

.publication-links {
    display: flex;
    gap: 12px;
}

.publication-link {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 4px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.publication-link:hover {
    background: var(--bg-secondary);
    color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(74, 127, 181, 0.2), 0 0 0 1px var(--accent-color);
    text-decoration: none;
}

[data-theme="light"] .publication-link:hover {
    background: white;
    box-shadow: 0 0 0 1px var(--accent-color);
}

[data-theme="dark"] .publication-link {
    background: var(--bg-secondary);
}

/* Awards List with hover */
.awards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.award-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.award-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(74, 127, 181, 0.15), 0 0 0 1px var(--accent-color);
}

[data-theme="light"] .award-item:hover {
    background: var(--bg-primary);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.award-title {
    font-weight: 600;
    color: var(--text-primary);
}

.award-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    gap: 8px;
}

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

.news-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.news-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color);
    white-space: nowrap;
    min-width: 70px;
}

.news-content {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-note {
    margin-top: 8px;
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .profile-image {
        width: 150px;
        height: 150px;
    }
    
    .profile-info h1 {
        font-size: 1.6rem;
        justify-content: center;
    }
    
    .chinese-name {
        font-size: 1.3rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .nav {
        flex-wrap: wrap;
    }
    
    .nav-link {
        flex: 1 1 50%;
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .main {
        padding: 25px;
    }
    
    .experience-header {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .main {
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    .header {
        border-bottom: 1px solid #ccc;
    }
    
    .nav,
    .social-links {
        display: none;
    }
    
    .main {
        box-shadow: none;
    }
    
    .section {
        page-break-inside: avoid;
    }
}
