/* HomeGlo — Mobile + iPad QA layer
 * Final responsive safeguards loaded after the main reference stylesheet.
 */

/* Prevent accidental page-wide sideways scrolling while preserving intentional
   horizontal carousels inside their own containers. */
html,body{max-width:100%;overflow-x:clip}
img,svg,video,canvas{max-width:100%}
.hg-shell,.hg-content-main,.hg-commerce-shell,.hg-commerce-content,
.woocommerce,.woocommerce div.product,.woocommerce div.product .summary,
.woocommerce div.product .woocommerce-product-gallery{min-width:0}

/* Reliable touch targets across tablet/mobile controls. */
@media(max-width:1180px){
  .hg-menu-button,
  .hg-mobile-search-button,
  .hg-cart-link,
  .hg-wishlist-link,
  .hg-account-link,
  .hg-mini-cart-close{min-width:44px!important;min-height:44px!important}

  .woocommerce div.product,
  .woocommerce div.product .summary,
  .woocommerce div.product .woocommerce-product-gallery{width:100%!important;max-width:100%!important}

  .woocommerce div.product .summary{overflow:visible!important}
  .woocommerce div.product form.cart{width:100%!important;max-width:100%!important}
  .woocommerce div.product form.cart>*{min-width:0!important}

  .hg-hotspot-look,
  .hg-bundle-builder,
  .hg-complete-look,
  .hg-recently-viewed,
  .hg-customer-homes,
  .hg-product-qa,
  .hg-price-alert,
  .hg-delivery-checker{max-width:100%!important;min-width:0!important}
}

