/* Mobile performance: lighter paint, smoother scroll, fewer jank sources */
@media (max-width: 768px) {
    body.is-mobile-app {
        text-rendering: optimizeSpeed;
    }

    /* backdrop-filter is costly on many phones */
    body.is-mobile-app .checkout-addr-modal__backdrop,
    body.is-mobile-app .checkout-addr-modal.checkout-addr-modal--profile .checkout-addr-modal__backdrop,
    body.is-mobile-app .profile-logout-modal__backdrop,
    body.is-mobile-app .cart-modal__backdrop,
    body.is-mobile-app .site-confirm__backdrop,
    body.is-mobile-app .profile-review-modal__backdrop {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.is-mobile-app .checkout-addr-modal__backdrop,
    body.is-mobile-app .cart-modal__backdrop {
        background: rgba(15, 23, 42, 0.58) !important;
    }

    /* will-change only while drawer animates */
    body.is-mobile-app .mobile-drawer__backdrop,
    body.is-mobile-app .mobile-drawer__panel {
        will-change: auto;
    }

    body.is-mobile-app.mobile-drawer-open .mobile-drawer__backdrop {
        will-change: opacity;
    }

    body.is-mobile-app.mobile-drawer-open .mobile-drawer__panel {
        will-change: transform;
    }

    body.is-mobile-app .slide-track {
        backface-visibility: hidden;
    }

    /* Cheaper tap feedback than scale transforms */
    body.is-mobile-app.profile-page .profile-nav .sm-item:active,
    body.is-mobile-app.home-page .home-group-pill:active {
        transform: none;
        opacity: 0.82;
    }

    body.is-mobile-app .checkout-addr-modal.checkout-addr-modal--form .checkout-addr-modal__save-bar .checkout-addr-modal__save-btn:active:not(:disabled) {
        transform: none;
        filter: brightness(0.96);
    }

    /* Skip heavy keyframe effects on mobile */
    body.is-mobile-app .checkout-addr-modal.checkout-addr-modal--validation-flash .checkout-addr-modal__dialog {
        animation: none;
    }

    body.is-mobile-app .checkout-addr-modal-form .form-group.is-field-attention input,
    body.is-mobile-app .checkout-addr-modal-form .form-group.is-field-attention .phone-field__input,
    body.is-mobile-app .checkout-addr-modal-form .form-group.is-field-attention .phone-field {
        animation: none;
        box-shadow: 0 0 0 2px rgba(215, 140, 132, 0.24);
    }

    body.is-mobile-app.checkout-addr-modal-open .checkout-field-bubble--mobile {
        animation: none;
    }

    /* Lighter card shadows + isolate paint */
    body.is-mobile-app .product-card,
    body.is-mobile-app .home-product-card,
    body.is-mobile-app .order-card--summary,
    body.is-mobile-app .info-box.profile-orders .order-card,
    body.is-mobile-app .profile-address-card,
    body.is-mobile-app .checkout-addr-modal-card,
    body.is-mobile-app .profile-review-card {
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
        contain: layout style paint;
    }

    /* Defer off-screen list painting */
    body.is-mobile-app .products-grid .product-card,
    body.is-mobile-app .catalog-results-panel .product-card,
    body.is-mobile-app .order-card--summary,
    body.is-mobile-app .profile-address-card,
    body.is-mobile-app .checkout-addr-modal-card,
    body.is-mobile-app .profile-review-card,
    body.is-mobile-app .home-product-card {
        content-visibility: auto;
        contain-intrinsic-size: auto 140px;
    }

    /* Smooth nested scroll without chaining to the page */
    body.is-mobile-app .checkout-addr-modal__body,
    body.is-mobile-app .home-groups-track,
    body.is-mobile-app .home-products-track,
    body.is-mobile-app .filter-sections-wrap,
    body.is-mobile-app .np-suggest,
    body.is-mobile-app .delivery-method-list,
    body.is-mobile-app .support-chat__scroll,
    body.is-mobile-app .mobile-drawer__body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Programmatic smooth scroll is often janky on mobile WebKit */
    body.is-mobile-app {
        scroll-behavior: auto;
    }
}
