:root {
    scroll-behavior: smooth;
    /* Color Palette - Premium Medical/Global Health Theme */
    --primary: #004a99;
    /* Charité Blue */
    --primary-light: #0072bc;
    --secondary: #00a651;
    /* Medical Green */
    --accent: #f9a61a;
    /* Warm accent for CTA/Highlight */
    --text-dark: #1a1a1a;
    --text-light: #666666;
    --bg-white: #ffffff;
    --bg-offwhite: #f8f9fa;
    --bg-dark: #121212;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-white);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.typing-cursor::after {
    content: '|';
    margin-left: 2px;
    color: var(--secondary);
    animation: blink 0.8s infinite;
}

.animate-fade {
    animation: fadeIn 0.8s ease forwards;
}

/* Scroll Reveal */
.reveal {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Glassmorphism utility */
.glass {
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

/* Hero Section */
.hero {
    height: 100vh;
    margin-top: -80px;
    /* pull up behind the nav so no white gap */
    padding-top: 80px;
    /* keep content clear of nav */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background: var(--bg-dark);
    overflow: hidden;
    padding-left: 5%;
    padding-right: 5%;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('Pics/Background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    filter: grayscale(20%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
}

#typing-header {
    opacity: 0;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    color: white;
    margin-bottom: 20px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.hero h1 span {
    color: var(--secondary);
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hero-btns {
    display: flex;
    gap: 20px;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hero-content .show {
    opacity: 1;
}

/* Buttons */
.btn {
    padding: 15px 35px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
    font-family: 'Outfit';
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 74, 153, 0.3);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-3px);
}

.btn-secondary {
    background: white;
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--bg-offwhite);
    transform: translateY(-3px);
}

/* Sections & About */
.section-title {
    margin-bottom: 60px;
    text-align: center;
}

.section-title h2 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    color: var(--primary);
}

.title-underline {
    width: 60px;
    height: 4px;
    background: var(--secondary);
    margin: 15px auto 0;
    border-radius: 2px;
}

.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    align-items: start;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text-light);
}

.about-links {
    padding: 30px;
    border-radius: 20px;
}

.about-links h3 {
    margin-bottom: 20px;
    color: var(--primary);
}

.about-links ul {
    list-style: none;
}

.about-links li {
    margin-bottom: 12px;
}

.about-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: var(--transition);
}

.about-links a:hover {
    color: var(--secondary);
    padding-left: 5px;
}

/* Section padding */
section {
    padding: 100px 5%;
}

@media (max-width: 768px) {
    section {
        padding: 60px 5%;
    }
}

@media (max-width: 768px) {
    .map-container {
        height: 350px;
    }
}

.map-grayscale .leaflet-tile {
    filter: grayscale(100%) contrast(1.1) brightness(1.05);
}

/* Navigation */
nav {
    position: sticky;
    top: 20px;
    left: 2.5%;
    width: 95%;
    /* Increased from 90% for better scaling */
    max-width: 1000px;
    z-index: 1000;
    padding: 10px 20px;
    /* Reduced from 40px padding to save space */
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    overflow: visible;
    /* allow dropdown to extend beyond nav bounds */
}

/* For screens wider than max-width (1200px), center it properly */
@media (min-width: 1264px) {
    nav {
        left: 50%;
        transform: translateX(-50%);
    }
}

.nav-content {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Outfit';
    color: var(--primary);
    flex-shrink: 0;
}

.logo span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: clamp(10px, 2vw, 30px);
    /* Dynamic gap that scales with screen width */
    margin-left: 20px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
    /* Prevents text wrapping in nav */
}

.nav-links a:hover {
    color: var(--primary);
}

@media (max-width: 1024px) {
    nav {
        padding: 12px 20px;
    }

    .nav-links {
        gap: 15px;
    }
}

/* ---- Burger button (hidden on desktop) ---- */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: var(--transition);
    flex-shrink: 0;
    order: 2;
    /* sits after logo, before nav-links */
}

