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

:root {
    --primary-color: #333;
    --secondary-color: #666;
    --link-color: #0066cc;
    --border-color: #ddd;
    --background-light: #f9f9f9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: #fff;
}

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

a:hover {
    text-decoration: underline;
}

hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 1.5rem 0;
}

hr.thin {
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

/* Navigation */
.navbar {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.nav-brand:hover {
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 500;
}

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

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--primary-color);
}

/* Header */
.header {
    position: relative;
    height: 400px;
    overflow: hidden;
}

.header-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.header-background .background-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 65%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.header-overlay {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.5));
    color: white;
    text-align: center;
    padding: 2rem;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 8px solid white;
    object-fit: cover;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.header-overlay h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.header-overlay .subtitle {
    font-size: 1.1rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    max-width: 800px;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

/* Intro Section */
.intro-section h2 {
    font-size: 2rem;
    margin-bottom: 0;
}

.intro-section > hr {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.intro-section p {
    margin-bottom: 1rem;
    text-align: justify;
}

/* Contact Section */
.contact-section {
    background-color: var(--background-light);
    padding: 2rem;
    border-radius: 8px;
    height: fit-content;
}

.contact-section h2 {
    font-size: 2rem;
    margin-bottom: 0;
}

.contact-section > hr:first-of-type {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.contact-section h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.contact-section p {
    margin-bottom: 0.5rem;
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.social-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--link-color);
    text-decoration: none;
}

.social-links svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.social-links .social-icon-img {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

/* Footer */
.footer {
    background-color: var(--background-light);
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        flex-direction: column;
        padding: 1rem 2rem;
        border-bottom: 1px solid var(--border-color);
        display: none;
        gap: 1rem;
    }

    .nav-menu.active {
        display: flex;
    }

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

    .header {
        height: 350px;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
        border: 6px solid white;
    }

    .header-overlay h1 {
        font-size: 2rem;
    }

    .intro-section p {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 1rem;
    }

    .header {
        padding: 2rem 1rem;
        height: 300px;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
        border: 5px solid white;
    }

    .container {
        padding: 2rem 1rem;
    }

    .header-overlay h1 {
        font-size: 1.75rem;
    }

    .header-overlay .subtitle {
        font-size: 1rem;
    }
}

/* Page-specific styles */
.page-header {
    background-color: var(--background-light);
    padding: 2rem;
    margin-bottom: 2rem;
}

.page-header .nav-container {
    text-align: center;
    display: block;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.content-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.content-section h2 {
    font-size: 1.75rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-section h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.publication-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

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

.project-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--background-light);
    border-radius: 8px;
}

.project-item h3 {
    margin-top: 0;
}

.project-card {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.project-card:last-child {
    border-bottom: none;
}

.project-image-placeholder {
    width: 100%;
    height: 200px;
    background-color: var(--background-light);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.project-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.project-card h3 a {
    color: var(--primary-color);
}

.project-card h3 a:hover {
    color: var(--link-color);
}

.project-card p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.project-author {
    font-style: italic;
    color: var(--secondary-color);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background-color 0.3s, transform 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--link-color);
    transform: translateY(-3px);
}

.back-to-top:active {
    transform: translateY(-1px);
}

/* Publication Stats */
.pub-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.pub-stat-card {
    text-align: center;
    color: white;
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.95;
}

/* Fade in animation for content */
.intro-section,
.contact-section,
.content-section > *:not(.pub-stats-container) {
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
}

.intro-section { animation-delay: 0.1s; }
.contact-section { animation-delay: 0.2s; }

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.project-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
