/* =========================================================
   V1.4 — Single product mobile layout hardening
   Fixes WooCommerce product pages that were wider than the
   phone viewport while leaving the approved home untouched.
   ========================================================= */
body.single-product .smv-main,
body.single-product .smv-shop-shell,
body.single-product .smv-shop-main,
body.single-product .woocommerce,
body.single-product .woocommerce-page,
body.single-product .product,
body.single-product .woocommerce-product-gallery,
body.single-product .woocommerce-product-gallery__wrapper,
body.single-product .summary,
body.single-product .woocommerce-tabs,
body.single-product .wc-tabs-wrapper,
body.single-product .woocommerce-Tabs-panel,
body.single-product .related,
body.single-product .up-sells {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body.single-product .smv-shop-shell {
  overflow: visible !important;
}

body.single-product .woocommerce div.product::before,
body.single-product .woocommerce div.product::after {
  content: "";
  display: table;
  clear: both;
}

body.single-product .product_title,
body.single-product .woocommerce-product-details__short-description,
body.single-product .woocommerce-product-details__short-description *,
body.single-product .product_meta,
body.single-product .product_meta *,
body.single-product .woocommerce-tabs .panel,
body.single-product .woocommerce-tabs .panel *,
body.single-product .related.products,
body.single-product .related.products * {
  min-width: 0 !important;
  box-sizing: border-box !important;
}

body.single-product .product_title,
body.single-product .woocommerce-product-details__short-description,
body.single-product .woocommerce-product-details__short-description p,
body.single-product .woocommerce-product-details__short-description li,
body.single-product .product_meta,
body.single-product .product_meta span,
body.single-product .product_meta a,
body.single-product .woocommerce-tabs .panel h1,
body.single-product .woocommerce-tabs .panel h2,
body.single-product .woocommerce-tabs .panel h3,
body.single-product .woocommerce-tabs .panel h4,
body.single-product .woocommerce-tabs .panel h5,
body.single-product .woocommerce-tabs .panel h6,
body.single-product .woocommerce-tabs .panel p,
body.single-product .woocommerce-tabs .panel li,
body.single-product .woocommerce-tabs .panel a,
body.single-product .woocommerce-tabs .panel strong,
body.single-product .woocommerce-tabs .panel em {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  hyphens: auto;
}

body.single-product .woocommerce-product-details__short-description > *,
body.single-product .woocommerce-tabs .panel > *,
body.single-product .woocommerce-tabs .panel .wp-block-group,
body.single-product .woocommerce-tabs .panel .wp-block-columns,
body.single-product .woocommerce-tabs .panel .wp-block-column,
body.single-product .woocommerce-tabs .panel .wp-block-image,
body.single-product .woocommerce-tabs .panel figure,
body.single-product .woocommerce-tabs .panel picture,
body.single-product .woocommerce-tabs .panel .wp-block-table {
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.single-product .woocommerce-product-gallery__wrapper,
body.single-product .woocommerce-product-gallery__image,
body.single-product .woocommerce-product-gallery__image > a {
  width: 100% !important;
  max-width: 100% !important;
}

body.single-product .woocommerce-product-gallery__image img,
body.single-product .woocommerce-product-gallery img.wp-post-image,
body.single-product .woocommerce-product-gallery .zoomImg {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
  object-fit: contain !important;
}

body.single-product .product_meta {
  display: grid !important;
  gap: 5px !important;
  width: 100% !important;
  max-width: 100% !important;
  line-height: 1.5 !important;
}
body.single-product .product_meta > span {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.single-product form.cart,
body.single-product form.cart .variations_button,
body.single-product form.cart .single_variation_wrap,
body.single-product form.cart .single_variation,
body.single-product form.cart table.variations {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Keep description tables inside their own scroll area instead of widening the page. */
body.single-product .woocommerce-tabs .panel .wp-block-table,
body.single-product .woocommerce-tabs .panel .table-responsive,
body.single-product .woocommerce-tabs .panel > table {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}
body.single-product .woocommerce-tabs .panel table {
  max-width: 100% !important;
  border-collapse: collapse;
}
body.single-product .woocommerce-tabs .panel th,
body.single-product .woocommerce-tabs .panel td {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}

/* WooCommerce tabs scroll internally when their labels do not fit. */
body.single-product .woocommerce-tabs ul.tabs {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
body.single-product .woocommerce-tabs ul.tabs li {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
}

/* Related products must use the available viewport, never desktop card widths. */
body.single-product .related.products ul.products,
body.single-product .up-sells.products ul.products {
  display: grid !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  overflow: visible !important;
}
body.single-product .related.products ul.products li.product,
body.single-product .up-sells.products ul.products li.product {
  float: none !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
}
body.single-product .related.products ul.products li.product img,
body.single-product .up-sells.products ul.products li.product img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}

@media (max-width: 767px) {
  body.single-product .smv-shop-shell {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 12px auto 34px !important;
    padding: 0 !important;
  }

  body.single-product .smv-shop-main,
  body.single-product .woocommerce,
  body.single-product .woocommerce div.product {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.single-product .woocommerce div.product div.images,
  body.single-product .woocommerce div.product div.summary {
    float: none !important;
    position: static !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 0 20px !important;
    padding: 0 !important;
    clear: both !important;
  }

  body.single-product .woocommerce-product-gallery,
  body.single-product .woocommerce-product-gallery .flex-viewport,
  body.single-product .woocommerce-product-gallery__wrapper,
  body.single-product .woocommerce-product-gallery__image {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.single-product .woocommerce-product-gallery__image {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.single-product .woocommerce-product-gallery__image img,
  body.single-product .woocommerce-product-gallery img.wp-post-image {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 72vh !important;
    object-fit: contain !important;
  }

  body.single-product .product_title {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 12px !important;
    font-size: clamp(24px, 7vw, 30px) !important;
    line-height: 1.15 !important;
    letter-spacing: -.02em !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  body.single-product .woocommerce-product-details__short-description,
  body.single-product .woocommerce-product-details__short-description p,
  body.single-product .woocommerce-product-details__short-description li {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.65 !important;
  }

  body.single-product div.product p.price,
  body.single-product div.product span.price {
    font-size: 26px !important;
    line-height: 1.2 !important;
  }

  body.single-product form.cart {
    display: grid !important;
    grid-template-columns: minmax(72px, 88px) minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  body.single-product form.cart .quantity {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
  }
  body.single-product form.cart .quantity .qty {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
  }
  body.single-product form.cart .single_add_to_cart_button,
  body.single-product form.cart button.button {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
    margin: 0 !important;
    white-space: normal !important;
  }

  body.single-product .product_meta {
    margin-top: 18px !important;
    font-size: 14px !important;
  }

  body.single-product .woocommerce-tabs,
  body.single-product .woocommerce-tabs .panel,
  body.single-product .woocommerce-Tabs-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: visible !important;
  }

  body.single-product .woocommerce-tabs .panel h2,
  body.single-product .woocommerce-tabs .panel .wp-block-heading {
    width: 100% !important;
    max-width: 100% !important;
    font-size: clamp(23px, 6.5vw, 29px) !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  body.single-product .woocommerce-tabs .panel h3 {
    width: 100% !important;
    max-width: 100% !important;
    font-size: clamp(20px, 5.7vw, 25px) !important;
    line-height: 1.25 !important;
  }

  body.single-product .woocommerce-tabs .panel p,
  body.single-product .woocommerce-tabs .panel li {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.65 !important;
  }

  body.single-product .woocommerce-tabs .panel figure,
  body.single-product .woocommerce-tabs .panel img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body.single-product .related.products,
  body.single-product .up-sells.products {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body.single-product .related.products > h2,
  body.single-product .up-sells.products > h2 {
    max-width: 100% !important;
    font-size: clamp(25px, 7vw, 32px) !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
  body.single-product .related.products ul.products,
  body.single-product .up-sells.products ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body.single-product .related.products ul.products li.product,
  body.single-product .up-sells.products ul.products li.product {
    padding: 9px !important;
  }
  body.single-product .related.products ul.products li.product .woocommerce-loop-product__title,
  body.single-product .up-sells.products ul.products li.product .woocommerce-loop-product__title {
    min-height: 0 !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* The footer switches to one column on product pages so long account/contact
     text never recreates the horizontal overflow below the product. */
  body.single-product .smv-v3-footer-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 24px !important;
  }
  body.single-product .smv-v3-footer-grid > section,
  body.single-product .smv-v3-footer-brand,
  body.single-product .smv-v3-payments {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body.single-product .smv-v3-payment-row {
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
  }
}

@media (max-width: 420px) {
  body.single-product .smv-shop-shell {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
  }
  body.single-product .product_title {
    font-size: 25px !important;
  }
  body.single-product form.cart {
    grid-template-columns: 76px minmax(0, 1fr) !important;
  }
  body.single-product .related.products ul.products,
  body.single-product .up-sells.products ul.products {
    gap: 8px !important;
  }
}


/* =========================================================
   V1.5 — Six recommendation cards, true mobile-first grid
   Six products are rendered on every device. The number of
   columns changes with available space: 2 phone, 3 tablet,
   6 desktop. This keeps desktop cards compact without making
   the mobile cards too narrow to read or tap.
   ========================================================= */
body.single-product .related.products ul.products,
body.single-product .up-sells.products ul.products {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  overflow: visible !important;
}

body.single-product .related.products ul.products li.product,
body.single-product .up-sells.products ul.products li.product {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 9px !important;
}

body.single-product .related.products ul.products li.product a img,
body.single-product .up-sells.products ul.products li.product a img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 150px !important;
  max-height: 150px !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  margin: 0 auto 8px !important;
  background: #fff !important;
}

body.single-product .related.products ul.products li.product .woocommerce-loop-product__title,
body.single-product .up-sells.products ul.products li.product .woocommerce-loop-product__title {
  min-height: 0 !important;
  margin-bottom: 6px !important;
  font-size: 13px !important;
  line-height: 1.34 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

body.single-product .related.products ul.products li.product .price,
body.single-product .up-sells.products ul.products li.product .price {
  font-size: 17px !important;
  line-height: 1.2 !important;
}

body.single-product .related.products ul.products li.product .button,
body.single-product .up-sells.products ul.products li.product .button {
  min-height: 42px !important;
  padding: 8px 6px !important;
  font-size: 11px !important;
  white-space: normal !important;
}

/* Tablet: six recommendations in two rows of three. */
@media (min-width: 640px) {
  body.single-product .related.products ul.products,
  body.single-product .up-sells.products ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
  body.single-product .related.products ul.products li.product a img,
  body.single-product .up-sells.products ul.products li.product a img {
    height: 180px !important;
    max-height: 180px !important;
  }
  body.single-product .related.products ul.products li.product .woocommerce-loop-product__title,
  body.single-product .up-sells.products ul.products li.product .woocommerce-loop-product__title {
    font-size: 13.5px !important;
  }
}

/* Desktop: all six fit in one compact row, avoiding giant cards. */
@media (min-width: 1024px) {
  body.single-product .related.products ul.products,
  body.single-product .up-sells.products ul.products {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  body.single-product .related.products ul.products li.product,
  body.single-product .up-sells.products ul.products li.product {
    padding: 10px !important;
  }
  body.single-product .related.products ul.products li.product a img,
  body.single-product .up-sells.products ul.products li.product a img {
    height: 160px !important;
    max-height: 160px !important;
  }
  body.single-product .related.products ul.products li.product .woocommerce-loop-product__title,
  body.single-product .up-sells.products ul.products li.product .woocommerce-loop-product__title {
    font-size: 12.5px !important;
    line-height: 1.32 !important;
  }
  body.single-product .related.products ul.products li.product .smv-loop-meta,
  body.single-product .up-sells.products ul.products li.product .smv-loop-meta {
    font-size: 8px !important;
  }
  body.single-product .related.products ul.products li.product .price,
  body.single-product .up-sells.products ul.products li.product .price {
    font-size: 16px !important;
  }
  body.single-product .related.products ul.products li.product .button,
  body.single-product .up-sells.products ul.products li.product .button {
    min-height: 38px !important;
    font-size: 10px !important;
  }
}
