@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #101010;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --accent-color: #5B8FFF;
    /* The Blue Accent */
    --accent-glow: rgba(91, 143, 255, 0.2);
    --card-bg: rgba(20, 20, 20, 0.6);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --navbar-bg: rgba(16, 16, 16, 0.7);
    --font-family: 'Montserrat', -apple-system, system-ui, sans-serif;
    --border-radius: 20px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradients/Blobs */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 800;
    color: var(--text-color);
    line-height: 1.2;
}

/* Typography */
p {
    color: var(--text-muted);
}

a {
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
}

.text-accent {
    color: var(--accent-color);
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(to right, #ffffff, var(--accent-color), #ffffff, #888888);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 8s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

/* Glassmorphism */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
}

/* Navbar */
nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    align-items: center;
    border-radius: 100px;
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease, top 0.4s ease;
}

nav.hidden {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
    pointer-events: none;
}

.logo {
    margin-right: 1rem;
    flex: 0 0 auto;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    margin: 0 2rem;
}

.nav-item {
    position: relative;
    padding: 0.5rem 0.8rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 1rem;
    border-radius: 100px;
    display: block;
}

.nav-links a:not(.btn):hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Dropdown Styles */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 240px;
    opacity: 0;
    visibility: hidden;
    list-style: none;
    padding: 0.8rem 0;
    margin: 0.5rem 0 0 0;
    background: var(--navbar-bg);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1000;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
    margin: 0.2rem 0.8rem;
}

.nav-item:hover .dropdown-menu li {
    transform: translateY(0);
    opacity: 1;
}

/* Staggered Dropdown Animation */
.nav-item:hover .dropdown-menu li:nth-child(1) {
    transition-delay: 0.1s;
}

.nav-item:hover .dropdown-menu li:nth-child(2) {
    transition-delay: 0.15s;
}

.nav-item:hover .dropdown-menu li:nth-child(3) {
    transition-delay: 0.2s;
}

.nav-item:hover .dropdown-menu li:nth-child(4) {
    transition-delay: 0.25s;
}

.dropdown-menu a {
    width: 100%;
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 12px;
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 0.1rem 0;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transform: translateX(5px);
}

.nav-links a.btn {
    padding: 0.7rem 1.5rem;
    background: var(--text-color);
    color: var(--bg-color);
    margin-left: 1rem;
    font-weight: 600;
}

.nav-links a.btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

/* Hero Section */
.hero {
    min-height: 100dvh;
    /* Use dynamic viewport height for mobile browsers */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 150px 2rem 0 2rem;
    /* Add top padding to account for fixed navbar */
    position: relative;
}

.hero h1 {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 2rem;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 0 5%;
}

.bento-item {
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bento-item:hover {
    transform: scale(1.02);
}

.bento-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), var(--accent-glow), transparent 40%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.bento-item:hover::before {
    opacity: 1;
}

/* Team Card */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 2rem 5%;
}

.team-card {
    padding: 1.5rem;
    text-align: center;
}

.team-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    border: 3px solid var(--accent-color);
    padding: 5px;
}

/* Button */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: none;
    background: var(--text-color);
    color: var(--bg-color);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
}

