/* Shared layout and responsive fixes. Existing colours and fonts are unchanged. */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

html {
    border: 0 !important;
}

body {
    margin: 0 !important;
    padding: 0 !important;
}

#main_content,
.main-content,
.site-header,
.site-header .header-inner,
#site-navigation {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Keep the coloured navbar background flush with both viewport edges. */
.site-header > .container {
    width: 100%;
    max-width: none !important;
    padding-right: 0;
    padding-left: 0;
}

.site-header .header-inner {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

img,
video,
canvas,
svg,
iframe,
object,
embed {
    max-width: 100%;
}

img,
video,
canvas,
svg {
    height: auto;
}

.site-header .burger-menu {
    border: 0;
    padding: 10px;
    background: transparent;
}

.site-header .burger-menu:focus-visible,
.site-header .close-menu:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.site-header .canvas-header .menu-label {
    margin: 0;
    font: inherit;
    font-weight: 700;
}

/* The theme assigned a fixed 470.6 px width to every card, which clipped
   department, news and event content even when the surrounding grid reflowed. */
.single-blog-post .blog-thumb .blog-thumbnail,
.single-blog-post .blog-thumb .blog-thumbnail img,
.single-blog-post .blog-content {
    width: 100% !important;
    max-width: 100%;
}

.single-blog-post .blog-content {
    height: auto !important;
    min-height: 211.8px;
}

/* Department introductions contain three Bootstrap columns without a row.
   Give that content an explicit layout so it is readable at every width. */
.department-intro {
    display: grid;
    grid-template-columns: minmax(210px, 0.8fr) minmax(0, 1.35fr) minmax(230px, 1fr);
    gap: 30px;
    align-items: start;
}

.department-intro > * {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Restore Bootstrap's intended margin utility behavior. The bundled file had
   added display:flex to .m-auto, forcing unrelated page sections into one row. */
.m-auto:not(.department-intro) {
    display: block !important;
}

#page-content-wrap .about-page-content-wrap .single-about-text .img-left {
    margin-left: 0 !important;
}

#page-content-wrap .about-page-content-wrap .single-about-text .img-right {
    margin-right: 0 !important;
}

.site-header .close-menu {
    border: 0;
}

/* Homepage institute identity: logo on the left, all text on the right. */
.mainlogo {
    margin: 0 !important;
    padding: 20px clamp(18px, 3vw, 48px) !important;
    color: #000000;
    background-color: #FF9933;
    line-height: 1.25;
}

.institute-identity {
    display: grid;
    grid-template-columns: clamp(160px, 15vw, 220px) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 64px);
    align-items: center;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.identity-logo img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    object-fit: contain;
}

.identity-copy {
    min-width: 0;
    text-align: center;
}

.identity-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.identity-topline h5 {
    grid-column: 2;
    margin: 0;
    font-size: clamp(16px, 1.3vw, 21px);
    font-weight: 700;
}

.identity-code {
    grid-column: 3;
    justify-self: end;
    font-size: clamp(16px, 1.35vw, 22px);
}

.identity-copy h2 {
    margin: 8px 0;
    font-size: clamp(30px, 3.2vw, 48px);
    line-height: 1.1;
    overflow-wrap: normal;
}

.identity-copy h4 {
    margin: 6px 0;
    font-size: clamp(20px, 2vw, 30px);
    text-shadow: 2px 2px #ff0b00;
}

.identity-copy p {
    margin: 4px 0;
    font-size: clamp(14px, 1.15vw, 17px);
    line-height: 1.35;
    text-align: center;
}

.identity-copy strong {
    display: block;
    margin: 4px 0;
    font-size: clamp(17px, 1.4vw, 22px);
}

/* ACAP content pages */
.acap-page {
    padding: 50px 15px;
}

