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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
    font-size: 16px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.profile-section {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.links-sections {
    margin-top: 1rem;
}

.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    /* Image protection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.8rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.header-text {
    flex: 1;
}

h1 {
    font-size: 2.5rem;
    font-weight: 400;
    color: #2c3e50;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: #666;
    margin-bottom: 0.3rem;
}

.affiliation {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.4rem;
}

.contact-info,
.quick-links {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}

.quick-links {
    margin-bottom: 0;
}

/* Section Navigation */
.section-nav {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.8rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    z-index: 100;
}

.section-nav a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 1.5rem;
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.section-nav a:hover,
.section-nav a.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
}

/* Remove old navigation styles */
.nav {
    display: none;
}

/* Sections */
.section {
    margin-bottom: 2.5rem;
}

.section:last-child {
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.4rem;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 1rem;
    position: relative;
}

h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 30px;
    height: 2px;
    background: #0066cc;
}

h4 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.8rem;
    margin-top: 1.5rem;
}

p {
    margin-bottom: 1rem;
    text-align: left;
    line-height: 1.6;
}

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* Research Items */
.research-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid #f5f5f5;
}

.research-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.research-item h4 {
    margin-top: 0;
    margin-bottom: 0.4rem;
}

.research-item em {
    color: #666;
    font-size: 0.9rem;
}

/* Publications */
.publication {
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.publication:last-child {
    margin-bottom: 1rem;
}

.paper-title {
    font-weight: 500;
    color: #0066cc;
}

.paper-title:hover {
    text-decoration: underline;
}

.pub-links {
    margin-top: 0.3rem;
    font-size: 0.9rem;
    color: #666;
}

.pub-links a {
    margin-right: 0.8rem;
    color: #0066cc;
}

/* Experience & Teaching */
.experience-item,
.teaching-item {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.experience-item:last-child,
.teaching-item:last-child {
    margin-bottom: 0;
}

/* Contact Grid */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

/* Research Page Styles */
.research-header {
    text-align: center;
    margin-bottom: 2rem;
}

.research-header h1 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.back-nav {
    margin-bottom: 1rem;
}

.back-nav a {
    color: #0066cc;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-nav a:hover {
    text-decoration: underline;
}

.project-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e5e5;
}

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

.project-header {
    margin-bottom: 1.5rem;
}

.project-header h2 {
    font-size: 1.6rem;
    color: #2c3e50;
    margin-bottom: 0.8rem;
}

.project-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
}