/* Footer */
footer {
    padding: 3rem 5%;
    text-align: center;
    border-top: var(--glass-border);
    margin-top: 4rem;
    position: relative;
    z-index: 1;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

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

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-content {
    text-align: center;
}

.loader-circle {
    width: 60px;
    height: 60px;
    border: 4px solid var(--glass-border);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

/* IEEE Merge Loader Animation */
.ieee-merge-loader {
    position: relative;
    width: 200px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.approach-line {
    position: absolute;
    background: var(--accent-color);
    border-radius: 2px;
    opacity: 0;
}

.top-line {
    width: 100%;
    height: 4px;
    top: 0;
    left: 0;
    transform: scaleX(0);
    transform-origin: left;
    animation: approach-top 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.2s;
}

.bottom-line {
    width: 100%;
    height: 4px;
    bottom: 0;
    left: 0;
    transform: scaleX(0);
    transform-origin: right;
    animation: approach-bottom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.4s;
}

.left-line {
    width: 4px;
    height: 100%;
    top: 0;
    left: 0;
    transform: scaleY(0);
    transform-origin: top;
    animation: approach-left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.6s;
}

.right-line {
    width: 4px;
    height: 100%;
    top: 0;
    right: 0;
    transform: scaleY(0);
    transform-origin: bottom;
    animation: approach-right 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.8s;
}

.ieee-letters {
    display: flex;
    gap: 15px;
    position: relative;
    z-index: 10;
}

.letter {
    font-family: 'Outfit', sans-serif;
    font-size: 40px;
    font-weight: 700;
    color: transparent;
    -webkit-text-fill-color: transparent;
    background: linear-gradient(to right, var(--accent-color), #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    opacity: 0;
    animation: fade-in 0.5s forwards 1.8s;
}

@keyframes approach-top {
    0% {
        opacity: 0;
        transform: scaleX(0);
    }

    50% {
        opacity: 1;
        transform: scaleX(0.7);
    }

    100% {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes approach-bottom {
    0% {
        opacity: 0;
        transform: scaleX(0);
    }

    50% {
        opacity: 1;
        transform: scaleX(0.7);
    }

    100% {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes approach-left {
    0% {
        opacity: 0;
        transform: scaleY(0);
    }

    50% {
        opacity: 1;
        transform: scaleY(0.7);
    }

    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}

@keyframes approach-right {
    0% {
        opacity: 0;
        transform: scaleY(0);
    }

    50% {
        opacity: 1;
        transform: scaleY(0.7);
    }

    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}

@keyframes fade-in {
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        padding: 0 5%;
    }

    .team-grid {
        grid-template-columns: 1fr;
        padding: 2rem 5%;
    }

    .hero h1 {
        font-size: clamp(2rem, 8vw, 4rem);
    }

    .hero p {
        font-size: 1rem;
        max-width: 100%;
    }

    .nav-links {
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--navbar-bg);
        padding: 1rem;
        border-radius: 0 0 var(--border-radius) var(--border-radius);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
        display: none;
        /* Hidden by default */
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        margin: 0;
    }

    .nav-links.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-item {
        margin: 0.5rem 0;
        padding: 0.5rem 0;
    }

    .nav-links a {
        padding: 0.8rem 1rem;
        text-align: center;
        border-radius: 8px;
    }

    .logo img {
        height: 40px;
    }

    footer {
        padding: 2rem 5%;
    }

    nav {
        min-width: auto;
        width: 90%;
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 150px 1rem 0 1rem;
    }

    .team-card img {
        width: 80px;
        height: 80px;
    }

    .bento-item {
        padding: 1.5rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Custom Scrollbar for WebKit */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* App-like Touch Feedback */
.btn:active,
.nav-item:active,
.bento-item:active {
    transform: scale(0.98);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    background: rgba(20, 20, 20, 0.85);
    /* Slightly more opaque */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    justify-content: space-around;
    align-items: center;
    padding: 12px 20px;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 4px;
    transition: all 0.3s ease;
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    transition: all 0.3s ease;
}

.mobile-nav-item.active {
    color: var(--accent-color);
}

.mobile-nav-item.active svg {
    stroke: var(--accent-color);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

@media (max-width: 768px) {

    /* Hide top nav links and toggle on mobile, we use bottom nav now */
    .nav-links,
    .menu-toggle {
        display: none !important;
    }

    /* Adjust navbar to only show logo */
    nav {
        justify-content: space-between;
        /* Keep logos on edges */
        padding: 0.8rem 1.2rem;
        background: rgba(16, 16, 16, 0.8);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 0 0 20px 20px;
        /* Rounded bottom corners */
        top: 0;
        width: 100%;
        margin: 0;
        left: 0;
        transform: none;
        max-width: 100%;
    }

    .logo {
        margin-right: 0;
    }

    /* Show bottom nav */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Adjust footer to not be covered by bottom nav */
    footer {
        padding-bottom: 110px;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Cinematic Noise Texture */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    /* On top of everything */
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

/* Custom Highlights Bento Grid */
.custom-highlights-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0;
}

/* Default mobile styles (1 column) */
.item-main,
.item-sub-1,
.item-sub-2,
.item-sub-3 {
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.item-main img {
    height: 200px;
    object-fit: cover;
}

/* Enhanced Hover for Bento Items */
.bento-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-5px) scale(1.01);
}

/* Read More / Text Clamp */
.text-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.text-expanded {
    -webkit-line-clamp: unset;
}

.read-more-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.read-more-btn:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .custom-highlights-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .item-main {
        grid-column: span 2;
    }

    .item-sub-1 {
        grid-column: span 2;
    }

    .item-main img {
        height: 300px;
        /* Taller image on tablets */
    }
}

@media (min-width: 1024px) {
    .custom-highlights-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(2, 260px);
        /* Fixed row height for bento alignment */
    }

    .item-main {
        grid-column: span 2;
        grid-row: span 2;
        height: 100%;
    }

    .item-main img {
        height: 55%;
        /* Proportional image height */
        flex-shrink: 0;
    }

    .item-main>div {
        flex-grow: 1;
        justify-content: center;
    }

    .item-sub-1 {
        grid-column: span 2;
        grid-row: span 1;
        height: 100%;
    }

    .item-sub-2 {
        grid-column: span 1;
        grid-row: span 1;
        height: 100%;
    }

    .item-sub-3 {
        grid-column: span 1;
        grid-row: span 1;
        height: 100%;
    }
}

/* --- Team Layout Improvements --- */

/* Chairs (Big & Top) */
.chair-grid {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 4rem;
    padding: 0 5%;
}

.chair-card {
    flex: 1 1 350px;
    max-width: 450px;
    padding: 3rem !important;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 40px rgba(91, 143, 255, 0.15);
    z-index: 2;
}

.chair-card img {
    width: 200px !important;
    height: 200px !important;
    border-width: 6px !important;
}

.chair-card h3 {
    font-size: 2.2rem !important;
    margin-top: 1.5rem !important;
}

.chair-card .role {
    font-size: 1.3rem !important;
    background: var(--accent-glow);
    display: inline-block;
    padding: 0.2rem 1rem;
    border-radius: 50px;
    margin-top: 0.5rem;
}

/* Other Departments (Unique Compact Layout) */
.dept-section-title {
    text-align: left;
    margin-left: 5%;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
}

.dept-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.5rem;
    padding: 1rem 5% 2rem 5%;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

/* Custom Scrollbar for Dept Grid */
.dept-grid::-webkit-scrollbar {
    height: 6px;
}

.dept-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin: 0 5%;
}

.dept-grid::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

.dept-card {
    flex: 0 0 280px;
    /* Fixed width cards */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem !important;
    scroll-snap-align: start;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(20, 20, 20, 0.4);
}

.dept-card:hover {
    background: var(--card-bg);
    border-color: var(--accent-color);
    transform: translateY(-5px);
}

.dept-card img {
    width: 100px !important;
    height: 100px !important;
}

.dept-card h3 {
    font-size: 1.2rem !important;
}

.dept-card .role {
    font-size: 0.9rem !important;
}