/* Shared responsive shell repair — 2026-10-25.
   Loaded after site styles so every public page uses the same safe frame rules. */

/* Keep page-level content and its direct child frames inside a predictable gutter. */
body.frontend-page main.main-content:not(.main-content--immersive) {
    min-width: 0;
    padding-inline: clamp(12px, 2vw, 28px);
}

body.frontend-page main.main-content:not(.main-content--immersive) > .container,
body.frontend-page main.main-content:not(.main-content--immersive) > .container-fluid {
    width: 100%;
    min-width: 0;
}

body.frontend-page main.main-content:not(.main-content--immersive) > .container-fluid {
    max-width: 1600px;
    margin-inline: auto;
}

/* Prevent intrinsic flex/grid children and embedded media from widening the page. */
body.frontend-page main.main-content:not(.main-content--immersive) :where(.row, [class*="col-"], .card, .modal-content, .table-responsive) {
    min-width: 0;
    max-width: 100%;
}

body.frontend-page main.main-content :where(img, video, iframe, canvas, svg) {
    max-width: 100%;
}

/* Keep dialogs and dropdowns within the visible browser window. */
body.frontend-page .modal-dialog:not(.modal-fullscreen) {
    max-width: min(var(--bs-modal-width, 500px), calc(100vw - 24px));
    margin-inline: auto;
}

body.frontend-page .dropdown-menu {
    max-width: calc(100vw - 24px);
    overflow-wrap: anywhere;
}

