:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --border: #e2e8f0;

    /* responsive typography */
    --text-hero: clamp(2.2rem, 5vw, 3.5rem);
    --text-section: clamp(1.5rem, 3vw, 2rem);
    --text-card-title: clamp(1.1rem, 2vw, 1.25rem);
    --text-body: 1rem;
    --text-small: 0.9rem;
}


/* =========================
   GLOBAL
========================= */

* {
    box-sizing: border-box;
}

body {
    padding-top: 20px;
    background: linear-gradient(to bottom, var(--bg), #eef3f9);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: var(--text-body);
}


p {
    color: var(--muted);
    line-height: 1.6;
}




/* =========================
   PAGE BACKGROUND
========================= */

.page-background {
    background: linear-gradient(to bottom, var(--bg), #eef3f9);
    min-height: 100vh;
    padding: 2rem 0;
}


/* =========================
   FOOTER
========================= */

.footer {
    background-color: var(--text);
    color: var(--surface);
    text-align: center;
    font-size: var(--text-small);
    padding: 2rem 1rem;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}


/* =========================
   FOOTER LOGO
========================= */

.footer-logo {
    max-height: 120px;
    max-width: 120px;
    margin: 0 0.75rem;
}


/* =========================
   NAVBAR
========================= */

.navbar {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
}

/* =========================
   NAVBAR LINKS
========================= */

.navbar-nav .nav-link {
    font-size: var(--text-body);
    font-weight: 600;
    color: var(--text);
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary);
}


/* =========================
   NAVBAR TITLE
========================= */

.navbar-title {
    font-size: var(--text-card-title);
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.navbar-title:hover {
    color: var(--primary);
}

/* =========================
   DROPDOWN MENU
========================= */

.dropdown-menu {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.dropdown-item {
    font-size: var(--text-body);
    color: var(--text);
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--primary);
    color: var(--surface);
}


/* =========================
   WELCOME SECTION
========================= */

.container-welcome {
    background: transparent;
    padding: 6rem 2rem;
    text-align: center;
}

.welcome-text {
    font-size: var(--text-hero);
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.welcome-text small {
    font-size: 0.8em;
    font-weight: 600;
}

/* =========================
   MAIN CONTAINER
========================= */

.container.mt-4 {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
}


/* =========================
   SECTION TITLES
========================= */

.section-title {
    font-size: var(--text-section);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.section-title-container {
    background: transparent;
    border: none;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: none;
    text-align: center;
    max-width: 700px;
    margin: 0 auto 2rem auto;
    opacity: 0.9;
}


/* =========================
   BODY
========================= */

body {
    padding-top: 20px;
    background: linear-gradient(to bottom, var(--bg), #eef3f9);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: var(--text-body);
}


/* =========================
   TYPOGRAPHY
========================= */

h2 {
    margin-bottom: 1rem;
    color: var(--text);
}

p {
    margin-bottom: 1rem;
    color: var(--muted);
    line-height: 1.7;
}


/* =========================
   SECTION SPACING
========================= */

.container>div {
    padding-top: 3rem;
    padding-bottom: 3rem;
}


/* =========================
   CARDS
========================= */

.card {
    height: 100%;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.card-title {
    font-size: var(--text-card-title);
    font-weight: 600;
    color: var(--text);
}


/* =========================
   CARD IMAGES
========================= */

.card img,
.card-img-top {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

/* =========================
   RESEARCH TOPIC CARD BODY
========================= */

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem;
}

.card-title {
    min-height: 4.5rem;
    /* Reserve space for up to ~2 lines */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 1rem;
    font-size: var(--text-card-title);
    font-weight: 600;
}

.card-text {
    flex-grow: 1;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 0;
}


/* =========================
   SECTION MARGINS
========================= */

.mb-5,
.my-5 {
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
}


/* =========================
   MAP
========================= */

.map-container {
    width: 100%;
    height: 500px;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    background-color: var(--surface);
}


/* =========================
   CAROUSEL
========================= */

.carousel,
.carousel-inner,
.carousel-item,
.carousel-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 24px;
    overflow: hidden;
}

.carousel-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: var(--surface);
}


/* =========================
   CAROUSEL TEXT OVERLAY
========================= */

.carousel-text {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    color: var(--surface);
    padding: 1rem 2rem;
    border-radius: 16px;
    text-align: center;
    width: 80%;
    backdrop-filter: blur(10px);
}

.carousel-text h3 {
    font-size: var(--text-section);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.carousel-text p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}


/* =========================
   CAROUSEL INDICATORS
========================= */

.carousel-indicators button {
    background-color: var(--surface);
    width: 10px;
    height: 10px;
    border-radius: 50%;
}


/* =========================
   CAROUSEL ARROWS
========================= */

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(15, 23, 42, 0.6);
    border-radius: 50%;
    padding: 1.5rem;
}

/* =========================
   PROJECT MAP
========================= */

#projects-map {
    height: 650px;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

#graph-tooltip {
    position: absolute;
    display: none;
    background: white;
    border-radius: 10px;
    padding: 12px;
    width: 260px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .15);
    z-index: 9999;
}

#graph-tooltip img {
    width: 100%;
    border-radius: 6px;
    margin-bottom: 8px;
}

