/* Phone layout that feels like an app: bottom tab bar, no footer, compact top bar. Loaded for screens up to 767px only. */
.m-tabbar, .m-search { display: none; }
.m-help { display: none; }

@media (max-width: 767px) {
    html { -webkit-tap-highlight-color: transparent; }
    body { overscroll-behavior-y: none; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

    /* the footer content lives in the menu drawer's Help list instead */
    .site-footer, #colophon, footer.site-footer { display: none !important; }
    #ast-scroll-top { display: none !important; }

    /* top bar: sticky, respects the notch */
    #masthead { padding-top: env(safe-area-inset-top); }

    /* bottom tab bar */
    .m-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 300; background: rgba(15, 15, 16, .96); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-top: 1px solid #26262a; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    .m-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; padding: 4px 0; color: #a1a1aa; text-decoration: none; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
    .m-tab:active { transform: scale(.94); }
    .m-tab.is-active { color: #fff; }
    /* the theme's link hover colour (a:hover #191970, navy) made a tab vanish into the black bar while touched or hovered */
    .m-tabbar .m-tab:hover, .m-tabbar .m-tab:focus { color: #fff; text-decoration: none; }
    .m-tabbar .m-tab:focus-visible { outline: 2px solid #fff; outline-offset: -4px; border-radius: 10px; }
    .m-tab.is-active .m-tab-icon svg { stroke-width: 2.1; }
    .m-tab-icon { position: relative; display: inline-flex; }
    .m-badge { position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #0050c8; color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; letter-spacing: 0; }

    /* search sheet (opens with the Search tab, closes with Close or the back button) */
    .m-search { display: none; position: fixed; inset: 0; z-index: 400; background: #fff; padding: calc(14px + env(safe-area-inset-top)) 14px 14px; }
    .m-search:target { display: block; }
    .m-search-bar { display: flex; gap: 10px; align-items: center; }
    .m-search input[type="search"] { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1.5px solid #0f0f10; border-radius: 10px; font-size: 16px; background: #fff; color: #0f0f10; }
    .m-search button { height: 46px; padding: 0 16px; border: 0; border-radius: 10px; background: #0f0f10; color: #fff; font-weight: 700; font-size: 14px; }
    .m-search-close { padding: 12px 4px; color: #0f0f10; font-size: 14px; font-weight: 600; text-decoration: none; }
    .m-search { overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .m-search-hint { margin: 14px 2px 0; color: #6b6b73; font-size: 14px; }
    .m-search-hint[hidden], .m-search-results[hidden] { display: none; }
    .m-search-results { margin-top: 10px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
    .m-sr-item { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid #ececf0; color: #0f0f10; text-decoration: none; }
    .m-sr-item:active { background: #f5f5f7; }
    .m-sr-img { position: relative; flex: none; width: 60px; height: 76px; border-radius: 8px; background: #f0f0f2; overflow: hidden; }
    .m-sr-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
    .m-sr-txt { display: grid; gap: 3px; min-width: 0; }
    .m-sr-cat { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6b6b73; }
    .m-sr-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
    .m-sr-name mark { background: #fff1a8; color: inherit; border-radius: 2px; }
    .m-sr-price { font-size: 14px; color: #0f0f10; }
    .m-sr-tag { margin-left: 6px; font-size: 11px; font-weight: 700; color: #b42318; }
    .m-sr-tag.is-sale { color: #0050c8; }
    .m-sr-sizes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
    .m-sr-sizes i { font-style: normal; font-size: 11px; font-weight: 600; min-width: 24px; padding: 2px 6px; text-align: center; border: 1px solid #c9c9d0; border-radius: 6px; }
    .m-sr-sizes i.is-out { color: #a0a0a8; border-style: dashed; text-decoration: line-through; }
    .m-sr-all { display: block; margin-top: 14px; padding: 14px; border-radius: 10px; background: #0f0f10; color: #fff; text-align: center; font-size: 14px; font-weight: 700; text-decoration: none; }
    .m-sr-empty { padding: 28px 4px; text-align: center; color: #3f3f46; font-size: 15px; }
    .m-sr-empty a { display: block; margin-top: 10px; font-weight: 700; color: #0f0f10; }
    .m-search-results.is-loading { opacity: .55; }

    /* search overlay: full-width field with icon, icon close button, popular chips until results show */
    .m-search { padding: calc(10px + env(safe-area-inset-top)) 14px 14px; }
    .m-search-bar { position: sticky; top: 0; z-index: 2; gap: 8px; padding: 4px 0 12px; background: #fff; border-bottom: 1px solid #ececec; margin: 0 -14px; padding-left: 14px; padding-right: 8px; }
    .m-search-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; border-radius: 12px; background: #f2f2f3; color: #6b6b73; }
    .m-search-field:focus-within { background: #fff; box-shadow: inset 0 0 0 1.5px #0f0f10; color: #0f0f10; }
    .m-search .m-search-field input[type="search"] { flex: 1; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; outline: 0; box-shadow: none; }
    .m-search .m-search-go { height: 46px; padding: 0 14px; border-radius: 12px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
    .m-search-close { display: grid; place-items: center; width: 40px; height: 46px; padding: 0; color: #0f0f10; }
    .m-search-hint { margin: 14px 2px 0; font-size: 13px; }
    .m-search-chips { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
    .m-search-chips-title { flex-basis: 100%; margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6b6b73; }
    .m-search-chip { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid #dedee1; border-radius: 18px; color: #0f0f10; font-size: 13px; font-weight: 600; text-decoration: none; }
    .m-search-chip:active { background: #f2f2f3; }
    .m-search:has(.m-search-results:not([hidden]):not(:empty)) .m-search-chips { display: none; }

    /* help links inside the menu drawer */
    .m-help { display: block; margin: 8px 0 0; padding: 16px 20px calc(24px + 56px); border-top: 1px solid #26262a; }
    .m-help h2 { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #8a8a93; }
    .m-help a { display: block; padding: 11px 0; color: #d4d4d8; font-size: 15px; text-decoration: none; }
    .m-help a:active { color: #6ea2ff; }

    /* checkout and payment pages: no tab bar, the customer is finishing a task */
    body.woocommerce-checkout { padding-bottom: 0; }
    body.woocommerce-checkout .m-tabbar { display: none; }

    /* comfortable touch targets */
    .woocommerce a.button, .woocommerce button.button, button.single_add_to_cart_button { min-height: 46px; }
}
