/* Phase 10G: a dedicated product grid that is independent of Bootstrap's
   row/column breakpoints and the legacy broad :has() selectors. */
.ff-two-up-products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.ff-two-up-item {
  display: flex !important;
  grid-column: auto !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none !important;
}

.ff-two-up-item > .ff-product-card,
.ff-two-up-item > .ff-seller-product {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
}

.ff-home-module-content,
.ff-generated-module,
.ff-related-products,
.ff-seller-products {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .ff-two-up-products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 767.98px) {
  /* Restore outer page shells that an older row:has() rule could reduce to 50%. */
  body.ff-storefront #common-home,
  body.ff-storefront #product-info,
  body.ff-storefront #seller,
  body.ff-storefront .ff-discovery-page,
  body.ff-storefront #common-home > .row,
  body.ff-storefront #product-info > .row,
  body.ff-storefront #seller > .row,
  body.ff-storefront .ff-discovery-page > .row,
  body.ff-storefront #common-home > .row > #content,
  body.ff-storefront #product-info > .row > #content,
  body.ff-storefront #seller > .row > #content,
  body.ff-storefront .ff-discovery-page > .row > #content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.ff-storefront #common-home > .row > #content,
  body.ff-storefront #product-info > .row > #content,
  body.ff-storefront #seller > .row > #content,
  body.ff-storefront .ff-discovery-page > .row > #content {
    flex: 1 0 100% !important;
  }

  .ff-two-up-products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .ff-two-up-item {
    display: flex !important;
    grid-column: auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
  }

  .ff-two-up-item .ff-product-card,
  .ff-two-up-item .ff-seller-product {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .ff-two-up-item .ff-product-card .image,
  .ff-two-up-item .ff-seller-product-image {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
  }

  .ff-two-up-item .ff-product-card .content,
  .ff-two-up-item .ff-seller-product > div {
    display: flex !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
  }

  .ff-two-up-item .ff-product-card form,
  .ff-two-up-item .ff-seller-product .ff-whatsapp-enquiry {
    margin-top: auto !important;
  }
}

@media (max-width: 340px) {
  .ff-two-up-products { gap: 7px !important; }
}