#graph-tooltip h6 {
    margin-bottom: 6px;
}

/* =========================
   MAP POPUP
========================= */

.map-popup img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.map-popup h5 {
    font-size: var(--text-card-title);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.map-popup p {
    font-size: var(--text-small);
    color: var(--muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}


/* =========================
   PROJECT TAGS
========================= */

.project-tag {
    display: inline-block;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: var(--text-small);
    font-weight: 500;
    margin-top: 0.5rem;
}


/* =========================
   RESEARCH TOPIC CARD TITLES
========================= */
.card .card-body .card-title {
    margin-top: auto;
    padding: 1rem;
    font-size: var(--text-card-title);
    font-weight: 600;
    color: var(--text);
    text-align: left;
    background-color: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 90px;
}

.card-text {
    line-height: 1.4;
    min-height: 3em;
}

/* =========================
   CARD HOVER
========================= */

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}


/* =========================
   CARD SPACING
========================= */

.row-cols-md-2 .col {
    margin-bottom: 1.5rem;
}


/* =========================
   PROJECT CARDS
========================= */

.project-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}


/* =========================
   PROJECT CARD TITLE
========================= */

.project-card .card-title {
    font-size: var(--text-card-title);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}


/* =========================
   PROJECT CARD TEXT
========================= */

.project-card .card-text {
    cursor: pointer;
    color: var(--muted);
    font-size: var(--text-body);
    line-height: 1.6;
}


/* =========================
   PROJECT DESCRIPTION
========================= */

.project-description {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    text-align: left;
}

/* =========================
   PROJECT METADATA
========================= */

.project-location {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.01em;
}


/* =========================
   LINKS
========================= */

.stretched-link:hover {
    color: var(--primary);
    text-decoration: none;
}


/* =========================
   FILTER CARD
========================= */

.filter-card {
    min-height: 350px;
    max-height: 350px;
    border-radius: 20px;
}


/* =========================
   PROJECT LIST
========================= */

.project-list-container {
    max-height: 250px;
    overflow-y: auto;
}


/* =========================
   PROJECT IMAGE
========================= */

.project-image {
    max-width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}


/* =========================
   PROJECT DETAIL PAGE
========================= */


.project-main-image {

    width: 100%;
    max-height: 550px;

    object-fit: contain;

    border-radius: 20px;

    display: block;

    background: white;

}



.project-title {

    font-size: var(--text-section);

    font-weight: 700;

    color: var(--text);

    line-height: 1.2;

    text-transform: capitalize;

}



.project-description {

    max-width: 1000px;

    font-size: 1.15rem;

    color: var(--muted);

    line-height: 1.7;

    text-align: justify;

    text-justify: inter-word;

    overflow-wrap: break-word;

}



.project-info {

    padding-top: 2rem;

}

.project-description-index {
    font-size: 0.9rem;
}


/* =========================
   GLOBAL PROJECTS SECTION
========================= */

.project-findings-text {
    max-width: 900px;
    line-height: 1.7;
    font-size: 1.05rem;
    text-align: justify;
    hyphens: auto;
    color: var(--text);
}

.global-projects {
    margin-top: 3rem;
}

/* Section title */
.global-projects .section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

/* Grid layout */
.global-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

/* Card */
.global-card {
    display: block;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.global-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* Card title */
.global-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* Tags */
.tags {
    margin-top: 0.5rem;
}

.tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    margin-right: 4px;
    margin-top: 4px;
}

/* Buttons */
.btn-outline-primary,
.btn-outline-success {
    font-size: 1rem;
    padding: 10px 20px;
    border-radius: 6px;
}

/* List items */
.list-group-item {
    background: var(--surface);
    border: 1px solid var(--border);
}

/* DOI / metadata section */
.doi-section {
    margin-bottom: 100px;
}

.funding-info {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
}

.participants-list li {
    font-size: 1.1rem;
    line-height: 1.6;
}

.funding-title {
    margin-bottom: 40px;
}

/* Funding logos */
.funding-logos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: stretch;
}

.funding-logos.single-logo {
    grid-template-columns: 1fr;
    justify-items: start;
}

.funding-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    background: var(--surface);
    border-radius: 6px;
    padding: 10px;
    overflow: hidden;
}

.funding-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.funding-logo:hover {
    transform: scale(1.05);
}

#project-universe {
    width: 100%;
    height: 900px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
}

