/*
 * Mobile & touch fixes (launch audit, 2026-10-17).
 * Loaded after the theme CSS on every public page (versioned by file time).
 * Every rule is scoped to touch devices or phone/tablet widths, so desktop
 * keeps the original theme look.
 */

/* 1. Instructor cards: name + role were hover-only, so touch users saw bare photos. */
@media (hover: none) {
    .mhq-team-box-items .mhq-image .mhq-content {
        opacity: 1;
        visibility: visible;
    }
}

/* 2. iPhone zooms the page when a focused field is under 16px. */
@media (pointer: coarse) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]),
    select,
    textarea {
        font-size: 16px !important;
    }
}
/* Typed emails were shown Capitalised in the contact form. */
.contact-wrapper .mhq-contact-items .contact-form-box .form-clt input,
.contact-wrapper .mhq-contact-items .contact-form-box .form-clt textarea {
    text-transform: none;
}

/* 3. Title-only page banners used 52-83% of the first phone screen. */
@media (max-width: 767px) {
    .breadcrumb-wrapper .page-heading {
        padding: 56px 0;
    }
}
@media (max-width: 575px) {
    .breadcrumb-wrapper .page-heading h1 {
        font-size: clamp(26px, 8vw, 36px);
    }
    .breadcrumb-wrapper .page-heading .breadcrumb-items {
        max-width: 100%;
    }
    .breadcrumb-wrapper .page-heading .breadcrumb-items li:last-child {
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .section-padding {
        padding: 56px 0;
    }
}

/* 4. Cookie banner: moved to cookie-consent.css (also used by the student and instructor layouts). */

/* 5. Hamburger was a 17x32 <div>; now a 44px <button>. */
.header-main .sidebar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
}

/* 6. Course detail on phones: off-centre price card, tall stacked tabs, tiny share icons. */
@media (max-width: 991px) {
    .mhq-courses-details-area .details-list-area {
        margin-right: 0;
    }
}
@media (max-width: 575px) {
    .mhq-courses-details-area .details-list-area {
        padding: 24px 20px;
    }
    .mhq-courses-details-area .mhq-courses-details-wrapper .courses-details-content .nav {
        gap: 8px 16px;
        padding: 10px 12px;
    }
    .mhq-courses-details-area .mhq-courses-details-wrapper .courses-details-content .nav .nav-link {
        font-size: 15px;
    }
}
.course-share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

/* 10. Back-to-top: smaller on phones and kept clear of the copyright line. */
@media (max-width: 575px) {
    .back-to-top {
        right: 16px;
        bottom: var(--backtop-offset, 16px);
        width: 44px;
        height: 44px;
        line-height: 44px;
    }
    .mhq-footer-bottom {
        padding-bottom: 64px;
    }
}

