:root {
    /* Body-level Mandelbrot credit */
/* Footer Mandelbrot credit styles */
.body-credit {
    text-align: center;
    font-size: 0.9em;
    color: #fff;
    background: rgba(0,0,0,0.5);
    letter-spacing: 0.02em;
    font-family: 'EB Garamond', serif;
    margin: 0.5em auto 0.2em auto;
    border-radius: 4px;
    padding: 0.2em 0.5em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: inline-block;
}
.body-credit a {
    color: #fff;
    text-decoration: underline;
    pointer-events: auto;
}
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --heading-color: #ffffff;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --border-color: #e1e8ed;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --footer-bg: #2c3e50;
    --footer-text: #ffffff;
}

[data-theme="dark"] {
    --primary-color: #1a252f;
    --secondary-color: #64b5f6;
    --accent-color: #ef5350;
    --text-color: #e4e4e4;
    --heading-color: #ffffff;
    --light-bg: #1e2936;
    --white: #0d1117;
    --border-color: #30363d;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    --footer-bg: #1e2936;
    --footer-text: #e4e4e4;
}

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

html {
    scroll-behavior: smooth;
    height: 100%;
    background: #000 !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    background: transparent;
    position: relative;
}

/* Fixed Mandelbrot background for all devices (including iOS Safari) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('mandelbrot01.jpg') center / cover no-repeat;
}

.container {
    color: var(--heading-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: var(--white);
    /* box-shadow: var(--shadow); */
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    position: relative;
}


/* Navigation menu styles */
.nav-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 2rem;
    /* transition: max-height 0.3s ease; */
}
.nav-menu li a {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.2s;
}
.nav-menu li a:hover {
    color: #0077b6;
}

@media (max-width: 900px) {
    .navbar .container {
        background-color: var(--white);
        /* box-shadow: var(--shadow); */
        position: sticky;
        top: 0;
        z-index: 1000;
        padding: 1rem 0;
        position: relative;
    }
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 0 auto;
        background: var(--white);
        flex-direction: column;
        align-items: center;
        width: 100vw;
        max-width: 400px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        border-radius: 0 0 8px 8px;
        z-index: 3000;
        padding: 0;
    }
    .nav-menu.open {
        display: flex;
        padding: 1rem 0;
    }
    .nav-menu li {
        width: 100%;
        text-align: center;
        padding: 0.7rem 1.5rem;
    }
    .theme-toggle {
        background: none;
        border: none;
        color: var(--text-color);
        font-size: 1.3rem;
        cursor: pointer;
        padding: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
        margin-left: 0;
        margin-right: 1rem;
        position: absolute;
        right: 1rem;
    }
    .hamburger {
        display: flex !important;
        position: absolute;
        left: 1rem;
        z-index: 4001;
        margin: 0;
    }
}
/* End of media query - removed stray z-index and closing brace */

/* Hamburger styles */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    margin-left: 1rem;
}
.hamburger span {
    display: block;
    width: 28px;
    height: 3px;
    margin: 4px 0;
    background: var(--text-color);
    border-radius: 2px;
    transition: 0.3s;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    --link-color: #1e90ff;
    color: var(--text-color);
}

/* Removed duplicate .nav-menu and .hamburger rules to fix responsive menu */
a {
    color: var(--link-color);
    text-decoration: underline;
    font-weight: 600;
    transition: var(--transition);
}

a:hover, a:focus {
    color: var(--accent-color);
    text-decoration: underline;
}
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: 1rem;
}

.theme-toggle:hover {
    color: var(--secondary-color);
    transform: rotate(15deg);
}

.theme-toggle i {
    transition: var(--transition);
}

/* Hero Section */
.hero {
    /* background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('mandelbrot01.jpg') center center / cover no-repeat; */
    color: #ffffff;
    padding: 4rem 0;
    text-align: center;
    position: relative;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.profile-img {
    width: 180px;
    height: 180px;
    border-radius: 35%;
    object-fit: cover;
    /* object-position: center; */
    border: 5px solid #2c3e50;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    /* font-family: 'EB Garamond', 'Times New Roman', Times, serif; */
}

.hero .title {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hero .affiliation {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.social-links a {
    color: #ffffff;
    font-size: 1.5rem;
    transition: var(--transition);
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.7));
}

.social-links a:hover {
    transform: translateY(-3px);
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.8));
}

.hero-credit {
    position: absolute;
    bottom: 0.5rem;
    right: 1rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    text-align: right;
    margin-top: 0;
}


/* Sections */
.section {
    padding: 4rem 0;
}

.section-alt {
    background-color: var(--light-bg);
}

.section h2 {
    font-size: 2rem;
    color: var(--heading-color);
    margin-bottom: 2rem;
    text-align: center;
    /* font-family: 'EB Garamond', 'Times New Roman', Times, serif;   */
}

/* About Section */
.about-content p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    line-height: 1.8;
    background-color: var(--white);
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.interests {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--light-bg);
    color: var(--text-color);
    border-radius: 8px;
}

.interests h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.interests ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.interests li {
    padding: 0.5rem;
    background-color: var(--white);
    border-left: 3px solid var(--secondary-color);
    padding-left: 1rem;
}

/* Research Section */
.research-projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--white);
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.project-card h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.project-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Publications Section */
.publications-list {
    max-width: 900px;
    margin: 0 auto;
}

.publication {
    background-color: var(--white);
    color: var(--text-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--secondary-color);
}

.publication h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.authors {
    margin-bottom: 0.3rem;
    color: #555;
}

.venue {
    margin-bottom: 1rem;
    color: #666;
}

.abstract {
    margin-bottom: 1rem;
    line-height: 1.7;
}

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

.btn-small {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-small:hover {
    background-color: var(--primary-color);
}

/* Teaching Section */
.events-list {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    background-color: var(--white);
    color: var(--text-color);
}

.event {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0;
}

.event:not(:last-child) {
    margin-bottom: 1.2em;
}

.event-meta {
    flex-shrink: 0;
    text-align: left;
    color: #666;
    font-size: 0.95rem;
    padding-right: 0.5em;
}

.event-sep {
    width: 2em;
    flex-shrink: 0;
    text-align: center;
    /* color: #666; */
}

.event-desc {
    flex: 1;
    text-align: center;
    flex-shrink: 50;
    padding-left: 0.5em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .event {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5em;
    }
    
    .event-meta {
        padding-right: 0;
    }
    
    .event-desc {
        padding-left: 0;
        text-align: left;
    }
}

/* Teaching Section */
.teaching-list {
    max-width: 800px;
    margin: 0 auto;
}

.teaching-item {
    background-color: var(--white);
    color: var(--text-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.teaching-item h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.course-meta {
    color: #666;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

/* Contact Section */
.contact-info {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-info p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}


.contact-info i {
    color: var(--secondary-color);
    margin-right: 0.5rem;
}

/* Footer */
footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 2rem 0;
}

footer p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}
