/* ─── Design Tokens ───────────────────────────────────────────── */
:root {
    --brand-blue:   #0090f0;
    --brand-green:  #1a903e;
    --primary:      #0056b3;
    --bg-light:     #f4f4f9;
    --text:         #333;
    --text-dark:    #111;
    --text-grey:    #666;
    --nav-bg:       #ffffff;
    --nav-height:   64px;
    --section-pad:  5rem 10%;
    --radius:       8px;
    --shadow:       0 4px 6px rgba(0,0,0,0.07);
    --transition:   0.3s ease;
    --card-bg:      #ffffff;
    --body-bg:      #ffffff;
    --footer-bg:    #222222;
}

/* ─── Dark Mode Tokens ────────────────────────────────────────── */
[data-theme="dark"] {
    --primary:      #4da6ff;
    --brand-blue:   #4da6ff;
    --brand-green:  #3ecf6e;
    --bg-light:     #1e1e2e;
    --text:         #d0d0e0;
    --text-dark:    #eaeaf5;
    --text-grey:    #9090aa;
    --nav-bg:       #13131f;
    --card-bg:      #1a1a2e;
    --body-bg:      #12121c;
    --footer-bg:    #0a0a12;
    --shadow:       0 4px 6px rgba(0,0,0,0.4);
}

/* ─── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html  { scroll-behavior: smooth; }
body  {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: var(--body-bg);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}
ul  { list-style: none; }
a   { text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── Navigation ──────────────────────────────────────────────── */
nav {
    background: var(--nav-bg);
    padding: 0 5%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--nav-height);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary);
}
.logo img { height: 46px; width: auto; object-fit: contain; }

.nav-right { display: flex; align-items: center; gap: 2rem; }

.nav-links { display: flex; gap: 2rem; }
.nav-links a {
    color: var(--text);
    font-weight: 500;
    transition: color var(--transition);
    position: relative;
    padding-bottom: 3px;
}
.nav-links a:hover { color: var(--primary); }

/* Active nav link — set by IntersectionObserver in main.js */
.nav-links a.active {
    color: var(--primary);
}
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* ─── Dark Mode Toggle ────────────────────────────────────────── */
.theme-toggle {
    background: none;
    border: 1.5px solid var(--text-grey);
    border-radius: 20px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
    transition: border-color var(--transition), color var(--transition);
    white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Hamburger — hidden on desktop */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: var(--transition);
    border-radius: 2px;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.65rem 1.6rem;
    border-radius: var(--radius);
    font-weight: bold;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}
.btn-primary { background: #fff; color: var(--primary); border-color: #fff; }
.btn-primary:hover { background: transparent; color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ─── Sections ────────────────────────────────────────────────── */
section { padding: var(--section-pad); }
.bg-light { background-color: var(--bg-light); }

.section-title {
    text-align: center;
    font-size: clamp(1.6rem, 4vw, 2.5rem);
    margin-bottom: 3rem;
    color: var(--primary);
}

.section-footer {
    text-align: center;
    margin-top: 2.5rem;
}

/* ─── Hero ────────────────────────────────────────────────────── */
/* .hero {
    min-height: 100vh;
    margin-top: var(--nav-height);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 3rem 6%;
} */
.hero h1 { font-size: clamp(2rem, 6vw, 4rem); margin-bottom: 0.5rem; }
.hero h2 { font-size: clamp(1rem, 2.5vw, 1.6rem); font-weight: 400; margin-bottom: 1rem; }
.hero p  { font-size: clamp(0.95rem, 1.8vw, 1.2rem); max-width: 640px; margin-bottom: 2rem; opacity: 0.92; }


.hero {
    position: relative;
    min-height: 100vh;
    /* margin-top is usually the height of your navbar */
    margin-top: var(--nav-height); 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 3rem 6%;
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('/static/images/hero-bg.jpg');
    background-size: cover;
}

.top-marquee {
    position: absolute;
    top: 0; /* Move to the top */
    left: 0;
    width: 100%;
    background: var(--brand-blue); /* Using a blue tint to distinguish it */
    color: var(--bg-light);
    display: flex;
    height: 35px; /* Slightly slimmer for the top position */
    overflow: hidden;
    z-index: 100;
}

.marquee-label {
    background: var(--brand-green); /* Darker blue for the label */
    padding: 0 15px;
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    z-index: 101;
}
.marquee-label:hover{
    cursor: pointer;
    color: var(--text);
}

.marquee-content {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
}

.marquee-track {
    display: inline-block;
    white-space: nowrap;
    animation: marquee-scroll 35s linear infinite;
}

.marquee-track:hover {
    animation-play-state: paused; /* Allows users to read at their own pace */
}
.event-item {
    display: inline-block;
    padding-left: 60px; /* Space between items */
    font-size: 0.85rem;
}

@keyframes marquee-scroll {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

/* Ensure Hero content doesn't hit the marquee */
.hero-content {
    margin-top: 40px; 
}

/* ─── Page Header (for inner pages like publications.html) ─────── */
.page-header {
    background: linear-gradient(135deg, var(--primary), #003d80);
    margin-top: var(--nav-height);
    padding: 3.5rem 10%;
    color: #fff;
}
.page-header h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 0.4rem; }
.page-header p  { opacity: 0.85; font-size: 1.05rem; }

/* ─── About Grid ──────────────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.about-grid h3 { color: var(--primary); margin-bottom: 0.75rem; }
.about-grid ul { padding-left: 1.2rem; list-style: disc; }
.about-grid ul li { margin-bottom: 0.3rem; }

/* ─── Cards & Grids ───────────────────────────────────────────── */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

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

/* Container for the flip effect */
.flip-card {
    background-color: transparent;
    height: 220px; /* Adjust as needed */
    perspective: 1000px; /* Gives the 3D look */
}

/* This container is needed to position the front and back side */
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 1s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 12px;
}

/* Do the flip when you move the mouse over the flip box container */
.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
    
}

/* Position the front and back side */
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Title at bottom on front */
    padding: 20px;
    box-sizing: border-box;
}