.burger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

/* Animate burger → X */
.burger.open span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.burger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.burger.open span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

@media (max-width: 900px) {
    .burger {
        display: flex;
    }

    .nav-links {
        /* Hidden by default on mobile */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--glass-border);
        border-radius: 24px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        padding: 0;
        max-height: 0;
        vertical-align: middle;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.3s ease;
    }

    .nav-links.open {
        max-height: 400px;
        opacity: 1;
        pointer-events: auto;
        padding: 16px 0;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Make the nav position relative so the dropdown is anchored to it */
    nav {
        position: sticky;
        flex-wrap: wrap;
        overflow: visible;
    }
}

/* News Section */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.news-card {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition);
}

.news-card:hover {
    transform: translateY(-5px);
    background: white;
}

.news-image {
    width: 100%;
    height: 180px;
    /* Reduced image height */
    overflow: hidden;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.news-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-date {
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.news-content h3 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.news-content p {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 0;
}

.hidden-news {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hidden-news.visible {
    display: flex;
    opacity: 1;
}

.news-action {
    text-align: center;
    margin-top: 40px;
}

/* Research Section */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.research-card {
    padding: 50px 30px;
    border-radius: 40px;
    text-align: center;
    transition: var(--transition);
}

.research-card:hover {
    transform: translateY(-15px);
    background: white;
}

.card-icon {
    width: 160px;
    height: 160px;
    margin: 0 auto 30px;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.research-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

/* Collaborations Map Section */

.map-container {
    height: 500px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    z-index: 1;
    /* Ensure it stays behind navbar and popups work */
}

/* Team Section */
.team-grid {
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.team-leader {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 30px;
    padding: 35px;
    border-radius: 30px;
    align-items: center;
    border-top: 6px solid var(--primary);
}

.team-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.team-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.role {
    color: var(--secondary);
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.team-leader h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.btn-small {
    display: inline-block;
    margin-top: 25px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

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

.team-category h3 {
    margin-bottom: 30px;
    color: var(--primary);
    font-size: 1.8rem;
    padding-left: 10px;
    border-left: 4px solid var(--secondary);
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

@media (max-width: 500px) {
    .member-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto;
    }
}

.member-card {
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.member-card:hover {
    transform: translateY(-5px);
    background: white;
}

.mini-avatar {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    object-fit: cover;
    display: block;
}

.member-card h4 {
    color: var(--primary);
    margin-bottom: 3px;
    font-size: 0.95rem;
}

.member-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

@media (max-width: 900px) {
    .team-leader {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 40px;
    }

    .team-image {
        max-width: 350px;
        margin: 0 auto;
    }
}

/* GitHub Section */
.github-section {
    margin: 0 5% 120px;
    padding: 100px 60px;
    border-radius: 50px;
    text-align: center;
}

.github-content h2 {
    font-size: 3rem;
    margin-bottom: 25px;
    color: var(--primary);
}

.github-content p {
    max-width: 650px;
    margin: 0 auto 60px;
    font-size: 1.1rem;
}

.github-links {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.repo-card {
    text-align: left;
    padding: 40px;
    border-radius: 35px;
    width: 350px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    border: 1px solid transparent;
}

.repo-card:hover {
    transform: translateY(-10px);
    background: white;
    border-color: var(--glass-border);
}

.repo-card span {
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 800;
    text-transform: uppercase;
}

.repo-card h4 {
    margin: 15px 0;
    color: var(--primary);
    font-size: 1.4rem;
}

/* Footer */
footer {
    padding: 10px 10%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 40px;
}

.footer-logo {
    font-size: 28px;
    font-weight: 800;
    font-family: 'Outfit';
    color: var(--primary);
}

.footer-logo span {
    color: var(--secondary);
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

@media (max-width: 1000px) {
    .team-grid {
        grid-template-columns: 1fr;
    }

    .github-section {
        padding: 60px 30px;
    }
}