/* V146 — Mobile product popup full-screen + card gallery controls cleanup */

@media (max-width:720px){
  /* Use the visual viewport instead of a bottom sheet so Safari/Chrome UI does not crop the dialog. */
  .v142-product-modal,
  .v142-product-modal.open{
    inset:0!important;
    width:100vw!important;
    height:100dvh!important;
    min-height:100dvh!important;
    padding:0!important;
    align-items:stretch!important;
    justify-content:stretch!important;
    overflow:hidden!important;
    background:var(--v142-panel,#fff)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }

  .v142-product-dialog{
    width:100vw!important;
    max-width:none!important;
    height:100dvh!important;
    min-height:100dvh!important;
    max-height:100dvh!important;
    margin:0!important;
    padding-top:env(safe-area-inset-top,0px)!important;
    padding-bottom:env(safe-area-inset-bottom,0px)!important;
    box-sizing:border-box!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-y:contain!important;
    scroll-padding-top:56px!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    background:var(--v142-panel,#fff)!important;
  }

  /* Close button gets its own visible row instead of floating over the product image. */
  .v142-popup-close{
    position:sticky!important;
    top:8px!important;
    z-index:30!important;
    float:none!important;
    width:40px!important;
    height:40px!important;
    margin:8px 10px 4px auto!important;
    border:1px solid rgba(255,255,255,.3)!important;
    border-radius:999px!important;
    background:#17263b!important;
    color:#fff!important;
    box-shadow:0 5px 16px rgba(0,0,0,.22)!important;
  }

  .v142-popup-layout{
    display:block!important;
    width:100%!important;
    padding:6px 12px calc(18px + env(safe-area-inset-bottom,0px))!important;
    box-sizing:border-box!important;
  }

  .v142-popup-gallery{
    width:100%!important;
    min-width:0!important;
    margin:0!important;
  }

  /* A predictable image stage: full width, tall enough to see the whole item, never clipped. */
  .v142-popup-stage{
    width:100%!important;
    height:min(54dvh,520px)!important;
    min-height:330px!important;
    aspect-ratio:auto!important;
    overflow:hidden!important;
    border-radius:16px!important;
    background:#fff!important;
    touch-action:pan-y!important;
  }
  .v142-popup-stage img{
    width:100%!important;
    height:100%!important;
    max-width:100%!important;
    max-height:100%!important;
    object-fit:contain!important;
    object-position:center!important;
  }

  .v142-popup-gallery-btn{
    width:36px!important;
    height:36px!important;
    font-size:22px!important;
    opacity:.82!important;
  }
  .v142-popup-gallery-btn.prev{left:8px!important;}
  .v142-popup-gallery-btn.next{right:8px!important;}

  .v142-popup-image-count{
    right:8px!important;
    bottom:8px!important;
    font-size:10px!important;
  }
  .v142-popup-zoom{
    left:8px!important;
    bottom:8px!important;
    min-height:34px!important;
    padding:0 11px!important;
    font-size:10px!important;
  }

  .v142-popup-thumbs{
    width:100%!important;
    gap:9px!important;
    padding:10px 2px 5px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scroll-snap-type:x proximity!important;
    -webkit-overflow-scrolling:touch!important;
  }
  .v142-popup-thumb{
    flex:0 0 58px!important;
    width:58px!important;
    height:58px!important;
    scroll-snap-align:start!important;
  }

  .v142-popup-info{
    width:100%!important;
    padding:10px 2px 0!important;
    box-sizing:border-box!important;
  }
  .v142-popup-title{
    margin-top:5px!important;
    font-size:19px!important;
    line-height:1.32!important;
    overflow-wrap:anywhere!important;
  }
  .v142-popup-kicker,
  .v142-popup-code{font-size:10.5px!important;line-height:1.5!important;}

  /* Do not let the action bar cover the last lines of product information on mobile. */
  .v142-popup-actions{
    position:static!important;
    bottom:auto!important;
    grid-template-columns:1fr 1fr!important;
    margin-top:14px!important;
    padding:4px 0 calc(10px + env(safe-area-inset-bottom,0px))!important;
    background:transparent!important;
  }
  .v142-popup-dismiss{grid-column:1/-1!important;}

  /* Card images support swipe already. Remove arrows that obscure small product images. */
  body.order-redesign #result .product-gallery-nav{
    display:none!important;
  }
  body.order-redesign #result .product-gallery-count{
    pointer-events:none!important;
    right:5px!important;
    bottom:5px!important;
    min-width:0!important;
    padding:4px 6px!important;
    font-size:8px!important;
    opacity:.88!important;
  }
  body.order-redesign[data-mobile-product-view="4"] #result .product-gallery-dots{
    display:none!important;
  }
  body.order-redesign[data-mobile-product-view="4"] #result .product-gallery-count{
    right:3px!important;
    bottom:3px!important;
    padding:3px 5px!important;
    font-size:6.5px!important;
  }
}

@media (max-width:390px){
  .v142-popup-stage{
    height:min(50dvh,440px)!important;
    min-height:290px!important;
  }
  .v142-popup-layout{padding-left:9px!important;padding-right:9px!important;}
  .v142-popup-title{font-size:17px!important;}
  .v142-popup-prices,.v142-popup-dates{grid-template-columns:1fr!important;}
}

@media (max-width:720px) and (max-height:650px){
  .v142-popup-stage{
    height:44dvh!important;
    min-height:250px!important;
  }
}
