/* Custom Font Declaration */
@font-face {
    font-family: 'Noto Serif Display';
    src: url('https://static.igem.wiki/teams/5836/fonts/noto-serif-display/notoserifdisplay-semicondensed-regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Improves loading performance */
}

body { 
    padding-top: 90px;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

html {
    overflow-x: hidden; /* Also prevent on html element */
}

.left-aligned { margin-left: auto; }

.bg-dark, .navbar, .dropdown-menu {
    background-color: #6E0D25 !important;
}

.navbar {
    min-height: 80px;
    font-family: 'Noto Serif Display', serif !important; /* Apply custom font to navbar */
}

.navbar-nav .nav-link,
.navbar-brand-custom,
.navbar-brand-custom img,
.dropdown-item {
    color: #fff !important;
    font-size: 1.4rem;
    font-weight: 500;
    font-family: 'Noto Serif Display', serif !important; /* Apply custom font to all navbar text */
}

.navbar-brand-custom img {
    height: 75px;
    padding: 0;
    vertical-align: middle;
    transition: transform 0.3s ease;
    margin: -5px 0; /* Negative margin to make logo bigger without affecting navbar height */
}

.navbar-brand-custom:hover img {
    transform: scale(1.1); /* Make logo slightly bigger on hover */
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus,
.dropdown-item:hover,
.dropdown-item:focus {
    color: #D7AF6B !important;
    background-color: transparent !important;
}

.dropdown-menu {
    border: none;
    background-color: #6E0D25 !important;
    font-family: 'Noto Serif Display', serif !important;
    right: auto;
    left: auto;
}

/* Align dropdown right border with nav link right border */
.navbar-nav .nav-item:last-child .dropdown-menu,
.navbar-nav .nav-item:nth-last-child(1) .dropdown-menu,
.navbar-nav .nav-item:nth-last-child(2) .dropdown-menu {
    right: 0 !important; /* Align to right edge of parent nav-item */
    left: auto !important;
    transform: none; /* Remove any transforms */
    margin-right: 0; /* Remove any margins */
}

/* Remove the conflicting media query rules */
@media (min-width: 992px) {
    .navbar-nav .dropdown-menu {
        max-width: calc(100vw - 40px);
        box-sizing: border-box;
    }
    
    /* Ensure perfect alignment for rightmost dropdowns */
    .navbar-nav .nav-item:nth-last-child(-n+2) .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        margin-right: 0; /* No additional margin needed */
        transform: none; /* No transform needed */
    }
}

.dropdown-item {
    color: #fff !important;
    font-family: 'Noto Serif Display', serif !important; /* Apply custom font to dropdown items */
    white-space: nowrap; /* Prevent text wrapping */
    padding: 8px 20px; /* Adjust padding if needed */
}

/* Show dropdown on hover */
.nav-item.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0;
}

/* Remove focus outline for nav links */
.nav-link:focus {
    outline: none;
}

/* CALLOUT */
.bd-callout { padding:1.25rem; margin-top:1.25rem; margin-bottom:1.25rem; border:1px solid #e9ecef; border-left-width:.25rem; border-radius:.25rem }
.bd-callout h4 { margin-bottom: 1.25rem }
.bd-callout p:last-child { margin-bottom:0 }
.bd-callout code { border-radius:.25rem }
.bd-callout+.bd-callout { margin-top:-.25rem }
.bd-callout-info { border-left-color:#5bc0de }
.bd-callout-warning { border-left-color:#f0ad4e }
.bd-callout-danger { border-left-color:#d9534f }

/* footer */
footer a { color: white; font-weight: bold; text-decoration: none; }
footer a:hover { color: white; text-decoration: underline; }

/* Footer Styles */
footer.bg-dark {
    margin-top: 0 !important;
    background-color: #0b1320 !important;
}

/* Footer Logo Section */
.footer-logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.footer-logo {
    margin-bottom: 1.5rem;
}

.footer-team-logo {
    height: 150px; /* Increased from 80px */
    width: auto;
}

/* Social Media Icons */
.footer-social-icons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto; /* Remove fixed width */
    height: auto; /* Remove fixed height */
    background-color: transparent; /* Remove background */
    border-radius: 0; /* Remove circular border */
    color: white;
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none; /* Remove border */
}

.social-icon:hover {
    background-color: transparent; /* Keep background transparent on hover */
    color: white; /* Keep color unchanged */
    border-color: transparent; /* Keep border transparent */
    transform: scale(1.2); /* Scale up on hover instead of translateY */
    text-decoration: none;
}

/* Styling for SVG social icons */
.social-icon-svg {
    width: 32px; /* Increased from 24px */
    height: 32px; /* Increased from 24px */
    filter: brightness(0) invert(1); /* Make SVG icons white */
    transition: transform 0.3s ease; /* Changed from filter transition to transform */
}

.social-icon:hover .social-icon-svg {
    transform: scale(1.2); /* Scale up the icon on hover */
}

/* Sponsors Grid */
.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Placeholder styling for missing sponsor logos */
.sponsor-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: filter 0.3s ease;
}

/* Style for when images are missing */
.sponsor-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    border: 2px solid transparent;
    min-height: 60px; /* Ensure minimum height */
    text-align: center;
    font-size: 0.8rem;
    color: white;
    text-decoration: none;
}

/* Show alt text when image fails to load */
.sponsor-link::after {
    content: attr(title);
    display: none;
    color: white;
    text-align: center;
    font-size: 0.7rem;
    line-height: 1.2;
    word-wrap: break-word;
}

/* Show title text when image is missing */
.sponsor-logo[alt]:not([src]),
.sponsor-logo[src=""] {
    display: none;
}

.sponsor-logo[alt]:not([src]) + ::after,
.sponsor-logo[src=""]::after {
    display: block;
}

.sponsor-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #D7AF6B;
    transform: translateY(-3px);
}

.sponsor-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1); /* Make logos white */
    transition: filter 0.3s ease;
}

