@media (max-width: 992px) {
    .brand-title {
        display: block;
        font-size: 1rem;
        max-width: 180px;
        word-break: break-word;
        white-space: normal;
        line-height: 1.2;
        font-weight: 600;
    }
}

@media (max-width: 576px) {
    /* Remove right margins so brand truly centers */
    .custom_nav-container .navbar-brand {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    .custom_nav-container .navbar-brand img,
    .custom_nav-container .navbar-brand #logo {
        margin-right: 0 !important;
        margin-left: 0 !important;
        display: block;
        margin-bottom: 6px; /* spacing above title */
    }
    .brand-title {
        font-size: 0.9rem;
        max-width: 120px;
    }
}
@media (max-width: 1120px) {}

@media (max-width: 992px) {


    .top_container {
        height: auto;
    }

    .top_container.sub_pages {
        height: auto;
    }

    .top_container.sub_pages::before {
        background-size: cover;
    }

    .client_box-container {

        width: 90%;

    }

    .service_detail-container {
        width: 90%;
    }

    .hero-container {
        flex-direction: column;
    }

    .hero_detail-box {
        width: 100%;
        margin-bottom: 45px;
    }

    .hero_img-container {
        width: 100%;
    }

    .top_container::before {
        width: 200%;

    }

    .custom_nav-container.navbar-expand-lg .navbar-nav .nav-item.active .nav-link,
    .custom_nav-container.navbar-expand-lg .navbar-nav .nav-link {

        color: #fff;
    }

    .custom_nav-container .nav_search-btn {
        background-image: url(../images/search-icon-mobile.png);
        background-position: center;
    }
}

@media (max-width: 820px) {
    .admission_container {
        width: 450px;
        flex-direction: column;
    }

    .admission_img-box,
    .admission_detail {
        width: 100%;
    }

    .admission_img-box {
        border-radius: 25px 25px 0 0
    }

    .admission_detail {
        border-radius: 0 0 25px 25px;
    }
}

@media (max-width: 768px) {


    .hero_detail-box {
        text-align: center;
    }



}

@media (max-width: 576px) {
    /* Prevent horizontal scroll on phones */
    html, body, .top_container { overflow-x: hidden; }

    /* Navbar: stack brand, toggler, then menu under on mobile */
    .custom_nav-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .custom_nav-container .navbar-brand {
        order: 1;
    }

    .custom_nav-container .navbar-toggler {
        order: 2;
        align-self: center;
        margin: 8px 0 4px;
    }

    .custom_nav-container .navbar-collapse {
        order: 3;
        width: 100%;
    }

    /* Center navbar brand block horizontally */
    .custom_nav-container .navbar-brand {
        margin: 0 auto !important;
    }

    .custom_nav-container .navbar-brand span {
        text-align: center;
    }

    /* Navbar brand: logo + title stacked on mobile */
    .custom_nav-container .navbar-brand {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 4px;
    }

    .custom_nav-container .navbar-brand #logo {
        max-height: 100px;
        max-width: 90vw; /* ensure logo never exceeds viewport width */
        height: auto;
        width: auto;
    }

    .custom_nav-container .navbar-brand span {
        display: block;
        max-width: 75vw;
        white-space: normal;
        line-height: 1.2;
        word-break: break-word;
    }

    .programs_img-box {
        width: 80%;
    }

    .carousel-control-prev,
    .carousel-control-next {
        top: 150%;
    }

    .carousel-control-prev {
        left: 30%;
    }

    .carousel-control-next {
        right: 30%;
    }

    .programs_section .carousel-control-prev-icon,
    .programs_section .carousel-control-next-icon {
        width: 35px;
        height: 35px;
        background-size: 8px;
    }

    .contact_section,
    .client_section {
        background-image: none;
    }
}

/* Global responsive refinements */
@media (max-width: 992px) {
    /* Tighter vertical rhythm on tablets */
    .layout_padding { padding: 45px 0; }
    .layout_padding-top { padding-top: 45px; }
    .layout_padding-bottom { padding-bottom: 45px; }
    .main-heading { font-size: 1.75rem; }
}

@media (max-width: 768px) {
    /* Prevent long titles from overflowing */
    .card .card-title { word-break: break-word; }
    .modal-body { word-break: break-word; }
}

@media (max-width: 576px) {
    /* Compact spacing and smaller headings on phones */
    .layout_padding { padding: 35px 0; }
    .layout_padding-top { padding-top: 35px; }
    .layout_padding-bottom { padding-bottom: 35px; }
    .main-heading { font-size: 1.5rem; }
    .footer_section { padding: 14px 0; }
}

@media (max-width: 480px) {
    .programs_img-box {

        width: 100%;

    }

    .admission_container {

        width: 300px;
    }

    .client_container {
        width: 100%;
    }

    .client_detail {

        flex-direction: column;

    }

    .client_detail-box {

        display: flex;
        flex-direction: column;
        align-items: center;

    }

    .client_detail .client_img-box {
        width: 100px;
        margin-right: 0px;
        margin-bottom: 15px;
    }

}

@media (max-width: 400px) {}

@media (max-width: 360px) {}

@media (min-width: 1200px) {
    .container {
        max-width: 1170px;
    }

}

/* Ensure media elements scale within viewport on all sizes */
img, svg, video { max-width: 100%; height: auto; }