/* Page-specific overrides for the products catalog (mobile)
   Loaded last to win the cascade against grid-system/main/mobile styles. */

/* Prevent "scrolling into blank space" (rubber-band / overscroll chaining)
   and ensure any overscroll background isn't white. */
html {
  background: #eef2f7;
}

body.page-products {
  overscroll-behavior-y: none;
  background-color: var(--c7-catalog-surface-alt, #eef2f7);
}

body.page-products footer.site-footer {
  margin-top: 0;
}

@media (max-width: 575.98px) {
  body.page-products #productsContainer.products-grid,
  body.page-products .products-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    /* keep a tiny gutter so card shadows/content don't feel clipped */
    padding: 0 8px !important;
    max-width: none !important;
    place-items: stretch !important;
    justify-items: stretch !important;
    align-items: stretch !important;
  }

  body.page-products .product-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    /* global mobile CSS sets overflow:hidden; that clips long labels */
    overflow: visible !important;
  }

  body.page-products .product-card .card-body {
    overflow: visible !important;
  }

  /* Buttons in 2-column layout: allow wrapping instead of clipping */
  body.page-products .product-card .catalog-add-to-cart,
  body.page-products .product-card .btn-add-cart,
  body.page-products .product-card .buy-btn,
  body.page-products .product-card .buy-button,
  body.page-products .product-card .btn {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    font-size: 12px !important;
    padding: 10px 8px !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

   /* Fallback: some templates use just .btn without extra class */
   body.page-products .product-card .card-footer .btn {
     min-width: 0 !important;
     white-space: normal !important;
     overflow: visible !important;
     text-overflow: unset !important;
   }
}

/* Extremely small phones: fall back to one column for readability */
@media (max-width: 340px) {
  body.page-products #productsContainer.products-grid,
  body.page-products .products-grid {
    grid-template-columns: 1fr !important;
  }
}