.sponsor-link:hover .sponsor-logo {
    filter: none; /* Show original colors on hover */
}

/* Footer Contact Info */
.footer-contact-info {
    text-align: center;
    margin-bottom: 1.5rem;
}

.footer-university {
    color: white;
    font-size: 0.9rem;
    margin: 0.3rem 0;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Center the bottom footer section */
.row.mt-4 .col {
    text-align: center;
}

.row.mt-4 .col p {
    text-align: center;
    margin: 0 auto;
}

/* Ensure the links maintain proper styling when centered */
.row.mt-4 .col a.subfoot {
    color: white;
    font-weight: bold;
    text-decoration: none;
}

.row.mt-4 .col a.subfoot:hover {
    color: white;
    text-decoration: underline;
}

/* Mobile adjustments for centered footer text */
@media (max-width: 768px) {
    .row.mt-4 .col p {
        font-size: 0.8rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .row.mt-4 .col p {
        font-size: 0.75rem;
        line-height: 1.3;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .footer-logo-section {
        margin-bottom: 2rem;
    }
    
    .footer-team-logo {
        height: 60px;
    }
    
    .social-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .sponsors-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, 1fr);
        max-width: 250px;
        gap: 0.75rem;
    }
    
    .sponsor-link {
        padding: 0.4rem;
    }
    
    .footer-contact-info {
        margin-bottom: 1rem;
    }
    
    .footer-email,
    .footer-website {
        font-size: 0.8rem;
    }
    
    .footer-website {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .footer-social-icons {
        gap: 0.75rem;
    }
    
    .social-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .sponsors-grid {
        max-width: 200px;
        gap: 0.5rem;
    }
}

/* Accessibility Button */
.accessibility-button {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.accessibility-link {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    opacity: 0.7;
}

.accessibility-link:hover {
    opacity: 1;
    transform: scale(1.1);
    text-decoration: none;
}

.accessibility-icon {
    width: 35px;
    height: 35px;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .accessibility-button {
        right: 15px;
    }
    
    .accessibility-icon {
        width: 30px;
        height: 30px;
        filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
    }
}

.cont {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 0;
  width: 100%;
  padding-right: calc(var(--bs-gutter-x) * .5);
  padding-left: calc(var(--bs-gutter-x) * .5);
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 576px) {
  .cont {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .cont {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .cont {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .cont {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .cont {
    max-width: 1320px;
  }
}

/* Additional navbar-specific fixes */
.navbar .cont {
  display: flex;
  flex-wrap: inherit;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 991.98px) {
  .navbar .cont {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .navbar-collapse {
    width: 100%;
    flex-basis: 100%;
    order: 3;
  }
  
  .navbar-brand {
    order: 1;
  }
  
  .navbar-toggler {
    order: 2;
  }
}