/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 160px; /* Increased offset for sticky header + extra space */
}

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #666;
    --accent-color: #0066cc;
    --hover-color: #004499;
    --bg-color: #ffffff;
    --text-color: #333;
    --border-color: #e0e0e0;
    --code-bg: #f5f5f5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 100;
    transition: box-shadow 0.3s ease, padding 0.3s ease;
}

header.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.profile-img-small {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.header-text h1 {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--secondary-color);
    font-size: 1.1em;
}

nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
    position: relative;
}

nav a:hover {
    color: var(--accent-color);
    transform: translateY(-1px);
}

nav a.active {
    color: var(--accent-color);
    font-weight: 600;
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* About Section */
.about-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 60px;
}

.intro {
    font-size: 1.05em;
    margin-bottom: 20px;
}

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

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

.intro a:hover {
    text-decoration: underline;
}

.contact {
    margin: 20px 0;
    font-size: 1.05em;
}

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

.contact a:hover {
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 15px;
    margin: 25px 0;
}

.social-links a {
    display: inline-block;
    width: 32px;
    height: 32px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    color: var(--text-color);
}

.social-links a:hover {
    opacity: 0.7;
    transform: translateY(-2px);
}

.social-links img,
.social-links svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-img-large {
    text-align: center;
    margin-top: 30px;
}

.profile-img-large img {
    max-width: 300px;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Section Styles */
section {
    margin-bottom: 60px;
    padding-top: 40px; /* Increased padding for better spacing with sticky header */
}

h2 {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.section-intro {
    margin-bottom: 30px;
    color: var(--secondary-color);
}

.section-intro a {
    color: var(--accent-color);
    text-decoration: none;
}

.section-intro a:hover {
    text-decoration: underline;
}

/* Publications */
.publication {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.publication:last-child {
    border-bottom: none;
}

.pub-image img {
    width: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pub-content h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 10px;
}

.pub-content h3 a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.pub-content h3 a:hover {
    color: var(--accent-color);
}

.authors {
    color: var(--secondary-color);
    margin-bottom: 5px;
    font-size: 0.95em;
}

.authors strong {
    color: var(--primary-color);
}

.venue {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 0.95em;
}

.pub-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.pub-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9em;
    padding: 4px 12px;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pub-link:hover {
    background-color: var(--accent-color);
    color: white;
}

.bibtex {
    background-color: var(--code-bg);
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    overflow-x: auto;
    margin-top: 15px;
    border: 1px solid var(--border-color);
}

/* Experience Section */
.experience-item {
    margin-bottom: 35px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

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

.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 20px;
}

.exp-header h3 {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.company {
    color: var(--secondary-color);
    font-weight: 500;
}

.period {
    color: var(--secondary-color);
    font-size: 0.95em;
    white-space: nowrap;
}

.experience-item ul {
    list-style-position: inside;
    margin-left: 0;
}

.experience-item li {
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.6;
}

/* Education Section */
.education-item {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

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

.edu-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.edu-header h3 {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.institution {
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 5px;
}

.focus {
    color: var(--secondary-color);
    font-style: italic;
    font-size: 0.95em;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.skill-category h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.skill-category p {
    color: var(--secondary-color);
    line-height: 1.6;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0 20px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.9em;
}

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

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header-text h1 {
        font-size: 1.6em;
    }

    .subtitle {
        font-size: 1em;
    }

    .publication {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .pub-image {
        max-width: 300px;
        margin: 0 auto;
    }

    .exp-header,
    .edu-header {
        flex-direction: column;
        gap: 10px;
    }

    .period {
        white-space: normal;
    }

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

    nav {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .header-text h1 {
        font-size: 1.4em;
    }

    h2 {
        font-size: 1.5em;
    }

    .intro {
        font-size: 1em;
    }

    .social-links {
        gap: 12px;
    }

    .social-links a {
        width: 28px;
        height: 28px;
    }
}