.status {
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status.ongoing {
    background: #e3f2fd;
    color: #1976d2;
}

.status.published {
    background: #e8f5e8;
    color: #2e7d32;
}

.status.in-progress {
    background: #fff3e0;
    color: #f57c00;
}

.project-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.project-image {
    max-width: 100%;
    text-align: center;
}

.project-content .project-description:only-child {
    grid-column: 1 / -1;
    max-width: none;
}

.project-section .project-content:has(.project-description:only-child) {
    display: block;
}

/* Full width images for certain projects */
.project-content:has(.project-image) {
    display: block;
}

.project-content .project-image {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1.5rem;
    text-align: center;
}

.project-image img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    background: #f8f9fa;
    transition: transform 0.3s ease, opacity 0.3s ease;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.project-image img:hover {
    transform: scale(1.05);
}

/* Status badges for different project types */
.status.completed {
    background: #e8f5e8;
    color: #2e7d32;
}

/* Fallback for missing images */
img[src*="profile.jpg"]:not([src*="http"]) {
    background: #f0f0f0 url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120"><rect width="120" height="120" fill="%23f0f0f0"/><text x="50%" y="50%" text-anchor="middle" dy="0.3em" font-family="system-ui" font-size="14" fill="%23999">Photo</text></svg>') center/cover;
}

.project-image img:not([src*="http"]) {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-image img:not([src*="http"])::after {
    content: "Project Image";
    color: #999;
    font-size: 0.9rem;
}

.image-caption {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

.project-description h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.project-description h3:first-child {
    margin-top: 0;
}

.project-description ul {
    margin-left: 1.2rem;
    margin-bottom: 1rem;
}

.project-description li {
    margin-bottom: 0.4rem;
}

.research-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e5e5;
    text-align: center;
    color: #666;
}

.research-footer a {
    color: #0066cc;
    text-decoration: none;
}

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

/* Research Page Navigation */
.research-nav {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.research-nav h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.research-nav h3::after {
    display: none;
}

.research-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.research-nav li {
    margin-bottom: 0.5rem;
}

.research-nav a {
    color: #0066cc;
    text-decoration: none;
    font-size: 0.95rem;
}

.research-nav a:hover {
    text-decoration: underline;
}

/* Teaching Page Styles - Enhanced */
.teaching-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e5e5e5;
}

.teaching-header h1 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.teaching-timeline {
    margin-bottom: 2rem;
}

.teaching-period {
    background: #fff;
    margin-bottom: 1.5rem;
    padding: 1.8rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #0066cc;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.teaching-period:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.teaching-period:last-child {
    margin-bottom: 1rem;
}

.teaching-period h3 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.teaching-period h3::before {
    content: '📚';
    font-size: 1.2rem;
}

.teaching-period h3::after {
    display: none;
}

.period-duration {
    font-size: 0.9rem;
    color: #0066cc;
    font-weight: 500;
    margin-bottom: 1.2rem;
    padding: 0.3rem 0.8rem;
    background: rgba(0, 102, 204, 0.1);
    border-radius: 12px;
    display: inline-block;
}

.course-list {
    margin-top: 0.5rem;
    line-height: 1.8;
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.4rem;
}

.course-list li {
    /* padding: 0.5rem 0; */
    color: #333;
    /* border-bottom: 1px solid #f0f0f0; */
    /* transition: color 0.2s ease; */
}

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

.course-list li::before {
    content: '•';
    color: #0066cc;
    font-weight: bold;
    margin-right: 0.8rem;
}

.course-list li:hover {
    color: #0066cc;
}

.course {
    font-weight: 500;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.teaching-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e5e5;
    text-align: center;
    color: #666;
}

.teaching-footer a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.teaching-footer a:hover {
    color: #004499;
    text-decoration: underline;
}

/* Fix bullet alignment in teaching section */
.teaching-item ul {
    margin-left: 1.2rem;
    padding-left: 0;
}

.teaching-item li {
    margin-bottom: 0.3rem;
}

/* Multiple images side by side - smaller size */
.project-content:has(.project-image + .project-image) {
    display: block;
}

.project-content .project-image+.project-image {
    display: inline-block;
    width: 35%;
    margin-right: 2%;
    vertical-align: top;
}

.project-content .project-image:first-of-type:has(+ .project-image) {
    display: inline-block;
    width: 35%;
    margin-right: 2%;
    vertical-align: top;
}

.project-content .project-image:last-of-type {
    margin-right: 0;
}

/* Smaller images for multiple image projects */
.project-content .project-image+.project-image img,
.project-content .project-image:first-of-type:has(+ .project-image) img {
    max-width: 250px;
    opacity: 0.8;
}

.project-content .project-image+.project-image .image-caption,
.project-content .project-image:first-of-type:has(+ .project-image) .image-caption {
    font-size: 0.75rem;
    color: #888;
}

/* Responsive: stack images on smaller screens */
@media (max-width: 768px) {

    .project-content .project-image+.project-image,
    .project-content .project-image:first-of-type:has(+ .project-image) {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .project-content .project-image+.project-image img,
    .project-content .project-image:first-of-type:has(+ .project-image) img {
        max-width: 200px;
    }
}

/* Responsive design for teaching page */
@media (max-width: 768px) {
    .teaching-header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }

    .teaching-header h1 {
        font-size: 1.8rem;
    }

    .teaching-period {
        padding: 1.4rem;
        margin-bottom: 1.2rem;
    }

    .teaching-period h3 {
        font-size: 1.2rem;
    }

    .course-list {
        gap: 0.3rem;
    }

    .course-list li {
        padding: 0.4rem 0;
    }
}

@media (max-width: 480px) {
    .teaching-period {
        padding: 1.2rem;
        border-left-width: 3px;
    }

    .teaching-period h3::before {
        font-size: 1rem;
    }

    .period-duration {
        font-size: 0.85rem;
        padding: 0.2rem 0.6rem;
    }
}

/* Print Styles */
@media print {
    .profile-img {
        display: none;
    }

    .nav {
        display: none;
    }

    .section {
        margin-bottom: 1.5rem;
        border-bottom: none;
        page-break-inside: avoid;
    }

    a {
        color: #000;
        text-decoration: none;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
a:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}