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

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    background-color: #f9fcff;
    color: #333;
}

/* Header and Navigation */
header {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    padding: 1rem;
    z-index: 1000;
    box-shadow: 0 4px 2px rgba(163, 182, 188, 0.5);
    height: 80px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo img {
    height: 50px;
    padding: 0;
    margin: 0;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    transition: all 0.3s ease; /* Smooth transition for mobile menu */
}

.nav-menu li a {
    color: #000000;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
}

.nav-menu li a:hover {
    color: #33CC99;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1100; /* Ensure hamburger is above other elements */
    pointer-events: auto; /* Ensure clickability */
    position: relative; /* Ensure stacking context */
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: #000000;
    margin: 2px 0;
    transition: all 0.3s ease; /* Smooth transition for hamburger animation */
}

/* Prevent overlap by other elements */
.hamburger * {
    pointer-events: auto;
}

/* Hero Section */
.hero {
    height: 80vh;
    min-height: 400px; /* Ensure minimum height for mobile */
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('../assets/intro.jpg') no-repeat center center/cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #ffffff;
    background-size: cover; /* Ensure background scales properly */
}

.hero h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 3rem;
}

.hero p {
    font-size: 1.2rem;
    margin-top: 1rem;
    max-width: 600px;
}

/* Content Sections */
.intro, .content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

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

.card {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

/* Gallery */
.gallery {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

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

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

.gallery-item p {
    text-align: center;
    margin-top: 0.5rem;
}

/* Latest News */
.latest {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.latest h2 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.latest-news-list {
    list-style: none;
    max-width: 1000px;
    margin: 0 auto;
    text-align: left;
}

.latest-news-list li {
    margin-bottom: 20px;
}

.latest-news-list .news-item {
    display: flex;
    align-items: center; /* Changed from flex-start to center for vertical alignment */
    gap: 20px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(163, 182, 188, 0.5);
}

.latest-news-list .content {
    flex: 1;
}

.latest-news-list .content h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #003366;
    margin-bottom: 0.5rem;
}

.latest-news-list .content p {
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 0.75rem;
}

.latest-news-list .citation p {
    font-size: 0.9rem;
    font-style: italic;
    color: #555;
    margin-bottom: 0.5rem;
}

.latest-news-list .citation a {
    color: #0066cc;
    text-decoration: none;
    font-style: normal;
}

.latest-news-list .citation a:hover {
    text-decoration: underline;
}

.latest-news-list .image-container {
    flex: 0 0 30%; /* Takes up 30% of the width */
    display: flex;
    justify-content: center; /* Centers horizontally */
    align-items: center; /* Centers vertically */
    min-height: 150px; /* Ensures enough space for centering */
}

.latest-news-list .responsive-img {
    max-width: 200px; /* Limits maximum size */
    width: 100%; /* Scales within container */
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

.responsive-img {
    max-width: 100%;
    height: auto;
}

/* Footer */
footer {
    background: #003366;
    color: #fff;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

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

.social-icon img {
    width: 30px;
    margin: 0 0.5rem;
}

/* Research Section */
.research {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.research h1 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
}

.research p {
    margin-bottom: 2rem;
}

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

.direction {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.direction h2 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
}

.direction p {
    margin-bottom: 1.5rem;
}

.project {
    margin-bottom: 1.5rem;
}

.project h3 {
    color: #3399CC;
    margin-bottom: 0.5rem;
}

.project p {
    margin-bottom: 0.5rem;
}

.publications {
    list-style: none;
    margin-left: 1rem;
}

.publications li {
    margin-bottom: 0.5rem;
    text-align: left;
}

.publications a {
    color: #000000;
    text-decoration: none;
}

.publications a:hover {
    text-decoration: underline;
    color: #3399CC;
}

/* Direction Header with Icon */
.direction-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.direction-icon {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

/* Publications Section */
.publications {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.publications h1 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
}

.publications p {
    margin-bottom: 2rem;
}

.sort-controls {
    margin-bottom: 2rem;
}

.sort-controls label {
    font-weight: bold;
    margin-right: 0.5rem;
}

.sort-controls select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Open Sans', sans-serif;
    background: #fff;
    cursor: pointer;
}

.publication-list {
    list-style: none;
    text-align: left;
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.publication-list li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

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

.publication-list strong {
    color: #3399CC;
}

.publication-list .topic {
    color: #33CC99;
    font-style: italic;
}

/* Data & Tools Section */
.data-tools {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.data-tools h1 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
}

.data-tools p {
    margin-bottom: 2rem;
}

.data-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 2rem;
}

.tool {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.tool h2 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.tool just p {
    margin-bottom: 1rem;
}

.github-embed {
    margin-top: 1rem;
}

.github-embed iframe {
    border-radius: 4px;
}

/* News Section */
.news {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.news h1 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
}

.news p {
    margin-bottom: 2rem;
}

.news-list {
    list-style: none;
    text-align: left;
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.news-list li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

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

.news-list strong {
    color: #3399CC;
}

.news-list .category {
    color: #33CC99;
    font-style: italic;
}

/* X Updates Section */
.x-updates {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.x-updates h2 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
}

.x-updates p {
    margin-bottom: 1rem;
}

.x-embed {
    max-width: 500px;
    margin: 0 auto;
}

/* Team Section */
.team-section {
    margin-top: 2rem;
}

.team-section h3 {
    font-family: 'Montserrat', sans-serif;
    color: #003366;
    margin-bottom: 1rem;
    text-align: left;
}

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

.member {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.member img {
    width: 100%;
    max-width: 150px;
    height: auto;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.member a {
    color: #3399CC;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
}

.member a:hover {
    color: #33CC99;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .data-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, auto);
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        padding: 1rem;
        box-shadow: 0 4px 2px rgba(163, 182, 188, 0.5);
    }

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

    .hamburger {
        display: flex;
    }

    .hero {
        height: 60vh;
        min-height: 300px;
        padding: 3rem 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .research-directions {
        grid-template-columns: 1fr;
    }

    .data-tools-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(8, auto);
    }

    .team-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .x-embed {
        max-width: 100%;
    }
    /* Latest News Responsive Styles */
    .latest-news-list .news-item {
        flex-direction: column;
        align-items: center;
    }

    .latest-news-list .image-container {
        flex: none;
        width: 100%;
        max-width: 300px;
        min-height: 100px; /* Adjusted for mobile */
    }

    .latest-news-list .responsive-img {
        max-width: 300px;
        width: 100%;
        margin: 0;
    }

    .latest-news-list .content {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .logo img {
        height: 40px;
    }
}

/* Fallback for no JavaScript */
.no-js .nav-menu {
    display: flex;
    flex-direction: row;
}

/* Hamburger Animation */
.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}