/**
 * Lakefront Designs — global mobile integration refinements.
 *
 * Component-owned header/footer, homepage, search and WPForms rules now live
 * with their maintained component stylesheets. This file intentionally retains
 * WooCommerce and generic content integrations where global ownership is safer.
 */

@media (max-width: 768px) {
  /* Prevent iOS zoom in WooCommerce purchase controls. */
  body.woocommerce input,
  body.woocommerce select,
  body.woocommerce textarea { font-size: 16px; }

  /* WooCommerce archives: predictable grid, readable cards, no cropped artwork. */
  body.woocommerce.archive ul.products,
  body.post-type-archive-product ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 16px;
  }
  body.woocommerce.archive ul.products::before,
  body.woocommerce.archive ul.products::after,
  body.post-type-archive-product ul.products::before,
  body.post-type-archive-product ul.products::after { display: none !important; }
  body.woocommerce.archive ul.products li.product,
  body.post-type-archive-product ul.products li.product {
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
    float: none !important;
  }
  body.woocommerce.archive ul.products li.product a img,
  body.post-type-archive-product ul.products li.product a img {
    width: 100%;
    height: auto !important;
    max-width: 100%;
    object-fit: contain;
  }
  body.woocommerce.archive ul.products li.product .woocommerce-loop-product__title,
  body.post-type-archive-product ul.products li.product .woocommerce-loop-product__title {
    overflow-wrap: anywhere;
    line-height: 1.25;
  }
  body.woocommerce.archive ul.products li.product .button,
  body.post-type-archive-product ul.products li.product .button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
  }

  /* Single products: keep the buying controls full-width and touch-friendly. */
  body.single-product .site-main,
  body.single-product div.product { max-width: 100%; }
  body.single-product div.product div.images,
  body.single-product div.product div.summary {
    width: 100% !important;
    max-width: 100%;
    margin-right: 0 !important;
    margin-left: 0 !important;
    float: none !important;
  }
  body.single-product div.product div.images img { width: 100%; max-width: 100%; height: auto; object-fit: contain; }
  body.single-product div.product form.cart table.variations,
  body.single-product div.product form.cart table.variations tbody,
  body.single-product div.product form.cart table.variations tr,
  body.single-product div.product form.cart table.variations th,
  body.single-product div.product form.cart table.variations td { display: block; width: 100%; max-width: 100%; }
  body.single-product div.product form.cart table.variations th { padding: 0 0 5px; text-align: left; }
  body.single-product div.product form.cart table.variations td { padding: 0 0 14px; }
  body.single-product div.product form.cart table.variations select { width: 100% !important; max-width: 100%; min-height: 48px; }
  body.single-product div.product form.cart .reset_variations { display: inline-flex; min-height: 44px; align-items: center; }
  body.single-product div.product form.cart .quantity .qty { min-height: 48px; }
  body.single-product div.product form.cart .single_add_to_cart_button { min-height: 48px; padding: 11px 18px; }
  body.single-product .woocommerce-tabs ul.tabs { display: flex; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  body.single-product .woocommerce-tabs ul.tabs li { flex: 0 0 auto; }
  body.single-product .woocommerce-tabs ul.tabs li a { display: flex; min-height: 44px; align-items: center; }

  /* Wide Gutenberg tables, including size guides, scroll inside their own wrapper. */
  .entry-content .wp-block-table { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
  .entry-content .wp-block-table table { width: max-content; min-width: 620px; margin-bottom: 0; }
  .entry-content > table { display: block; width: 100%; max-width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* Generic media safety on normal content pages without changing desktop dimensions. */
  .entry-content img,
  .entry-content iframe,
  .entry-content video,
  .entry-content svg { max-width: 100%; }
}

@media (max-width: 560px) {
  body.woocommerce.archive ul.products,
  body.post-type-archive-product ul.products { grid-template-columns: 1fr; gap: 22px; }
  body.woocommerce.archive ul.products li.product .button,
  body.post-type-archive-product ul.products li.product .button { width: 100%; }

  body.single-product div.product form.cart .woocommerce-variation-add-to-cart,
  body.single-product div.product form.cart:not(.variations_form) { display: flex; flex-wrap: wrap; gap: 10px; }
  body.single-product div.product form.cart .quantity { flex: 0 0 100%; margin: 0 !important; }
  body.single-product div.product form.cart .quantity .qty { width: 100%; }
  body.single-product div.product form.cart .single_add_to_cart_button { width: 100%; flex: 0 0 100%; margin: 0 !important; }
}
