:root {
    --link-color: #009EFF;
    --nav-bg-color: #24292e;  /* Navigation bar background color */
    --nav-hover-color: #6CACE4;  /* Navigation button hover/active color */
    --nav-text-color: white;  /* Navigation text color */
    --footer-bg-color: #24292e;  /* Footer background color */
    --footer-text-color: white;  /* Footer text color */
}

/* Global link styles */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #24292e;
    position: relative;
}

#neural-network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
    background-color: rgba(246, 248, 250, 0.1);
}

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

header {
    background-color: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
    width: 100%;
    position: relative;
    z-index: 1;
}

.lab-header {
    text-align: center;
    padding: 2rem 1rem;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    min-height: 200px;  /* Ensure enough space for the animation */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;  /* Contain the animation */
}

.lab-header-content {
    position: relative;
    z-index: 1;
    background-color: rgba(246, 248, 250, 0.3);  /* More transparent background */
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
}

.lab-title {
    font-size: 2rem;
    margin: 0;
    color: #24292e;
    text-align: center;
    width: 100%;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);  /* Add text shadow for better contrast */
}

.lab-subtitle {
    font-size: 1.25rem;
    color: #24292e;  /* Darker text for better contrast */
    margin: 0.5rem 0;
    text-align: center;
    width: 100%;
    padding: 0;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);  /* Add text shadow for better contrast */
}

.nav-bar {
    background-color: var(--nav-bg-color);
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-button {
    color: var(--nav-text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    text-transform: capitalize;
    min-width: 100px;
    text-align: center;
}

.nav-button:hover {
    background-color: var(--nav-hover-color);
    text-decoration: none;
}

.nav-button.active {
    background-color: var(--nav-hover-color);
}

.hero-section {
    background-color: #f6f8fa;
    padding: 4rem 0;
    text-align: center;
}

.hero-content {
    max-width: min(800px, 90vw);
    margin: 0 auto;
    padding: 0 1rem;
}

.news-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.news-item {
    padding: 1rem 0;
    border-bottom: 1px solid #e1e4e8;
}

.news-date {
    color: #586069;
    font-size: 0.9rem;
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.contact-info {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.contact-info:hover {
    transform: translateY(-2px);
}

.research-area {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.research-area:hover {
    transform: translateY(-2px);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.team-member {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;  /* Center all content horizontally */
}

.team-member:hover {
    transform: translateY(-2px);
}

.team-member img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

.member-name {
    font-weight: bold;
    margin: 0.5rem 0;
}

.member-role {
    color: #586069;
}

.member-links {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    max-width: 300px;
    width: 100%;  /* Take full width of parent */
    margin-left: auto;
    margin-right: auto;
}

.member-links a {
    margin: 0;
    color: var(--link-color);
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.member-links a:hover {
    background-color: rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.publication {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.publication:hover {
    transform: translateY(-2px);
}

.publication-title {
    font-weight: bold;
}

.publication-authors {
    color: #586069;
}

.publication-venue {
    font-style: italic;
}

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

.publication-links a {
    margin-right: 1rem;
    color: var(--link-color);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.section {
    margin: 2rem 0;
}

h2 {
    color: #24292e;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 0.5rem;
}

h3 {
    color: #24292e;
    margin: 2rem 0 1rem;
}

footer {
    background-color: var(--footer-bg-color);
    color: var(--footer-text-color);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

/* Timeline for publications */
.timeline-container {
    position: relative;
    margin-left: 2.5rem;
    padding-left: 1.5rem;
    border-left: 3px solid #e1e4e8;
}

.timeline-marker {
    position: absolute;
    left: -3rem;
    width: 2.2rem;
    text-align: right;
    font-weight: bold;
    color: var(--link-color);
    background: #fff;
    z-index: 2;
    padding-right: 0.5rem;
    top: 0.8rem;
}

.timeline-container .publication {
    position: relative;
    margin-bottom: 2.5rem;
    padding-left: 2rem;
}

.timeline-container .publication:not(:last-child)::after {
    content: '';
    position: absolute;
    left: -1.2rem;
    top: 2.2rem;
    width: 0.7rem;
    height: calc(100% - 2.2rem);
    border-left: 2px solid #e1e4e8;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
        width: 100%;
        max-width: 400px;
    }

    .nav-button {
        width: 100%;
        margin: 0;
        padding: 0.8rem;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .container {
        padding: 1rem;
    }

    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-content {
        font-size: 0.9rem;
        line-height: 1.8;
        padding: 0 1rem;
    }

    .lab-header {
        min-height: 150px;
        padding: 1rem;
    }

    .lab-header-content {
        padding: 1rem;
    }

    .lab-title {
        font-size: 1.8rem;
        text-align: center;
    }

    .lab-subtitle {
        font-size: 1rem;
        text-align: center;
    }

    .research-area, .publication, .team-member {
        padding: 1rem;
    }

    .research-grid, .team-grid {
        gap: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .nav-button {
        width: 100%;
        text-align: center;
        padding: 0.8rem;
    }

    .hero-content br {
        display: none;  /* Remove line breaks on very small screens */
    }

    .publication-links a {
        display: block;
        margin-bottom: 0.5rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 600px) {
    .timeline-container {
        margin-left: 2.5rem;
        padding-left: 0.7rem;
    }
    .timeline-marker {
        left: -2.5rem;
        width: 1.5rem;
        font-size: 0.95rem;
        padding-right: 0.2rem;
    }
}

/* Base improvements */
.hero-content {
    max-width: min(800px, 90vw);
    margin: 0 auto;
    padding: 0 1rem;
}

.research-area, .publication, .team-member {
    transition: transform 0.2s;
}

.research-area:hover, .publication:hover, .team-member:hover {
    transform: translateY(-2px);
}

/* Improve touch targets */
.nav-button, .publication-links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Better text readability */
p {
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure content is readable over the animation */
header, main, footer {
    position: relative;
    z-index: 1;
}