/* A short viewport can put the fixed assistant over the bottom of the open nav. */
body.frontend-page:has(nav.lms-chrome-navbar .navbar-collapse.show) #dlAssistantFab,
body.frontend-page:has(nav.lms-chrome-navbar .navbar-collapse.show) #dlAssistantPanel {
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 1199.98px) {
    /* A little outer breathing room without changing the desktop navbar. */
    body.frontend-page nav.lms-chrome-navbar {
        width: auto;
        margin: 8px 12px 0;
        border-radius: 22px;
    }

    body.frontend-page nav.lms-chrome-navbar > .container {
        position: relative;
        flex-wrap: nowrap;
        min-width: 0;
    }

    /* The open menu is a compact panel anchored to the hamburger, not a full-width row. */
    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        z-index: 1031;
        display: block;
        width: min(360px, calc(100vw - 24px));
        /* Keep the complete account-action row visible in short windows. */
        max-height: min(calc(100vh - 96px), 640px);
        overflow: auto;
        padding: 14px;
        /* Keep hero text and background effects from bleeding through the menu. */
        background: #ffffff !important;
        backdrop-filter: none !important;
        border: 1px solid rgba(23, 42, 62, 0.12);
        border-radius: 22px;
        box-shadow: 0 18px 48px rgba(17, 35, 52, 0.2);
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav {
        width: 100%;
        margin: 0 !important;
        align-items: stretch;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav + .navbar-nav {
        margin-top: 8px !important;
        padding-top: 8px;
        border-top: 1px solid rgba(23, 42, 62, 0.12);
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav:last-child {
        flex-direction: row;
        gap: 8px;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav:last-child > .nav-item {
        flex: 1 1 0;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav:last-child > .nav-item.d-flex {
        display: block !important;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show .nav-item {
        width: 100%;
        margin-inline: 0 !important;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show .nav-link {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 10px 12px;
        white-space: normal;
        overflow-wrap: anywhere;
        border-radius: 12px;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show .btn-nav-login,
    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show .btn-nav-register {
        width: 100%;
        justify-content: center;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        margin: 4px 0 8px;
        box-shadow: none;
    }
}

@media (max-width: 575.98px) {
    body.frontend-page nav.lms-chrome-navbar {
        margin-inline: 8px;
        border-radius: 18px;
    }

    body.frontend-page main.main-content:not(.main-content--immersive) {
        padding-inline: 12px;
    }

    body.frontend-page .modal-dialog:not(.modal-fullscreen) {
        width: calc(100% - 24px);
        margin-inline: 12px;
    }
}

/* Compact-window repair: keep the desktop links from wrapping in a narrow window. */
@media (max-width: 1399.98px) {
    body.frontend-page nav.lms-chrome-navbar {
        position: relative;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-toggler {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse:not(.show) {
        display: none !important;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show {
        position: absolute !important;
        top: calc(100% + 10px) !important;
        right: 0 !important;
        left: auto !important;
        z-index: 1031;
        display: block !important;
        width: min(360px, calc(100vw - 24px)) !important;
        max-height: min(calc(100dvh - 96px), 640px) !important;
        overflow: auto;
        padding: 14px;
        background: #fff !important;
        border: 1px solid rgba(23, 42, 62, 0.12);
        border-radius: 22px;
        box-shadow: 0 18px 48px rgba(17, 35, 52, 0.2);
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav {
        display: flex !important;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        width: 100%;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show .nav-link {
        white-space: nowrap;
    }

    body.frontend-page nav.lms-chrome-navbar .navbar-collapse.show > .navbar-nav:last-child {
        flex-direction: row;
    }

    body.frontend-page main.main-content:not(.main-content--immersive) {
        padding-inline: 12px !important;
    }
}

/* Mobile frame aligned with the navigation; replaces the excessive 50px gutters. */
@media (max-width: 767.98px) {
    body.frontend-page main.main-content:not(.main-content--immersive) {
        padding-inline: 8px !important;
    }
}

/* 2026-10-25 mobile containment and readable control repair. */
@media (max-width:1399.98px) {
 body.frontend-page nav.lms-chrome-navbar { width:calc(100% - 24px) !important; max-width:none !important; margin-inline:12px !important; }
 body.frontend-page .cd-page, body.frontend-page .cd-page .container { width:100%; max-width:100%; min-width:0; box-sizing:border-box; }
 body.frontend-page .cd-page :is(.content-grid,.course-header-content) { grid-template-columns:minmax(0,1fr); }
 body.frontend-page .cd-page :is(.main-content,.sidebar-content,.course-info,.course-media,.content-section,.course-card-sticky) { min-width:0; max-width:100%; box-sizing:border-box; }
 body.frontend-page .cd-page .course-card-sticky { position:static; }
 body.frontend-page .cd-page :is(.course-description,.section-content,.course-purchase-info__entity,.detail-item,.instructor-info) { overflow-wrap:anywhere; min-width:0; }
}
@media (max-width:767.98px) {
 body.frontend-page { background:#f0f4f8 !important; color:#172b3e; }
 body.frontend-page nav.lms-chrome-navbar { width:calc(100% - 16px) !important; margin-inline:8px !important; }
 body.frontend-page .cd-page .container { padding-inline:0 !important; }
 body.frontend-page .cd-page :is(.course-header,.course-content) { padding:20px 0; }
 body.frontend-page .cd-page :is(.content-section,.course-card-sticky) { padding:18px; }
 body.frontend-page .cd-page :is(.course-purchase-info__grid,.course-purchase-info__panels) { grid-template-columns:minmax(0,1fr); }
 body.frontend-page .cd-page .course-title { font-size:28px; line-height:1.18; overflow-wrap:break-word; }
 body.frontend-page .cd-page .course-actions { display:flex; flex-wrap:wrap; gap:12px; }
 body.frontend-page .cd-page .course-actions > * { flex:0 0 auto; width:100%; min-height:46px; height:auto; padding:13px 20px; }
 body.frontend-page .cd-page .detail-item { flex-wrap:wrap; gap:6px; }
 body.frontend-page .cd-page :is(table,iframe,video) { max-width:100%; }
 body.frontend-page .cd-page .course-image { width:100%; height:auto; max-height:240px; object-fit:contain; }
 body.frontend-page footer { background:#eef2f7 !important; background-image:none !important; color:#243b50 !important; }
 body.frontend-page footer :is(p,li,small,address,a,h2,h3,h4,span) { color:#243b50; }
 body.frontend-page #dlAssistantFab { width:48px !important; height:48px !important; right:12px !important; bottom:12px !important; }
}
body.frontend-page :is(.btn-primary,.btn-dark) { color:#fff !important; -webkit-text-fill-color:#fff !important; background:linear-gradient(145deg,#30323b,#181920) !important; }
body.frontend-page :is(.btn-primary,.btn-dark) :is(span,i,svg) { color:inherit !important; -webkit-text-fill-color:inherit !important; }
body.frontend-page :is(.btn-light,.btn-outline,.btn-outline-primary) { color:#111 !important; -webkit-text-fill-color:#111 !important; background:linear-gradient(145deg,#fff,#edf1f5) !important; }
body.frontend-page :is(.btn-light,.btn-outline,.btn-outline-primary) :is(span,i,svg) { color:inherit !important; -webkit-text-fill-color:inherit !important; }

@media (max-width:767.98px) {
 body.frontend-page main.main-content > section:not(.hero-section) { background:#f0f4f8 !important; isolation:isolate; }
 body.frontend-page main.main-content > section:not(.hero-section)::before,
 body.frontend-page main.main-content > section:not(.hero-section)::after { display:none !important; }
 body.frontend-page .animate-on-scroll { opacity:1 !important; visibility:visible !important; transform:none !important; }
 body.frontend-page :is(.tutor-cta-content,.home-trust-inner) { background:#fff !important; color:#172b3e !important; }
 body.frontend-page footer.professional-footer.dynamic-footer { background:#eef2f7 !important; background-image:none !important; color:#243b50 !important; }
 body.frontend-page footer.professional-footer.dynamic-footer :is(p,li,small,address,a,h2,h3,h4,span) { color:#243b50 !important; -webkit-text-fill-color:currentColor; }
 body.frontend-page footer.professional-footer.dynamic-footer::before,
 body.frontend-page footer.professional-footer.dynamic-footer::after { display:none !important; }
 body.frontend-page :is(.dl-home-btn--register,.btn-gradient) { background:linear-gradient(145deg,#30323b,#181920) !important; color:#fff !important; -webkit-text-fill-color:#fff !important; }
 body.frontend-page :is(.dl-home-btn--login) { color:#111 !important; -webkit-text-fill-color:#111 !important; }
 body.frontend-page :is(.dl-home-btn--register,.dl-home-btn--login,.btn-gradient) :is(span,i,svg) { color:inherit !important; -webkit-text-fill-color:inherit !important; }
}

/* 2026-10-25: align public frames to the navigation and resolve mixed CTA variants. */
body.frontend-page main.main-content:not(.main-content--immersive),
body.frontend-page footer.professional-footer.dynamic-footer {
 width:calc(100% - 24px) !important; max-width:1400px !important;
 margin-inline:auto !important; padding-inline:0 !important; box-sizing:border-box;
}
body.frontend-page main.main-content:not(.main-content--immersive) { overflow-x:clip; }
body.frontend-page main.main-content:not(.main-content--immersive) > section {
 width:100% !important; max-width:100% !important; margin-inline:0 !important; box-sizing:border-box;
}
body.frontend-page footer.professional-footer.dynamic-footer > * { max-width:100% !important; box-sizing:border-box; }
body.frontend-page main.main-content :is(a,button).dl-home-btn--login,
body.frontend-page main.main-content .home-trust-actions a.dl-home-btn--login {
 background:linear-gradient(145deg,#fff,#edf2f6) !important;
 color:#111 !important; -webkit-text-fill-color:#111 !important;
}
body.frontend-page main.main-content :is(a,button).dl-home-btn--register {
 background:linear-gradient(145deg,#292d36,#15181f) !important;
 color:#fff !important; -webkit-text-fill-color:#fff !important;
}
body.frontend-page main.main-content :is(.dl-home-btn--login,.dl-home-btn--register) :is(span,i,svg) {
 color:inherit !important; -webkit-text-fill-color:inherit !important;
}
@media(max-width:767.98px) {
 body.frontend-page main.main-content:not(.main-content--immersive),
 body.frontend-page footer.professional-footer.dynamic-footer { width:calc(100% - 16px) !important; }
}

/* ID-scoped variants outrank the legacy :is() rule containing newsletter IDs. */
body.frontend-page #main-content.main-content :is(a,button).dl-home-btn--login {
 background:linear-gradient(145deg,#fff,#edf2f6) !important; color:#111 !important; -webkit-text-fill-color:#111 !important;
}
body.frontend-page #main-content.main-content :is(a,button).dl-home-btn--register {
 background:linear-gradient(145deg,#292d36,#15181f) !important; color:#fff !important; -webkit-text-fill-color:#fff !important;
}

/* Mobile panel repair 2026-10-25: explicit contrast, bounded overlays, solid fallbacks. */
body.frontend-page #main-content .tutor-cta-panel { background-color:#17364a !important; }
body.frontend-page #main-content .tutor-cta-panel :is(.tutor-cta-panel__label,.tutor-cta-panel__title,.tutor-cta-panel__note,.tutor-cta-panel__note span,.tutor-cta-panel__note svg) { color:#f4f7fb !important; -webkit-text-fill-color:#f4f7fb !important; opacity:1 !important; }
body.frontend-page #dlAssistantPanel a.dl-assistant-card-btn { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 16px !important; background:#202733 !important; color:#fff !important; -webkit-text-fill-color:#fff !important; border-radius:16px; line-height:1.3; }
body.frontend-page #main-content a.ac-demo-collection__link { display:inline-flex !important; align-items:center; justify-content:center; min-height:44px !important; padding:12px 18px !important; line-height:1.3 !important; border-radius:24px !important; margin-top:12px; white-space:normal; }
@media(max-width:767.98px) {
 body.frontend-page #main-content .ac-hero { background:#edf2f7 !important; color:#19384c !important; }
 body.frontend-page #main-content .ac-hero :is(h1,p,span,a) { color:#19384c !important; -webkit-text-fill-color:#19384c !important; }
 body.frontend-page footer.professional-footer.dynamic-footer :is(.footer-dark-panel,.footer-dark-panel-inner) { background:#eef2f7 !important; color:#243b50 !important; }
 body.frontend-page #main-content .home-trust-inner { background:#fff !important; }
 body.frontend-page #main-content .ac-demo-collection { margin-bottom:24px !important; }
 body.frontend-page #acFilterPanel { position:fixed !important; top:8px !important; bottom:8px !important; right:8px !important; width:calc(100% - 16px) !important; max-width:420px !important; height:calc(100dvh - 16px) !important; max-height:calc(100dvh - 16px) !important; overflow-y:auto !important; overscroll-behavior:contain; box-sizing:border-box; z-index:11010 !important; }
 body.frontend-page #acFilterToggle { right:8px !important; }
 body.frontend-page #dlAssistantPanel { position:fixed !important; inset:8px !important; width:calc(100% - 16px) !important; max-width:none !important; height:calc(100dvh - 16px) !important; max-height:calc(100dvh - 16px) !important; overflow:hidden !important; border-radius:20px !important; box-sizing:border-box; }
 body.frontend-page #dlAssistantPanel.is-open { display:flex !important; flex-direction:column; }
 body.frontend-page #dlAssistantPanel .dl-assistant-header { position:relative !important; flex:0 0 auto; }
 body.frontend-page #dlAssistantMessages { flex:1 1 auto !important; min-height:0 !important; height:auto !important; overflow-y:auto !important; overscroll-behavior:contain; padding:12px !important; }
 body.frontend-page #dlAssistantPanel :is(.dl-assistant-chips-wrap,.dl-assistant-footer-actions,.dl-assistant-input-wrap) { flex:0 0 auto !important; }
 body.frontend-page #dlAssistantChips { display:flex !important; flex-wrap:nowrap !important; overflow-x:auto !important; gap:8px; padding:4px !important; }
 body.frontend-page #dlAssistantChips .dl-assistant-chip { flex:0 0 auto; min-height:40px !important; padding:8px 14px !important; }
 body.frontend-page #dlAssistantPanel .dl-assistant-chips-wrap { padding:4px 8px !important; }
 body.frontend-page #dlAssistantForm { padding:8px !important; }
 body.frontend-page #dlAssistantInput { min-width:0; font-size:16px !important; }
 body.frontend-page nav .navbar-collapse .nav-link { padding-block:10px !important; }
}

@media(max-width:1199.98px){body.frontend-page.ac-filters-open nav.lms-chrome-navbar{visibility:hidden!important;pointer-events:none!important;} body.frontend-page #acFilterPanel{background:#f6f8fb!important;backdrop-filter:none!important;} body.frontend-page.ac-filters-open .ac-filters-wrap{z-index:11010!important;} }