@media (max-width: 768px) {

    :root {
        --text-hero: 2.2rem;
        --text-section: 1.5rem;
        --text-card-title: 1.1rem;
        --text-body: 1rem;
        --text-small: 0.9rem;
    }

    .welcome-text {
        font-size: var(--text-hero);
        line-height: 1.2;
    }

    .section-title {
        font-size: var(--text-section);
    }
}

/* =========================
   MOBILE OPTIMIZATION
========================= */

@media (max-width: 768px) {


    /* overall text size */
    body {
        font-size: 18px;
    }


    /* reduce side empty space */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }


    .container.mt-4 {
        padding: 1rem;
    }


    /* welcome section */
    .welcome-text {
        font-size: 2.2rem;
    }


    .lead {
        font-size: 1.25rem !important;
        line-height: 1.5;
    }



    /* research topic cards */
    /* =========================
   GRID FIXES
========================= */

    .row.g-0 {
        margin-left: 0;
        margin-right: 0;
    }

    .col-md-6 {
        position: relative;
    }

    .col-md-6.position-relative {
        flex: 1.5;
        max-height: 600px;
    }


    /* =========================
   PROJECT DETAIL PAGE
========================= */

    .project-title {
        font-size: var(--text-section);
        font-weight: 700;
        color: var(--text);
        line-height: 1.2;
        text-transform: capitalize;
    }

    .project-description {

        max-width: 1000px;

        font-size: 1.15rem;

        color: var(--muted);

        line-height: 1.7;

        text-align: justify;

        text-justify: inter-word;

        overflow-wrap: break-word;

    }

    .card-title {
        font-size: 1.25rem;
    }


    .card-text {
        font-size: 1.05rem !important;
        line-height: 1.6;
    }


    .card-img-top,
    .card img {
        height: 240px;
    }



    /* global projects */
    .project-description-index {
        font-size: 1.05rem !important;
        line-height: 1.6;
    }


    .global-grid {
        grid-template-columns: 1fr;
    }



    /* carousel mobile */

    .carousel,
    .carousel-inner,
    .carousel-item,
    .carousel-image-container {

        aspect-ratio: 16 / 10;

    }


    .carousel-image-container img {

        object-fit: cover;

    }


    .carousel-text {

        bottom: 0.8rem;
        width: 90%;
        padding: 0.7rem 1rem;

    }


    .carousel-text h3 {

        font-size: 1.2rem;
        margin-bottom: 0.3rem;

    }


    .carousel-text p {

        font-size: 0.9rem;
        line-height: 1.3;

    }



    /* map */
    #projects-map {
        height: 45vh;
    }



    /* graph */
    #project-universe {
        height: 50vh;
    }

}

/* =========================
   LEAFLET POPUPS
========================= */

.leaflet-popup-content-wrapper {
    border-radius: 16px;
}


.leaflet-popup-content {
    margin: 12px;
}


.map-popup {
    width: 260px;
}


.map-popup img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
}



/* =========================
   TEAM CARDS
========================= */

.team-photo {
    width: 85%;
    max-width: 190px;
    height: auto;
    display: block;
    margin: 1.5rem auto 1rem;
    overflow: visible;
}

.team-card .card-title {
    font-size: 0.9rem;
    line-height: 1.2;
    min-height: auto;
    padding: 0;
    background: none;
    border: none;
    text-align: center;
    display: block;
}



@media (max-width:768px) {


    .leaflet-popup {
        max-width: 90vw !important;
    }


    .leaflet-popup-content-wrapper {
        max-width: 90vw;
    }


    .leaflet-popup-content {

        width: auto !important;
        max-height: 50vh;
        overflow-y: auto;

    }


    .map-popup {

        width: auto;

    }


    .map-popup h5 {

        font-size: 1.1rem;

    }


    .map-popup p {

        font-size: .95rem;

    }


    .map-popup img {

        height: 120px;

    }


    /* bigger button on phone */
    .map-popup .btn {

        width: 100%;
        padding: 10px;

    }

}

/* =========================
   MOBILE SECTION SPACING
========================= */

@media (max-width:768px) {


    /* reduce section padding */
    .container>div {

        padding-top: 1rem;
        padding-bottom: 1rem;

    }


    /* reduce Bootstrap section margins */
    .mb-5,
    .my-5 {

        margin-top: 1rem !important;
        margin-bottom: 1rem !important;

    }


    /* section title spacing */
    .section-title-container {

        padding: 0.5rem;
        margin-bottom: 1rem;

    }


}

/* =========================
   MOBILE TEXT LAYOUT
========================= */

@media (max-width:768px) {

    .project-description,
    .project-findings-text,
    .project-description-index,
    .card-text {

        text-align: left !important;
        text-justify: auto;
        text-wrap: normal;
        hyphens: none;
        -webkit-hyphens: none;

    }

}

@media(max-width:768px) {

    .project-main-image {

        max-height: 300px;

    }


    .project-description {

        font-size: 1rem;

        line-height: 1.6;

        text-align: left;

    }

}