/* Basic Styles */
:root {
    --primary-glow: #A0522D; /* Sienna - A richer accent color */
    --background-dark: #F9F6F2; /* A cleaner, brighter off-white */
    --content-dark: rgba(222, 215, 205, 0.4); /* A slightly more opaque content background */
    --text-primary: #452815; /* COFFEE */
    --text-secondary: #73411F; /* PERU */
    --border-color: #DED7CD; /* A subtle, warm gray for borders */
}

/* Dark Mode Theme */
body.dark-mode {
    --primary-glow: #E0C4A0; /* RAFFIA - for a lighter glow */
    --background-dark: #2c1d10; /* Dark brown background */
    --content-dark: rgba(232, 210, 184, 0.05); /* Transparent light for dark cards */
    --text-primary: #E8D2B8; /* CHAMPAGNE - for light text */
    --text-secondary: #c5a585; /* Lighter BARLEY CORN for better contrast */
    --border-color: #452815; /* COFFEE - for dark borders */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    /* Use a reliable open-source background pattern */
    background-color: var(--background-dark);
    background-attachment: fixed; /* Keep the gradient in place while scrolling */
    min-height: 100vh;
    color: var(--text-primary);
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
.main-header {
    background: transparent;
    color: var(--text-primary);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px -10px rgba(0, 255, 255, 0.2);
}

/* A more generic page header for sub-pages */
.page-header {
    padding: 2rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(232, 210, 184, 0.1);
    margin-bottom: 2rem;
}

.page-header-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items horizontally */
    justify-content: center;
    gap: 1.5rem;
}

