/*
 * Phone layout layer, loaded after the theme stylesheets on every
 * public and user-dashboard page. Desktop is untouched: every rule
 * below is scoped to max-width 767.98px.
 */
:root {
    --bc-brand: #bc8d2c;
    --bc-nav-height: 58px;
    --bc-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.bc-mobile-nav {
    display: none;
}

/* Footer section titles are buttons so phones can fold them; elsewhere they read as plain heading text */
.bc-footer-section__toggle {
    all: unset;
}

@media (max-width: 767.98px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        overflow-x: hidden;
        padding-bottom: calc(var(--bc-nav-height) + var(--bc-safe-bottom));
    }

    /* Bottom tab bar */
    .bc-mobile-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        height: calc(var(--bc-nav-height) + var(--bc-safe-bottom));
        padding-bottom: var(--bc-safe-bottom);
        background: #fff;
        border-top: 1px solid #e6e8ef;
        box-shadow: 0 -2px 10px rgba(16, 24, 40, .06);
    }

    .bc-mobile-nav__item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 0;
        color: #6b7280;
        font-size: 11px;
        line-height: 1.2;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }

    .bc-mobile-nav__item i {
        height: 24px;
        font-size: 20px;
        line-height: 24px;
        margin-bottom: 3px;
    }

    .bc-mobile-nav__item span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bc-mobile-nav__item:hover,
    .bc-mobile-nav__item:focus,
    .bc-mobile-nav__item.is-active {
        color: var(--bc-brand);
        text-decoration: none;
    }

    .bc-mobile-nav__item--post i {
        font-size: 24px;
        color: var(--bc-brand);
    }

    /* Floating buttons sit above the tab bar instead of under it */
    #back-to-top,
    .scrollToHome {
        bottom: calc(var(--bc-nav-height) + var(--bc-safe-bottom) + 12px) !important;
    }

    /* Top bar: the tab bar covers sign-in and listing, so keep only socials + language */
    .header-main .top-bar .row > .col-5 {
        display: none;
    }

    .header-main .top-bar .col-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .header-main .top-bar .socials li a {
        padding: 10px 8px;
    }

    /* Mobile header: sticky so the menu toggle and call button stay in reach */
    .horizontal-header {
        position: sticky;
        top: 0;
        z-index: 1030;
    }

    /* A tall logo upload must not grow the sticky header over the page content.
       Do not clip the container instead: without a logo it collapses and would hide the icons. */
    .horizontal-header .smllogo img {
        width: auto;
        max-width: 120px;
        max-height: 40px;
    }

    /* Inputs at 16px stop iOS zooming the page on focus */
    input.form-control,
    select.form-control,
    textarea.form-control,
    .select2-container .select2-selection,
    .select2-search__field {
        font-size: 16px !important;
    }

    /* Touch targets */
    .btn,
    .page-link,
    .pagination a {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 36px;
        padding-top: .45rem;
        padding-bottom: .45rem;
    }

    .page-link {
        min-width: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pagination {
        flex-wrap: wrap;
    }

    /* Hero search on listing and detail pages: one row (keyword, filters, search);
       the other fields open with the filters button. Without JS everything stays visible. */
    .bc-hero-search .banner-1.sptb-2 {
        padding-top: 14px !important;
        padding-bottom: 14px !important;
    }

    .bc-hero-search .header-text {
        top: 0 !important;
    }

    .bc-hero-search .bc-hero-search__title {
        display: none;
    }

    .bc-hero-search .search-background .form.row {
        flex-wrap: wrap;
    }

    .bc-hero-search .bc-hero-search__keyword {
        flex: 1 1 0;
        max-width: none;
        min-width: 0;
        order: 1;
    }

    .bc-hero-search .bc-hero-search__toggle-wrap {
        flex: 0 0 48px;
        height: 46px;
        order: 2;
        background: #fff;
        border-left: 1px solid #e6e8ef;
    }

    .bc-hero-search .bc-hero-search__toggle {
        width: 100%;
        height: 100%;
        min-height: 46px;
        border-radius: 0;
        background: transparent;
        color: #364154;
        font-size: 18px;
    }

    .bc-hero-search.is-open .bc-hero-search__toggle {
        color: var(--bc-brand);
    }

    .bc-hero-search .bc-hero-search__submit {
        flex: 0 0 56px;
        max-width: 56px;
        order: 3;
    }

    .bc-hero-search .bc-hero-search__submit .btn {
        height: 46px;
        border-radius: 0 3px 3px 0;
    }

    .bc-hero-search .search-background .bc-hero-search__extra {
        flex: 0 0 100%;
        max-width: 100%;
        order: 4;
        margin-top: 8px;
    }

    .bc-js .bc-hero-search:not(.is-open) .bc-hero-search__extra {
        display: none !important;
    }

    /* Footer: each section folds to its title */
    .main-footer .Footer .row > .bc-footer-section {
        margin-top: 0 !important;
    }

    .bc-footer-section__title {
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .12);
    }

    .bc-footer-section__toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
        width: 100%;
        min-height: 44px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .bc-footer-section__toggle::after {
        content: "+";
        font-size: 20px;
        font-weight: 400;
        line-height: 1;
    }

    .bc-footer-section.is-open .bc-footer-section__toggle::after {
        content: "\2212";
    }

    .bc-footer-section__toggle:focus-visible {
        outline: 2px solid var(--bc-brand);
        outline-offset: 2px;
    }

    .bc-footer-section__body {
        padding: 8px 0 12px;
    }

    .bc-footer-section__body li > a {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .bc-js .bc-footer-section:not(.is-open) .bc-footer-section__body {
        display: none;
    }

    .page-header {
        margin: .75rem 0;
        min-height: 0;
    }

    .page-title {
        font-size: 1.15rem;
    }
}
