/* 
 * Academic Homepage - Prof. Kaiyang Zhou
 * Eye-friendly warm sepia theme
 */

:root {
    /* Warm paper-like palette - easy on the eyes */
    --bg-primary: #f5f0e6;
    --bg-secondary: #ebe5d9;
    --bg-card: #fffbf5;
    --bg-hover: #f0e9dc;
    
    /* Warm text colors */
    --text-primary: #3d3529;
    --text-secondary: #5c5347;
    --text-muted: #8a7f6f;
    
    /* Accent - deep teal/forest */
    --accent: #2d6a5d;
    --accent-hover: #3d8577;
    --accent-subtle: rgba(45, 106, 93, 0.1);
    
    /* Borders */
    --border: #d8d0c2;
    --border-light: #e5ddd0;
    
    /* Typography */
    --font-serif: 'Crimson Pro', Georgia, serif;
    --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --container-width: 800px;
    --section-gap: 0.1rem;
}

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

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

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

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(245, 240, 230, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    gap: 2.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--accent);
}

/* Main Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 5rem 2rem 2rem;
}

/* Sections */
.section {
    margin-bottom: var(--section-gap);
    padding-top: 1rem;
}

.section h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.section h3 {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

/* About Section */
.about-header {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

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

.profile-photo {
    width: 200px;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-card);
    border: 3px solid var(--border);
}

.about-intro h1 {
    font-family: var(--font-serif);
    font-size: 2.4rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.about-intro .title {
    font-size: 1.15rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.about-intro .affiliation {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

.about-intro .email {
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.about-intro .email a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.about-intro .email a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.about-content p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.about-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

/* More Info Button */
.more-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.more-info-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.more-info-btn .btn-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.more-info-btn.expanded .btn-icon {
    transform: rotate(180deg);
}

/* Detailed Bio (Expandable) */
.detailed-bio {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.detailed-bio.expanded {
    max-height: 500px;
    opacity: 1;
    margin-top: 1rem;
}

.detailed-bio p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.detailed-bio p:last-child {
    margin-bottom: 0;
}

.social-links {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.about-content .social-links {
    margin-top: 1rem;
}

.social-link,
.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    transition: all 0.2s ease;
}

.social-link:hover,
.resource-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.social-link svg,
.resource-link svg {
    width: 15px;
    height: 15px;
}

/* News Section */
.news-list {
    list-style: none;
    margin: 0;
}

.news-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    line-height: 1.5;
}

.news-list li:last-child {
    border-bottom: none;
}

.news-date {
    display: inline-block;
    width: 85px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.news-list a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.news-list a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Research Section */
.resource-bar {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.resource-link .hf-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Research Slider */
.research-slider-container {
    position: relative;
    margin-top: 0.75rem;
}

.research-areas {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0;
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.research-areas::-webkit-scrollbar {
    display: none;
}

.research-card {
    flex: 0 0 280px;
    min-width: 280px;
    scroll-snap-align: start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.research-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.slider-nav:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.slider-nav svg {
    width: 18px;
    height: 18px;
}

.slider-prev {
    left: -18px;
}

.slider-next {
    right: -18px;
}

/* Hide nav buttons on touch devices */
@media (hover: none) {
    .slider-nav {
        display: none;
    }
}

.research-card h4 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.research-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.paper-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.paper-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.paper-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Team Section */
.team-intro {
    margin-bottom: 0.75rem;
}

.team-intro .more-info-btn {
    margin-top: 0;
}

.team-list {
    list-style: none;
    margin-top: 0.5rem;
}

.team-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.team-list li:last-child {
    border-bottom: none;
}

.team-list a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.team-list a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Teaching Section */
.teaching-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.course {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    align-items: center;
}

.course-code {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
}

.course-name {
    color: var(--text-primary);
}

.course-term {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Services Section */
.services-list {
    list-style: none;
    margin-top: 0.5rem;
}

.services-list li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
    padding-left: 1.2rem;
    position: relative;
}

.services-list li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.services-list em {
    color: var(--text-primary);
    font-style: normal;
    font-weight: 500;
}

.services-list a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.services-list a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Footer */
.footer {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 99;
}

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

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

.back-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        gap: 1.2rem;
        padding: 0.8rem 1rem;
    }
    
    .nav-link {
        font-size: 0.85rem;
    }
    
    .container {
        padding: 5rem 1.25rem 3rem;
    }
    
    .about-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .about-intro h1 {
        font-size: 2rem;
    }
    
    .profile-photo {
        width: 150px;
        height: 150px;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .course {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .course-term {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .slider-nav {
        display: none;
    }
    
    .research-card {
        flex: 0 0 260px;
        min-width: 260px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        gap: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .section h2 {
        font-size: 1.5rem;
    }
    
    .research-card {
        flex: 0 0 240px;
        min-width: 240px;
        padding: 1rem;
    }
}

/* Selection color */
::selection {
    background: var(--accent);
    color: #fff;
}

/* Smooth link underlines */
a {
    text-underline-offset: 3px;
}