/* 11. Footer links and social icons: bigger touch targets. */
@media (pointer: coarse) {
    .mhq-footer-wrapper .mhq-footer-widget-items .list-items li a {
        display: inline-block;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .mhq-footer-wrapper .mhq-footer-widget-items .list-items li:not(:last-child) {
        margin-bottom: 0;
    }
    .mhq-footer-wrapper .mhq-footer-widget-items .list-items li a::before {
        top: 18px; /* keep the bullet beside the text after the extra padding */
    }
    .mhq-footer-wrapper .social-icon a {
        width: 44px;
        height: 44px;
        line-height: 44px;
    }
}

/* 12. Only body clipped sideways overflow; iOS Safari still let the page
   scroll horizontally via <html>. `clip` (not hidden) keeps sticky headers working. */
@media (max-width: 991.98px) {
    html,
    body {
        overflow-x: clip;
    }
}

/* 13. Android "install the app" bar (partials/app-banner.blade.php). Hidden
   until the script shows it (Android, screen <= the admin's max width), so
   desktop never sees it. Colours and font sizes come from Admin → Settings →
   Mobile App → Install Bar as --ab-* variables. The body padding and offsets
   keep the footer, back-to-top, cookie strip and OneSignal bell clear of it. */
.app-banner[hidden] {
    display: none !important;
}
.app-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030; /* above content, below Bootstrap offcanvas (1045) and modals (1055) */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) 4px;
    background: var(--ab-bg, #fff);
    color: var(--ab-text, var(--header));
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}
.app-banner__close {
    flex-shrink: 0;
    width: 28px;
    height: 32px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    opacity: 0.55;
    font-size: 22px;
    line-height: 1;
}
.app-banner__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
}
.app-banner__text {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}
.app-banner__title,
.app-banner__subtitle {
    display: block;
}
/* Wraps onto a second line instead of being cut off on narrow phones. */
.app-banner__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: inherit;
    font-size: var(--ab-title-size, 13px);
    font-weight: 700;
}
.app-banner__subtitle {
    color: inherit;
    opacity: 0.7;
    font-size: var(--ab-subtitle-size, 12px);
}
.app-banner__install,
.app-banner__install:hover,
.app-banner__install:focus {
    flex-shrink: 0;
    padding: 9px 14px;
    border-radius: 8px;
    background: var(--ab-btn, var(--theme));
    color: var(--ab-btn-text, #fff);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
body.has-app-banner {
    padding-bottom: var(--app-banner-h, 64px);
}
body.has-app-banner .back-to-top {
    bottom: calc(var(--backtop-offset, 16px) + var(--app-banner-h, 64px));
}
body.has-app-banner .cookie-consent {
    bottom: var(--app-banner-h, 64px) !important;
}
body.has-app-banner #onesignal-bell-container.onesignal-reset.onesignal-bell-container-bottom-right {
    bottom: var(--app-banner-h, 64px) !important;
}

/* 14. Floating buttons and the top bar: Admin → Settings → Cookie & Site Bars.
   layouts/app.blade.php sets the fui-* body classes and --backtop-offset.
   "Phone" = under 768px, the same split the cookie banner uses. */
.back-to-top {
    bottom: var(--backtop-offset, 30px);
}
body.fui-backtop-left .back-to-top {
    right: auto;
    left: 30px;
}
@media (min-width: 768px) {
    body.fui-no-backtop-desktop .back-to-top {
        display: none !important;
    }
}
@media (max-width: 767.98px) {
    body.fui-no-backtop-mobile .back-to-top,
    body.fui-no-bell-mobile #onesignal-bell-container {
        display: none !important;
    }
    body.fui-backtop-left .back-to-top {
        left: 16px;
    }
}
@media (min-width: 1200px) {
    .header-top-section--no-desktop {
        display: none;
    }
}
/* Top bar on tablets/phones (the theme hides it under 1200px): one compact
   line of phone + email; address and the social icons stay desktop-only. */
@media (max-width: 1199px) {
    .header-top-section.header-top-section--mobile {
        display: block;
        padding: 6px 0;
    }
    .header-top-section--mobile .container-fluid {
        padding: 0 16px;
    }
    .header-top-section--mobile .header-top-wrapper ul {
        gap: 12px;
        min-width: 0;
        flex-wrap: wrap;
    }
    .header-top-section--mobile .header-top-wrapper ul li {
        font-size: 13px;
        white-space: nowrap;
    }
    .header-top-section--mobile .header-top-wrapper ul {
        column-gap: 20px;
    }
    /* The hidden address would leave a dangling divider; spacing is enough. */
    .header-top-section--mobile .header-top-wrapper ul li:not(:last-child) {
        border-right: 0;
        padding-right: 0;
    }
    .header-top-section--mobile .header-top-wrapper ul li i {
        margin-right: 5px;
    }
    .header-top-section--mobile .header-top-address,
    .header-top-section--mobile .social-icon {
        display: none !important;
    }
}
@media (max-width: 400px) {
    /* Too narrow for both: keep the phone number (tap-to-call). */
    .header-top-section--mobile .header-top-wrapper ul li:not(:first-child) {
        display: none;
    }
}