.acap-page .acap-content {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.acap-page h1 {
    margin-bottom: 28px;
    font-size: clamp(28px, 4vw, 48px);
}

.acap-notice {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

.acap-empty-state {
    padding: 45px 20px;
    border: 1px solid #dbe5f3;
    text-align: center;
}

.merit-list-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 22px;
}

.merit-list-button {
    min-width: 210px;
    padding: 13px 22px;
    border: 2px solid #151f3b;
    border-radius: 4px;
    color: #151f3b;
    background: #ffffff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.merit-list-button:hover,
.merit-list-button:focus-visible,
.merit-list-button.is-active {
    color: #ffffff;
    background: #151f3b;
}

.merit-list-button:focus-visible {
    outline: 3px solid #ff9933;
    outline-offset: 2px;
}

.merit-pdf-panel {
    overflow: hidden;
    border: 1px solid #dbe5f3;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(21, 31, 59, 0.1);
}

.merit-pdf-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 18px;
    color: #ffffff;
    background: #151f3b;
    text-align: left;
}

.merit-pdf-heading h2 {
    margin: 0;
    color: inherit;
    font-size: clamp(18px, 2.2vw, 26px);
}

.merit-pdf-heading a {
    flex: 0 0 auto;
    color: #ffffff;
    font-weight: 700;
    text-decoration: underline;
}

.merit-pdf-viewer {
    display: block;
    width: 100%;
    height: min(78vh, 900px);
    min-height: 620px;
    border: 0;
    background: #f1f3f5;
}

.merit-pdf-fallback {
    margin: 0;
    padding: 12px 16px;
    font-size: 14px;
    text-align: center;
}

.merit-pdf-fallback a {
    font-weight: 700;
    text-decoration: underline;
}

@media (min-width: 992px) and (max-width: 1399px) {
    .site-header .codeboxr-main-menu > li {
        padding-right: 12px;
        padding-left: 12px;
    }

    .site-header.header-fixed.showed .codeboxr-main-menu > li {
        padding: 20px 12px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .site-header .codeboxr-main-menu > li {
        padding-right: 6px;
        padding-left: 6px;
    }

    .site-header .codeboxr-main-menu > li:not(:last-child) {
        margin-right: 4px;
    }

    .site-header.header-fixed.showed .codeboxr-main-menu > li {
        padding: 20px 6px;
    }
}

@media (max-width: 991px) {
    .site-header {
        width: 100%;
        padding: 0 !important;
    }

    .site-header .header-inner {
        padding: 8px 15px;
    }

    .site-header .main-nav,
    #site-navigation {
        width: 100%;
    }

    .site-header .burger-menu {
        display: block;
        margin-left: auto !important;
    }

    .site-header .main-nav-container {
        max-width: min(400px, 100vw);
    }

    .site-header .main-nav-container .canvas-header {
        min-height: 64px;
    }

    .site-header .main-nav-container a {
        overflow-wrap: anywhere;
    }

    .department-intro {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .department-intro > * {
        order: initial !important;
    }

    .department-intro .single-about-text {
        padding: 25px 15px !important;
        text-align: center;
    }

    .department-intro .single-about-text img {
        display: block;
        margin-right: auto;
        margin-left: auto;
    }

    .department-intro .sidebar-area-wrap {
        margin-bottom: 0;
    }

    .mainlogo {
        padding: 14px 10px !important;
    }

    .institute-identity {
        grid-template-columns: clamp(96px, 18vw, 130px) minmax(0, 1fr);
        gap: 14px;
    }

    .identity-topline {
        display: block;
    }

    .identity-topline h5 {
        font-size: clamp(12px, 3vw, 17px);
    }

    .identity-code {
        display: block;
        margin-top: 2px;
        font-size: clamp(12px, 2.8vw, 16px);
    }

    .identity-copy h2 {
        margin: 5px 0;
        font-size: clamp(20px, 5vw, 32px);
        line-height: 1.08;
        overflow-wrap: normal;
    }

    .identity-copy h4 {
        margin: 4px 0;
        font-size: clamp(15px, 3.8vw, 22px);
    }

    .identity-copy p {
        margin: 3px 0;
        font-size: clamp(10px, 2.4vw, 14px);
        line-height: 1.3;
    }

    .identity-copy strong {
        margin: 3px 0;
        font-size: clamp(12px, 3vw, 17px);
    }

    #about-area .about-area-wrapper .about-content-wrap {
        padding: 30px 15px !important;
    }

    .s,
    .t {
        width: 100% !important;
        height: auto !important;
    }

    table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    iframe {
        width: 100% !important;
    }

    input,
    select,
    textarea,
    button,
    .btn {
        max-width: 100%;
    }

    .nice-select,
    .nice-select .list,
    .nice-select .option {
        width: 100% !important;
        max-width: 100% !important;
    }

    .nice-select .list {
        right: auto;
        left: 0;
        overflow-x: hidden;
    }

    .nice-select .option {
        min-height: 36px;
        padding: 8px 12px;
        white-space: normal;
        line-height: 1.3;
    }

    .single-blog-post .blog-content {
        min-height: 0;
    }

}

@media (max-width: 575px) {
    .acap-page {
        padding: 32px 10px;
    }

    .acap-page h1 {
        margin-bottom: 20px;
    }

    .merit-list-tabs {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .merit-list-button {
        width: 100%;
        min-width: 0;
        padding: 12px 14px;
    }

    .merit-pdf-heading {
        display: block;
        padding: 12px;
        text-align: center;
    }

    .merit-pdf-heading a {
        display: inline-block;
        margin-top: 8px;
        font-size: 13px;
    }

    .merit-pdf-viewer {
        height: 68vh;
        min-height: 480px;
    }

    .institute-identity {
        grid-template-columns: clamp(82px, 24vw, 96px) minmax(0, 1fr);
        gap: 8px;
    }

    .container,
    .container-fluid {
        padding-right: 15px;
        padding-left: 15px;
    }

    .section-padding {
        padding-top: 45px;
        padding-bottom: 45px;
    }

    .gallery-menu {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .gallery-menu a,
    .gallery-menu span {
        flex: 0 0 auto;
        margin-right: 0 !important;
    }
}
