:root {
    --ntu-red: #c8102e;
    --ntu-blue: #002b49;
    --primary: #0f172a;
    --accent: #2563eb;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --gradient-ntu: linear-gradient(135deg, #002b49 0%, #0f172a 100%);
}

/* ==========================================================================
   Global Reset
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    /* Note: overflow-x: clip prevents horizontal scroll without breaking position: sticky */
    overflow-x: clip;
    font-family: 'Plus Jakarta Sans', sans-serif;
 w   color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
}

* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   Unified Sticky Header
   ========================================================================== */
header {
    background: #ffffff;
    color: var(--text-dark);
    position: -webkit-sticky; /* Safari support */
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.5rem;
}

.header-row-1, 
.header-row-2, 
.mobile-home-icon, 
.hamburger-toggle {
    display: none !important;
}

/* Desktop Left: NTU Branding */
.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    justify-content: flex-start;
}

.top-bar-ntu-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
}

.top-bar-ntu-logo:hover {
    transform: scale(1.02);
}

.school-subtext {
    font-size: 0.9rem;
    color: #111827;
    text-decoration: none;
    display: block;
    text-align: left;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.2px;
    transition: color 0.2s ease;
}

.school-subtext:hover {
    color: var(--ntu-red);
}

/* Desktop Center: Navigation Menu */
nav {
    display: flex;
    justify-content: center;
    border-left: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    padding: 0.2rem 1rem;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: #334155;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.98rem; 
    padding: 0.45rem 0.6rem; 
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.nav-links a i {
    color: #64748b;
    font-size: 0.92rem;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--ntu-red);
    background: #fdf2f2;
}

.nav-links a:hover i,
.nav-links a.active i {
    color: var(--ntu-red);
}

/* Desktop Right: IMS Logo */
.header-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    align-self: center;
}

.nav-ims-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    transition: transform 0.2s ease;
}

.nav-ims-logo:hover {
    transform: scale(1.02);
}

.lab-subtext {
    font-size: 1rem;
    color: #111827;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-align: center;
    display: block;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.lab-subtext:hover {
    color: var(--ntu-red);
}

/* Dropdowns */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    min-width: 210px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    list-style: none;
    padding: 0.5rem 0;
    z-index: 100;
}

.nav-links li:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    color: var(--text-dark) !important;
    padding: 0.6rem 1.2rem !important;
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.dropdown a:hover {
    background: #f8fafc !important;
    color: var(--ntu-red) !important;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    background: var(--gradient-ntu);
    color: white;
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid var(--ntu-red);
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2.5rem;
    align-items: center;
}

.hero h2 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.8rem;
}

.hero p {
    font-size: 1rem;
    color: #cbd5e1;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.hero-tags .tag {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.82rem;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.hero-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 1.5rem;
}

.hero-card .section-img {
    border-radius: 8px;
    margin-bottom: 1rem;
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.hero-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: #ffffff;
}

.hero-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hero-card li {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* ==========================================================================
   Page Main Container & Sections
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Vision & Mission Grid */
.vm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.vm-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--ntu-red);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.vm-card h3 {
    color: #0f172a;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.vm-card p {
    color: #475569;
    font-size: 0.98rem;
    line-height: 1.6;
    margin: 0;
    text-align: justify;
}

/* About Layout */
.about-card.about-layout {
    display: grid;
    grid-template-columns: 1.1fr 1.1fr;
    gap: 2rem;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.about-text p {
    color: #475569;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    text-align: justify;
}

.about-text p:last-child {
    margin-bottom: 0;
}

.about-image img {
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* Impact Stats Grid */
.stats-grid-separate {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin: 2.5rem 0;
}

.stat-card-item {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 12px;
    padding: 1.75rem 1.25rem;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.stat-card-item .number {
    font-size: 2.25rem;
    font-weight: 800;
    color: #60a5fa;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.stat-card-item .label {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards & Core Research Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.card-content {
    padding: 1.25rem 1.5rem 1.5rem;
}

.card-content h3 {
    font-size: 1.18rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.card-content p {
    color: var(--text-muted);
    font-size: 0.94rem;
    line-height: 1.6;
    margin: 0;
}

.card-img-wrapper {
    position: relative;
    width: 100%;
    height: 190px;
    overflow: hidden;
}

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

.pill-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Call to Action Banner */
.cta-banner {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    margin: 3rem 0 1rem;
    text-align: center;
}

.cta-banner h3 {
    color: #0f172a;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.cta-banner p {
    color: #475569;
    max-width: 650px;
    margin: 0 auto 1.5rem;
    font-size: 0.98rem;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary {
    background: var(--ntu-red);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #a00c24;
}

.btn-secondary {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* ==========================================================================
   Footer Section
   ========================================================================== */
footer {
    background: var(--primary);
    color: #94a3b8;
    padding: 3rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.3fr 0.9fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    color: #ffffff;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col a {
    color: #94a3b8;
    text-decoration: none;
}

.footer-col a:hover {
    color: #ffffff;
}

.copyright {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Layout
   ========================================================================== */
@media (max-width: 1150px) {
    .footer-container {
        grid-template-columns: 1fr !important;
    }

    .header-container {
        display: flex !important;
        flex-direction: column !important;
        padding: 0.8rem 1rem !important;
        gap: 6px !important;
    }

    .header-container > .header-left,
    .header-container > .header-right {
        display: none !important;
    }

    .header-row-1 {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100%;
    }

    .header-row-1 .header-left, 
    .header-row-1 .header-right {
        display: flex !important;
        flex-direction: column;
        align-items: center;
    }

    .header-row-1 .top-bar-ntu-logo, 
    .header-row-1 .nav-ims-logo {
        height: 35px !important;
    }

    .header-row-1 .school-subtext, 
    .header-row-1 .lab-subtext {
        font-size: 0.55rem !important;
        text-align: center;
    }

    .header-row-2 {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100%;
        border-top: 1px solid var(--border);
        padding-top: 6px;
    }

    .mobile-home-icon {
        display: flex !important;
        align-items: center;
        gap: 5px;
        font-size: 0.9rem;
        color: var(--primary);
        text-decoration: none;
        font-weight: 600;
    }

    .hamburger-toggle {
        display: flex !important;
        align-items: center;
        gap: 5px;
        background: transparent !important;
        border: none !important;
        color: var(--primary) !important;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        z-index: 1200;
    }

    nav {
        display: block !important;
        border: none !important;
        padding: 0 !important;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        align-items: flex-start;
        padding: 4.5rem 1.5rem 2rem;
        gap: 0;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 1100;
        border-left: 1px solid var(--border);
        display: flex !important;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    .nav-links a {
        padding: 0.85rem 0;
        width: 100%;
        font-size: 1.05rem;
        justify-content: flex-start;
        gap: 0.75rem;
        border-radius: 0;
        color: var(--text-dark);
        background: transparent !important;
    }

    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: none;
        padding-left: 1rem;
        background: #f8fafc;
        border: none;
        border-radius: 0;
    }

    .nav-links li.active .dropdown {
        display: block;
    }

    .dropdown a {
        color: var(--text-dark) !important;
    }

    .hero-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .about-card.about-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid-separate {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid-separate {
        grid-template-columns: 1fr;
    }
}
