/* Responsive Breakpoints & Overrides */

/* Header Mobile Logo Fix */
.brand-logo {
    width: 100px;
    height: 100px;
}

.badge, .portrait {
    width: 100px;
    height: 100px;
}

/* Large Tablets / Small Laptops */
@media (max-width: 1200px) {
    .container {
        padding: 0 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .brand-wrap {
        gap: 15px;
        justify-content: space-between;
    }
    .brand-logo {
        width: 85px !important;
        height: 85px !important;
    }
    .badge, .portrait {
        width: 85px !important;
        height: 85px !important;
    }
    .brand-title {
        font-size: 20px !important;
    }
    .brand-sub, .brand-accredit {
        font-size: 11px !important;
    }
    .nav-desktop {
        gap: 8px;
        font-size: 12px;
    }
    .nav-link {
        padding: 6px 4px !important;
    }
    .grid-4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Tablets / Mobile Landscape */
@media (max-width: 860px) {
    /* Navbar */
    .nav-desktop {
        display: none !important;
    }
    .nav-wrap {
        padding-left: 12px;
        padding-right: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
    }
    .nav-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    .brand-mini {
        display: inline-block;
        flex-shrink: 0;
    }
    .brand-mini-name {
        display: inline-block;
        font-size: 11px;
        font-weight: 700;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
    }
    .nav-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        margin-left: 10px;
    }

    /* Slider Fix for Navigation Overlap */
    #hero-prev, #hero-next {
        z-index: 10;
        background: rgba(255,255,255,0.4);
        border-radius: 50%;
        width: 38px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
    }

    /* Grid Reductions */
    .container {
        padding: 12px;
    }
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-3, .home-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .home-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-boards-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .welcome-grid, .about-hl-grid {
        grid-template-columns: 1fr !important;
    }
    .about-hl-inset {
        position: static !important;
        width: 60% !important;
        margin-top: 12px;
        display: block;
    }
    .portraits {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 14px !important;
    }
}

/* Mobile Portrait */
@media (max-width: 700px) {
    .container {
        padding: 8px 12px;
    }

    /* Header adjustments - prevent logo/text overlap */
    .brand-wrap {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }
    .brand-left {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .brand-logo {
        width: 80px !important;
        height: 80px !important;
        margin-bottom: 10px;
    }
    .brand-title {
        font-size: 18px !important;
        line-height: 1.3;
        margin: 5px 0;
    }
    .brand-sub, .brand-accredit {
        font-size: 11px !important;
    }
    .brand-right {
        display: flex;
        justify-content: center;
        gap: 15px;
        width: 100%;
    }
    .badge, .portrait {
        width: 70px !important;
        height: 70px !important;
    }

    /* Contact bar: better spacing and stacking */
    .contactbar {
        font-size: 12px;
    }
    .contactbar .container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
        padding: 8px 10px;
        width: 100%;
        box-sizing: border-box;
    }
    .contactbar .inline {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 12px;
        width: 100%;
        box-sizing: border-box;
    }
    .contactbar .inline a {
        display: inline-block;
        padding: 2px 0;
        white-space: nowrap;
    }

    /* Hero Slider Mobile Refinements */
    #hero-carousel, #hero-slides {
        height: 240px !important;
        min-height: 240px !important;
        background-color: #0b2d6b;
    }
    #hero-slides > div {
        background-size: cover !important;
        background-position: center center !important;
    }
    #hero-indicators {
        bottom: 10px !important;
    }
    #hero-indicators button {
        width: 6px !important;
        height: 6px !important;
        margin: 0 3px !important;
    }
    #hero-prev, #hero-next {
        width: 32px !important;
        height: 32px !important;
        font-size: 18px !important;
    }

    /* Navigation Drawer Items */
    .nav-drawer {
        width: 85% !important;
    }

    /* Department Page Mobile Fixes */
    #dept-container {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    #dept-sidebar {
        width: 100% !important;
        position: static !important;
    }
    #dept-faculty-list, #dept-non-teaching-list-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
        gap: 12px !important;
    }

    /* Footer Stacking */
    .footer-grid {
        grid-template-columns: 1fr !important;
        padding: 1.5rem 12px;
        gap: 24px;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px 12px;
    }

    /* Social Icons Fix */
    .home-social-bar {
        padding: 4px;
        gap: 4px;
        right: 5px;
        background: rgba(0, 0, 0, 0.3);
        left: auto;
        max-width: calc(100vw - 10px);
    }
    .home-social {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .grid-4, .grid-3, .home-grid-3, .home-grid-4, .portraits {
        grid-template-columns: 1fr !important;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .brand-title {
        font-size: 16px !important;
    }
    #hero-carousel, #hero-slides {
        height: 200px !important;
        min-height: 200px !important;
    }
    #hero-prev, #hero-next {
        width: 28px !important;
        height: 28px !important;
        font-size: 14px !important;
    }
}

/* Very Small Devices */
@media (max-width: 400px) {
    .contactbar {
        font-size: 11px;
    }
    .badge, .portrait, .brand-logo {
        width: 68px !important;
        height: 68px !important;
    }
}