/* Tablet / iPad */
@media(max-width:980px){
  .woocommerce div.product form.cart{
    grid-template-columns:120px minmax(0,1fr)!important;
    gap:10px!important;
  }
  .woocommerce div.product form.cart>.hg-qty-stepper{
    width:120px!important;
    min-width:120px!important;
  }
  .woocommerce div.product form.cart .single_add_to_cart_button{
    width:100%!important;
    min-width:0!important;
  }
  .woocommerce div.product form.cart .hg-buy-now-button{
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
  }

  .woocommerce-cart .hg-commerce-content>.woocommerce{
    grid-template-columns:minmax(0,1fr)!important;
    gap:18px!important;
  }
  .woocommerce-cart .woocommerce-cart-form,
  .woocommerce-cart .cart-collaterals{grid-column:1!important;width:100%!important;min-width:0!important}
  .woocommerce-cart .cart-collaterals .cart_totals{position:static!important;top:auto!important}

  .woocommerce-checkout form.checkout{grid-template-columns:minmax(0,1fr)!important;gap:18px!important}
  .woocommerce-checkout #customer_details,
  .woocommerce-checkout #order_review_heading,
  .woocommerce-checkout #order_review{grid-column:1!important;width:100%!important;min-width:0!important}

  .woocommerce-account .woocommerce{
    grid-template-columns:minmax(0,1fr)!important;
    gap:14px!important;
  }
  .woocommerce-account .woocommerce-MyAccount-navigation{
    width:100%!important;
    overflow:hidden!important;
    padding:8px!important;
  }
  .woocommerce-account .woocommerce-MyAccount-navigation ul{
    display:flex!important;
    gap:6px!important;
    width:100%!important;
    min-width:0!important;
    overflow-x:auto!important;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  .woocommerce-account .woocommerce-MyAccount-navigation ul::-webkit-scrollbar{display:none}
  .woocommerce-account .woocommerce-MyAccount-navigation li{flex:0 0 auto!important}
  .woocommerce-account .woocommerce-MyAccount-navigation li a{
    display:flex!important;
    align-items:center!important;
    min-height:42px!important;
    white-space:nowrap!important;
    padding:9px 13px!important;
  }
}

/* Phone */
@media(max-width:680px){
  .hg-shell{width:calc(100% - 24px)!important}

  /* Product purchase controls stay usable even at 320–390px widths. */
  .woocommerce div.product .product_title{font-size:clamp(38px,11vw,48px)!important;line-height:.94!important}
  .woocommerce div.product form.cart{
    display:grid!important;
    grid-template-columns:108px minmax(0,1fr)!important;
    gap:9px!important;
    align-items:stretch!important;
  }
  .woocommerce div.product form.cart>.hg-qty-stepper{
    width:108px!important;
    min-width:108px!important;
    grid-template-columns:32px 44px 32px!important;
  }
  .woocommerce div.product form.cart .hg-qty-stepper .qty{
    width:44px!important;
    min-width:44px!important;
  }
  .woocommerce div.product form.cart .hg-qty-btn{width:32px!important}
  .woocommerce div.product form.cart .single_add_to_cart_button{
    min-height:48px!important;
    padding-left:10px!important;
    padding-right:10px!important;
  }
  .woocommerce div.product form.cart .hg-buy-now-button{
    grid-column:1/-1!important;
    min-height:48px!important;
  }

  /* Express pay / payment-request rows must never exceed the summary width. */
  .woocommerce div.product .wcpay-payment-request-wrapper,
  .woocommerce div.product #wcpay-payment-request-wrapper,
  .woocommerce div.product .wc-stripe-payment-request-wrapper,
  .woocommerce div.product .ppc-button-wrapper,
  .woocommerce div.product iframe{max-width:100%!important;width:100%!important;box-sizing:border-box!important}

  /* Full cart: mobile card layout, no accidental horizontal table scroll. */
  .woocommerce-cart-form{overflow-x:hidden!important;width:100%!important;max-width:100%!important}
  .woocommerce-cart table.cart,
  .woocommerce-cart table.cart tbody,
  .woocommerce-cart table.cart tr{max-width:100%!important}
  .woocommerce-cart table.cart td.actions{max-width:100%!important;overflow:hidden!important}
  .woocommerce-cart .coupon{grid-template-columns:minmax(0,1fr)!important}
  .woocommerce-cart .coupon .input-text,
  .woocommerce-cart .coupon button,
  .woocommerce-cart table.cart td.actions>button{width:100%!important;max-width:100%!important}
  .woocommerce-cart .cart-collaterals .cart_totals{padding:20px!important}

  /* Checkout: remove the tablet overlap treatment at phone size. */
  .woocommerce-checkout #order_review_heading{
    margin:0!important;
    padding:20px 20px 9px!important;
    font-size:30px!important;
  }
  .woocommerce-checkout #order_review{
    padding:18px 20px 20px!important;
    margin:0!important;
  }
  .woocommerce-checkout #customer_details>div{padding:20px!important}
  .woocommerce-checkout #place_order{width:100%!important;min-height:50px!important}
  .woocommerce-checkout .form-row-first,
  .woocommerce-checkout .form-row-last{float:none!important;width:100%!important}

  /* Account navigation behaves as a swipeable row rather than a tall grid. */
  .woocommerce-account .woocommerce-MyAccount-navigation ul{
    display:flex!important;
    grid-template-columns:none!important;
    padding-bottom:2px!important;
  }
  .woocommerce-account .woocommerce-MyAccount-content{
    width:100%!important;
    min-width:0!important;
    padding:18px!important;
  }

  /* Sticky purchase bar uses the approved neutral palette. */
  .single-product .hg-mobile-sticky-cart{
    background:rgba(250,246,240,.97)!important;
    border-top-color:rgba(43,38,34,.12)!important;
  }
  .hg-mobile-sticky-cart-copy strong,
  .hg-mobile-sticky-cart-copy>span{color:#2b2622!important}
  .hg-mobile-sticky-cart-button{
    background:#2b2622!important;
    color:#fff!important;
    min-width:118px!important;
  }

  /* Feature dialogs and cards stay inside the viewport. */
  .hg-room-viewer,
  .hg-shared-wishlist-dialog,
  .hg-compare-dialog{max-width:calc(100vw - 12px)!important}
  .hg-room-viewer-actions>*,
  .hg-bundle-submit,
  .hg-cart-reminder-form button{max-width:100%!important}

  .hg-newsletter-form,
  .hg-newsletter-form-wrap{width:100%!important;max-width:100%!important}
}

/* Very small phones */
@media(max-width:390px){
  .woocommerce div.product form.cart{
    grid-template-columns:100px minmax(0,1fr)!important;
    gap:7px!important;
  }
  .woocommerce div.product form.cart>.hg-qty-stepper{
    width:100px!important;
    min-width:100px!important;
    grid-template-columns:30px 40px 30px!important;
  }
  .woocommerce div.product form.cart .hg-qty-stepper .qty{width:40px!important;min-width:40px!important}
  .woocommerce div.product form.cart .hg-qty-btn{width:30px!important}
  .hg-mobile-sticky-cart-inner{gap:8px!important}
  .hg-mobile-sticky-cart-button{min-width:108px!important;padding:0 12px!important}
}
