/* v5.1.22 — Mobile category text, product image modal and buybox fixes */
@media (max-width: 900px) {
  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-list,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-submenu {
    overflow-x: hidden !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-item,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-row {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-row {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    align-items: center !important;
    min-height: 64px !important;
    height: auto !important;
    padding: 10px 12px !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-link,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-name,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-title,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-row a {
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.16 !important;
    display: block !important;
    text-align: left !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-count,
  body.vlg-theme .vlg-nav.is-open .count {
    flex: 0 0 auto !important;
    min-width: 42px !important;
    max-width: 54px !important;
    text-align: center !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-submenu {
    padding-left: 18px !important;
  }

  /* Keep the main category drawer under user's control on phones. */
  body.vlg-theme .vlg-nav.is-open .vlg-category-menu,
  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown {
    pointer-events: auto !important;
    touch-action: pan-y !important;
  }
}

@media (max-width: 782px) {
  /* User did not want the first product add-to-cart block to travel with scroll. */
  body.vlg-theme.single-product div.product form.cart {
    position: static !important;
    bottom: auto !important;
    z-index: auto !important;
    margin: 16px 0 0 !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .08) !important;
    backdrop-filter: none !important;
  }

  body.vlg-theme.single-product .vlg-product-gallery-card {
    min-height: auto !important;
  }

  body.vlg-theme.single-product .vlg-product-gallery-media,
  body.vlg-theme.single-product .woocommerce-product-gallery,
  body.vlg-theme.single-product .woocommerce-product-gallery__wrapper,
  body.vlg-theme.single-product .woocommerce-product-gallery__image,
  body.vlg-theme.single-product .flex-viewport {
    min-height: 0 !important;
    height: auto !important;
  }

  body.vlg-theme.single-product .woocommerce-product-gallery__image a,
  body.vlg-theme.single-product .woocommerce-product-gallery__image img {
    cursor: zoom-in !important;
  }

  body.vlg-theme.single-product .woocommerce-product-gallery__image img,
  body.vlg-theme.single-product .vlg-product-gallery-card img {
    max-height: min(58vh, 420px) !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }
}

.vlg-mobile-image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 16, 31, .78);
  backdrop-filter: blur(5px);
}

.vlg-mobile-image-modal.is-open {
  display: flex;
}

.vlg-mobile-image-modal__dialog {
  position: relative;
  width: min(94vw, 880px);
  max-height: 92vh;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
}

.vlg-mobile-image-modal__close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  color: #111827;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.vlg-mobile-image-modal__img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(92vh - 48px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 16px;
}