.page-header-logo {
    height: 120px;
    width: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.header-social-link {
    color: var(--text-secondary);
    font-size: 2.2rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.header-social-link:hover {
    color: var(--primary-glow);
    transform: scale(1.1);
}

.header-container {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.main-header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: none; /* Remove glow for a cleaner look */
}

.main-header p {
    margin: 0;
    color: var(--text-primary);
}

.main-header .designation {
    font-size: 1.2rem;
    margin-top: 0.5rem; /* Add space below the name */
    font-weight: 700;
    letter-spacing: 0.5px;
}

.main-header .department {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-socials {
    margin-top: 1rem;
}

.header-socials a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-right: 1rem;
    font-size: 2rem;
    transition: color 0.3s ease;
}

.header-socials a:hover {
    color: var(--primary-glow);
}

/* Navigation Bar */
.navbar {
    background: transparent;
    border-bottom: 1px solid transparent;
    background-color: var(--background-dark);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.navbar-scrolled {
    /* Use the background color with transparency for a frosted glass effect */
    background-color: rgba(232, 210, 184, 0.85);
    /* Add a backdrop-filter for the blur effect */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom-color: var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.dark-mode .navbar-scrolled {
    /* Use a semi-transparent dark background for the frosted glass effect in dark mode */
    background-color: rgba(44, 29, 16, 0.85);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo svg {
    height: 55px; /* Adjust height as needed */
    width: auto;
    transition: fill 0.3s ease;
}

.logo svg .logo-text {
    fill: var(--text-primary);
    font-family: sans-serif;
}

.logo:hover svg .logo-text {
    fill: var(--primary-glow);
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 1rem;
    display: block;
    transition: all 0.3s ease;
    font-weight: bold; /* Make menu text bold */
    font-size: 1.05rem; /* Slightly increase font size */
}

.nav-link:hover {
    color: var(--primary-glow);
    text-shadow: none;
}

.menu-toggle {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 4px 0;
    background-color: var(--text-primary);
}

/* Main Content Grid */
.content-grid {
    display: grid; 
    grid-template-columns: 1fr 300px; /* Main content and a sidebar for announcements */
    gap: 2rem;
    padding: 2rem 0;
    align-items: start;
}


/* Main Content & Cards */
.card {
    background: linear-gradient(145deg, rgba(232, 210, 184, 0.4), rgba(232, 210, 184, 0.2)); /* Gradient from semi-transparent CHAMPAGNE */
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease-in-out;
}

.card:hover {
    border-color: var(--primary-glow);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.header-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out; /* Add a smooth transition for hover effects */
    flex-shrink: 0; /* Prevent image from shrinking */
}

.header-photo:hover {
    border-color: var(--primary-glow);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* Grouped styles for section titles */
.research-interests h2, .experience h2, .education h2, .announcements h2, #contact-info h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    color: var(--text-primary);
    text-shadow: none;
    margin-bottom: 1rem;
}

/* Publications Page */
.publications-list {
    list-style: none;
    padding: 0;
}

.publication-item {
    background: linear-gradient(to right, #EADBC7, var(--background-dark)); /* Subtle gradient */
    border-left: 4px solid var(--border-color);
    padding: 1.5rem;
    padding-left: 4rem; /* Make space for the number */
    margin-bottom: 1.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative; /* Needed for absolute positioning of the number */
}

.publication-item {
    /* Initial state for fade-in animation */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.publication-item:hover {
    border-left-color: var(--primary-glow);
    transform: translateY(-3px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

body.dark-mode .publication-item {
    /* Use a dark gradient for dark mode to ensure text is readable */
    background: linear-gradient(to right, #3a2a1a, var(--background-dark));
}

.publication-item::before {
    counter-increment: publication-counter -1;
    content: counter(publication-counter);
    position: absolute;
    left: 1.5rem;
    top: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-glow);
}

.publication-item:last-child {
    margin-bottom: 0;
}

.publication-item .authors {
    font-weight: 500;
    color: var(--primary-glow);
    margin: 0 0 0.25rem 0;
}

.publication-item .title {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.publication-item .authors strong {
    color: var(--text-primary);
    font-weight: 600;
}

.publication-item .title {
    text-align: justify;
    hyphens: auto;
}

.publication-content {
    padding-right: 40px; /* Make space for the copy button */
}

.copy-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.copy-btn:hover,
.copy-btn:focus {
    background-color: var(--primary-glow);
    color: white;
    border-color: var(--primary-glow);
}

/* Search Bar Styles */
.search-container {
    flex-grow: 1;
}

.filter-container {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Make children take full width */
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.year-filter-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem; /* Add space between the label and the buttons */
}

.filter-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.year-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.year-filter-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.year-filter-btn.active, .year-filter-btn:hover {
    background-color: var(--primary-glow);
    color: white;
    border-color: var(--primary-glow);
}

.year-filter-container {
    flex-shrink: 0;
}

#year-filter {
    width: 150px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--background-dark);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2373411F' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
}

#publication-search,
#course-search,
#outreach-search,
#year-filter {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--background-dark);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#publication-search:focus,
#course-search:focus,
#outreach-search:focus,
#year-filter:focus {
    outline: none;
    border-color: var(--primary-glow);
    box-shadow: 0 0 0 2px rgba(182, 136, 93, 0.3);
}

/* --- Skeleton Loader Styles --- */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, #EADBC7 8%, #E0C4A0 18%, #EADBC7 33%);
    background-size: 2000px 100%;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

.skeleton-gallery-item {
    width: 100%;
    height: 250px; /* Same as .gallery-item img */
    border-radius: 8px;
}

.skeleton-publication {
    height: 100px; /* Approximate height of a publication item */
    margin-bottom: 1.5rem;
}

.skeleton-student-card {
    height: 250px; /* Approximate height of a student card */
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.loading-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.student-category-title {
    color: var(--text-primary);
    font-weight: 800;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1.6rem;
    font-size: 1.9rem; /* Increased font size */
    text-align: center;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.student-card {
    background: linear-gradient(160deg, #EADBC7, var(--background-dark)); /* Subtle gradient */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem 1rem;
    transition: all 0.3s ease;
    /* Make the card a flex container to control child alignment */
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.dark-mode .student-card {
    /* Use a dark gradient for dark mode to ensure text is readable */
    background: linear-gradient(160deg, #3a2a1a, var(--background-dark));
}

.student-card {
    /* Initial state for fade-in animation */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.student-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-glow);
}

.student-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    margin-bottom: 1rem;
}

.student-photo:hover {
    border-color: var(--primary-glow);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.student-name {
    font-size: 1.1rem;
    font-weight: 700; /* Make it bolder */
    color: var(--text-primary); /* Use primary text color for more emphasis */
    margin: 0;
}

.student-name-container {
    width: 100%;
    margin-bottom: 0.75rem;
    /* Add top and bottom borders to create a cell effect */
    border-top: 2px solid var(--primary-glow);
    border-bottom: 2px solid var(--primary-glow);
    /* Add padding to give space between the name and the borders */
    padding: 0.5rem 0;
    text-align: center;
}

.student-topic {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    text-align: center; /* Align text to the center */
    overflow-wrap: break-word; /* Ensure long text wraps */
}

.student-card .student-details {
    /* This ensures cards without photos still have centered content */
    flex-grow: 1; /* Allow this container to grow and fill card space */
    text-align: center;
    display: flex; /* Make this a flex container */
    flex-direction: column; /* Stack its children vertically */
    width: 100%; /* Ensure it takes full width of the card padding */
}

.student-social-links {
    margin-top: auto; /* Push the social links to the bottom */
}

.student-social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 0.5rem;
    font-size: 1.5rem; /* Increased icon size */
    transition: color 0.3s ease;
}

.student-social-links a:hover {
    color: var(--primary-glow);
    text-shadow: none;
}

.student-email {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

.student-email:hover {
    color: var(--primary-glow);
}

.student-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
    line-height: 1.4;
}

.student-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.student-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    background-color: var(--background-dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    font-weight: 600;
}

.student-nav a:hover {
    background-color: var(--primary-glow);
    color: white;
    border-color: var(--primary-glow);
}
/* Experience & Education Sections */
.research-interests, .experience, .education {
    margin-bottom: 2rem;
}

.experience-list {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}

.experience-list li {
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    text-align: justify;
}

.research-interests ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-left: 0;
}

.research-interests ul li {
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0;
    text-align: center;
    background-color: var(--background-dark);
    transition: all 0.3s ease;
    cursor: default;
}

.research-interests ul li:hover {
    border-color: var(--primary-glow);
    color: var(--text-primary);
}

/* Announcements Section */
.announcements {
    position: sticky;
    top: 100px; /* Position below the sticky navbar */
}

.announcement-ticker {
    height: 300px;
    overflow: hidden;
    position: relative;
}

/* Show scrollbar on hover */
.announcement-ticker:hover {
    overflow-y: auto;
    padding-right: 8px; /* Prevent content from jumping under the scrollbar */
}

.announcement-scroll {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* Animation: name, duration, timing-function, iteration-count */
    animation: scroll-up 20s linear infinite;
}

/* Pause animation on hover */
.announcement-ticker:hover .announcement-scroll {
    animation-play-state: paused;
}

/* Custom scrollbar for announcement ticker */
.announcement-ticker::-webkit-scrollbar {
    width: 6px;
}

.announcement-ticker::-webkit-scrollbar-track {
    background: transparent;
}

.announcement-ticker::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.announcement-ticker::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-glow);
}

@keyframes scroll-up {
    from { transform: translateY(0); }
    to { transform: translateY(-50%); }
}

.announcement-item {
    background: linear-gradient(135deg, #EADBC7, var(--background-dark));
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid var(--border-color);
}

.announcement-item strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.announcement-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.announcement-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.announcement-item a:hover {
    color: var(--primary-glow);
    text-decoration: underline;
}
 
body.dark-mode .teaching-item,
body.dark-mode .announcement-item,
body.dark-mode .outreach-item,
body.dark-mode .contact-item,
body.dark-mode .facility-item {
    /* Use a dark gradient for dark mode to ensure text is readable */
    background: linear-gradient(160deg, #3a2a1a, var(--background-dark));
}

/* Contact Page Styles */
.contact-details {
    display: grid;
    grid-template-columns: 1fr; /* Default for mobile */
    gap: 1.5rem;
    margin-top: 2rem;
}
 
.contact-item {
    background: linear-gradient(160deg, #EADBC7, var(--background-dark));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    align-items: center; /* Center icon and text block horizontally */
    flex-direction: row;
    align-items: flex-start; /* Align icon to the top of the text block */
    gap: 1rem;
    transition: all 0.3s ease;
}
 
.contact-item:hover {
    border-color: var(--primary-glow);
    transform: translateY(-3px);
}
 
.contact-icon {
    font-size: 2rem;
    color: var(--primary-glow);
    flex-shrink: 0; /* Prevent the icon from shrinking */
}
 
.contact-text h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-weight: 500;
    text-align: left;
}
 
.contact-text p, .contact-text a {
    margin: 0;
    line-height: 1.7;
    color: var(--text-secondary);
    text-decoration: none;
    text-align: left;
}
 
.contact-text a:hover {
    color: var(--primary-glow);
    text-decoration: underline;
}

.map-item {
    height: 450px; /* Set a fixed height for the map container */
    padding: 0; /* Remove padding so the map fills the entire space */
    border: none; /* Remove the border for a seamless look */
}

body.dark-mode .map-item iframe {
    /* Invert colors for a dark mode map effect */
    filter: invert(1) hue-rotate(180deg);
    border-radius: 8px; /* Match the card's border-radius */
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .nav-menu {
        display: none; /* Hide menu by default on mobile */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 67px; /* Position below navbar */
        left: 0; 
        background: var(--background-dark);
        border-top: 1px solid var(--border-color);
    }

    .nav-menu.active {
        display: flex; /* Show menu when active */
    }

    .nav-link {
        text-align: center;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .menu-toggle {
        display: flex; /* Show hamburger icon */
    }

    .content-grid {
        grid-template-columns: 1fr; /* Stack content on mobile */
    }

    .announcements {
        position: static; /* Remove sticky positioning */
        top: auto;
        margin-top: 2rem;
    }

    .header-container {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .main-header {
        padding: 2rem 0;
    }

    .teaching-item {
        grid-template-columns: 1fr auto; /* Switch to a 2-column layout */
        gap: 0.5rem 1.5rem;
    }

    .teaching-item .course-code { grid-column: 1 / 2; }
    .teaching-item .course-year { grid-column: 2 / 3; grid-row: 1 / 2; }
    .teaching-item .course-title { grid-column: 1 / 3; } /* Span full width */
    .teaching-item .course-credits { 
        grid-column: 1 / 3; /* Span full width */
        text-align: left; /* Align to the left on mobile */
    }

    /* Hide the large "IITH" text on mobile to save space */
    .logo-side-text {
        display: none;
    }

    /* Adjust logo size in navbar for mobile */
    .logo svg {
        height: 45px;
    }

    /* Adjust header font sizes for mobile */
    .main-header h1, .page-header h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    /* Reduce padding on publication items for mobile */
    .publication-item {
        padding-left: 2.5rem;
    }

    .publication-item::before {
        left: 1rem;
    }

    /* Stack contact items on mobile */
    .contact-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Adjust header images for mobile */
    .header-photo {
        width: 140px;
        height: 140px;
    }

    .page-header-logo {
        width: 100px;
        height: 100px;
    }

    /* Make facility items stack on mobile */
    .facility-item-detailed {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Make staff profile stack on mobile */
    .staff-profile {
        flex-direction: column;
        text-align: center;
    }
}

/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--text-primary);
    color: var(--background-dark);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background-color 0.3s, color 0.3s, transform 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top-btn:hover {
    background-color: var(--primary-glow);
    color: white;
    transform: translateY(-3px);
}

/* Footer */
.site-footer {
    background: var(--content-dark);
    color: var(--text-secondary);
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* Make the main h2 on the students page stand out - Previous change was to --primary-glow */
/* This selector was not specific enough and could cause issues. 
   It has been removed in favor of the .student-category-title class, 
   which is already styled appropriately for the new theme. */
/* .card #students h2 { ... } */

/* Gallery Page Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.publication-item.loaded,
.student-card.loaded {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item {
    /* Initial state for fade-in animation */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.gallery-item img {
    width: 100%;
    height: 250px; /* Fixed height for uniform look */
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item.loaded {
    /* Final state for fade-in animation */
    opacity: 1;
    transform: translateY(0);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(69, 40, 21, 0.8); /* Semi-transparent COFFEE background */
    color: #fff;
    padding: 0.75rem;
    font-size: 0.9rem;
    text-align: left; /* Align text to the left for better readability */
    box-sizing: border-box; /* Ensure padding is included in the width */
    /* Add word wrapping for long captions on thumbnails */
    overflow-wrap: break-word;
}

/* Lightbox (Modal) for Gallery */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top of everything */
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); /* Black background with opacity */
    transition: opacity 0.4s ease;
}

.lightbox-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 80%;
    max-height: 80vh;
    animation-name: zoom;
    animation-duration: 0.5s;
}

@keyframes zoom {
    from {transform: scale(0.1)} 
    to {transform: scale(1)}
}

.lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: left; /* Align text to the left for better readability */
    color: #ccc;
    padding: 10px 0;
    overflow-wrap: break-word; /* Ensure long captions wrap */
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 0.75rem;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    font-size: 1.5rem; /* Increased size for better visibility */
}

@media (max-width: 767px) {
    .social-links a {
        font-size: 1.8rem; /* Make icons slightly larger on mobile for easier tapping */
    }
}

.social-links a:hover {
    color: var(--primary-glow);
    text-shadow: none;
}

.copyright-text {
    margin: 0;
    font-size: 0.9rem;
}

.developer-credit {
    font-size: 0.8rem; /* Make the developer credit text slightly smaller */
}

/* Dark Mode Toggle Switch */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--background-dark);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-glow);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Larger screen adjustments for contact page grid */
@media (min-width: 768px) {
    .contact-details {
        grid-template-columns: 1fr 1fr; /* 2-column grid */
    }
    .map-item {
        grid-column: span 2; /* Make map span both columns */
    }
}

/* Teaching Page Styles */
.teaching-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.teaching-item {
    display: grid;
    grid-template-columns: 120px 1fr auto 100px;
    gap: 1.5rem;
    align-items: start;
    padding: 1rem;
    border-radius: 6px;
    background: linear-gradient(135deg, #EADBC7, var(--background-dark));
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.teaching-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-glow);
}

.teaching-item .course-code { font-weight: 600; color: var(--text-primary); }
.teaching-item .course-title { font-weight: 500; }
.teaching-item .course-year { font-style: italic; color: var(--text-secondary); text-align: right; }
.teaching-item .course-credits { font-size: 0.9rem; color: var(--text-secondary); text-align: right; }

/* Outreach Page Styles */
.outreach-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.outreach-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 2rem;
    padding: 1.5rem;
    border-radius: 6px;
    background: linear-gradient(135deg, #EADBC7, var(--background-dark));
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.outreach-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-glow);
}

.outreach-item .outreach-activity { grid-column: 1 / 2; font-weight: 600; color: var(--text-primary); margin: 0; }
.outreach-item .outreach-description { grid-column: 1 / 3; color: var(--text-secondary); margin: 0.5rem 0 0 0; }
.outreach-item .outreach-year { grid-column: 2 / 3; grid-row: 1 / 2; font-style: italic; color: var(--text-secondary); text-align: right; margin: 0; }

/* Facilities Page Styles */
.facilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Technical Staff Profile Styles */
.staff-profile {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--content-dark);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.staff-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-glow);
    flex-shrink: 0;
}

.staff-name {
    margin-top: 0;
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.staff-title {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-glow);
}

.facility-category {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.facility-category:first-of-type {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.facilities-list-detailed {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 2.5rem;
    margin-top: 1.5rem;
}

.facilities-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.facility-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: var(--content-dark);
    transition: all 0.3s ease;
}

.facility-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-glow);
}

.facility-item-detailed {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
}

.facility-item-detailed:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.facility-photo {
    width: 250px;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.facility-item-card .facility-photo {
    width: 100%; /* Make image responsive within the card */
    height: 180px;
    margin-bottom: 1rem;
}

.facility-details h4 {
    margin-top: 0;
    color: var(--primary-glow);
    font-size: 1.2rem;
}

/* Accessibility: Class to visually hide content but keep it accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}