/* Style the front side */
.flip-card-front {
    background-size: cover;
    background-position: center;
    color: white;
}

.flip-card-front h3 {
    margin: 0;
    padding: 0 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
}

/* Style the back side */
.flip-card-back {
    background-color: #f8f9fa; /* Light grey background for readability */
    color: #333;
    transform: rotateY(180deg);
    justify-content: center; /* Center text on back */
}

.back-content h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

.back-content p {
    font-size: 0.95rem;
    line-height: 1.5;
}


.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform var(--transition), background var(--transition);
}
.card:hover { transform: translateY(-5px); }
.card h3 { color: var(--primary); margin-bottom: 0.5rem; }

/* ─── News Section ────────────────────────────────────────────── */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.news-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
    transition: transform var(--transition), background var(--transition);
}
.news-card:hover { transform: translateY(-4px); 
                cursor: pointer;
}

.news-date {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-green);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.news-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 9px;
    border-radius: 12px;
    background: var(--bg-light);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.news-card h3 a {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
    line-height: 1.4;
    
}

.news-card p { font-size: 0.92rem; color: var(--text-grey); }

.news-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem; /* Offsets card padding */
}

/* ─── Team ────────────────────────────────────────────────────── */
.team-category {
    text-align: center;
    font-size: clamp(1.2rem, 3vw, 2rem);
    margin: 2.5rem auto 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #ccc;
    max-width: 260px;
    color: var(--text-dark);
}

.team-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 3px solid var(--primary);
}

.team-name:hover {
    color: var(--brand-blue);
    cursor: pointer;
}

.team-photo-wrapper {
    position: relative;
    display: inline-block;
    transition: transform var(--transition);
}
.team-photo-wrapper:hover {
    transform: scale(1.05);
}


/* ─── Publications ────────────────────────────────────────────── */
.pub-list  { max-width: 900px; margin: 0 auto; }
.pub-item  { margin-bottom: 2rem; line-height: 1.55; }
.pub-year  { font-weight: 800; color: var(--brand-green); margin-right: 6px; }
.pub-title { font-weight: 600; color: var(--brand-blue); font-size: 1.05rem; }
.pub-authors { display: block; margin-top: 4px; color: var(--text-dark); }
.pub-journal { font-style: italic; color: var(--text-grey); }
.pub-link {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #fff;
    background: var(--brand-blue);
    padding: 3px 12px;
    border-radius: 4px;
    transition: background var(--transition);
}
.pub-link:hover { background: var(--brand-green); }

/* ─── Publications Page — Filter Bar ─────────────────────────── */
.pub-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.pub-search {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 1rem;
    border: 1.5px solid #ccc;
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color var(--transition);
}
.pub-search:focus { outline: none; border-color: var(--primary); }

.year-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.year-btn {
    padding: 0.35rem 0.9rem;
    border: 1.5px solid var(--primary);
    border-radius: 20px;
    background: transparent;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.year-btn:hover,
.year-btn.active { background: var(--primary); color: #fff; }

.pub-count {
    font-size: 0.88rem;
    color: var(--text-grey);
    max-width: 900px;
    margin: 0 auto 1.2rem;
}


.filter-actions {
    display: flex;
    gap: 10px;
}

.pub-dropdown, .pub-sort-btn {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.pub-sort-btn:hover {
    background-color: #f8f9fa;
}

/* ─── Contact ─────────────────────────────────────────────────── */
.contact-body { text-align: center; line-height: 2;}
.contact-logo {
    display: block;
    /* margin: 0 auto 0.5rem; */
    width: 120px;
    height: 120px;
    object-fit: contain;
}
.footer-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ─── Footer ──────────────────────────────────────────────────── */
footer { background: var(--footer-bg); color: #fff; text-align: center; padding: 1.8rem 10%; transition: background var(--transition); }

/* ─── Back-to-Top ─────────────────────────────────────────────── */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity var(--transition), transform var(--transition);
    z-index: 999;
}
#back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#back-to-top:hover { background: var(--brand-green); }

/* ─── Utility ─────────────────────────────────────────────────── */
.state-msg { text-align: center; color: var(--text-grey); padding: 1rem 0; }
.state-msg--error { color: #c00; }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --section-pad: 3.5rem 6%; }

    .nav-toggle { display: flex; }
    .theme-toggle { font-size: 0.85rem; padding: 3px 8px; }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0; right: 0;
        background: var(--nav-bg);
        flex-direction: column;
        gap: 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        padding: 0.5rem 0 1rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a { display: block; padding: 0.75rem 6%; border-bottom: 1px solid var(--bg-light); }
    .nav-links a.active::after { display: none; }

    .about-grid { grid-template-columns: 1fr; }
    .grid-cards  { grid-template-columns: 1fr; }
    .news-grid   { grid-template-columns: 1fr; }
    .pub-controls { flex-direction: column; align-items: stretch; }

    #back-to-top { bottom: 1.2rem; right: 1.2rem; }
}

@media (max-width: 480px) {
    .logo       { font-size: 1.1rem; }
    .team-photo { width: 90px; height: 90px; }
}
