/* Keep single-image galleries in flow so the next product section cannot overlap. */
@media (min-width: 961px) {
  .single-product .woocommerce-product-gallery__wrapper {
    background: #fff !important;
  }

  .single-product .woocommerce-product-gallery__wrapper > .ot-gallery-main-image {
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) {
    align-items: stretch;
    display: flex !important;
    min-height: clamp(520px, calc(100vh - 150px), 820px);
  }

  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) > .woocommerce-product-gallery__image {
    align-items: center;
    background: #fff;
    display: flex !important;
    flex: 1 1 auto;
    height: 100% !important;
    justify-content: center;
    max-height: none !important;
    margin: 0 !important;
    min-height: 0;
    padding: 0;
    width: 100% !important;
  }

  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) > .woocommerce-product-gallery__image a,
  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) > .woocommerce-product-gallery__image img {
    display: block;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    width: 100%;
  }
}

@media (max-width: 960px) {
  /* Let the product image reach the viewport edges instead of exposing the page gutter. */
  .single-product div.product > .woocommerce-product-gallery {
    margin-left: calc((100vw - 100%) / -2) !important;
    width: 100vw !important;
  }

  .single-product .woocommerce-product-gallery__wrapper {
    background: #fff !important;
  }

  .single-product .woocommerce-product-gallery__wrapper > .ot-gallery-main-image {
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) {
    display: block !important;
    min-height: min(86vw, 520px);
  }

  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) > .woocommerce-product-gallery__image {
    align-items: center;
    background: #fff !important;
    display: flex !important;
    justify-content: center;
    margin: 0 !important;
    min-height: min(86vw, 520px);
    padding: 0;
    width: 100% !important;
  }

  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) > .woocommerce-product-gallery__image a,
  .single-product .woocommerce-product-gallery__wrapper:not(:has(> .ot-gallery-thumbnail-rail)) > .woocommerce-product-gallery__image img {
    aspect-ratio: 1 / 1;
    display: block;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    width: 100%;
  }
}

/* The support-benefits disclosure is intentionally borderless at its top edge. */
.single-product .ot-trust--datasheet,
.single-product .ot-trust--datasheet > .ot-mobile-disclosure {
  border-top: 0 !important;
}

/* Give the product image and buying details enough room on 1920px desktops. */
@media (min-width: 961px) {
  body.single-product .woo-products.wf-py-default > .wf-container {
    max-width: none !important;
    width: min(1880px, calc(100% - 40px)) !important;
  }

}

@media (min-width: 1500px) {
  body.single-product div.product .woocommerce-product-gallery {
    left: -20px !important;
    position: relative;
  }
}

/* Keep long amounts such as $14,800.00 on one line at narrow widths. */
.single-product div.product form.cart .timer-order-total > strong {
  font-size: clamp(24px, 3vw, 44px) !important;
  white-space: nowrap !important;
}

/* Override the theme's higher-specificity gallery padding so the image reaches all four corners. */
body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) > .ot-gallery-main-image {
  background: #fff !important;
  padding: 0 !important;
}

@media (min-width: 961px) {
  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) {
    column-gap: 0 !important;
  }

  /* Keep the thumbnail rail as one clean white strip, without nested gray cards. */
  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) > .ot-gallery-thumbnail-rail {
    background: #fff !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) > .ot-gallery-thumbnail-rail > .ot-gallery-thumbnail-viewport {
    gap: 0 !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) .ot-gallery-thumbnail {
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    height: 94px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 94px !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) .ot-gallery-thumbnail img {
    background: #fff !important;
    height: 100% !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) .ot-gallery-thumbnail.is-active {
    box-shadow: inset 0 0 0 2px #d6b25c !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) .ot-gallery-rail-control {
    border: 0 !important;
    border-radius: 0 !important;
  }
}

@media (max-width: 960px) {
  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) > .ot-gallery-thumbnail-rail > .ot-gallery-thumbnail-viewport {
    gap: 0 !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) .ot-gallery-thumbnail {
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.single-product div.product .woocommerce-product-gallery__wrapper:has(> .ot-gallery-thumbnail-rail) .ot-gallery-thumbnail.is-active {
    box-shadow: inset 0 0 0 2px #d6b25c !important;
  }
}

@media (min-width: 961px) {
  /* Do not leave a large blank band between the product row and data sheet. */
  .single-product div.product > .woocommerce-product-gallery,
  .single-product div.product > .summary,
  .single-product div.product > .ot-datasheet-shell--unified {
    margin-bottom: 0 !important;
  }

  .single-product div.product > .ot-datasheet-shell--unified {
    margin-top: 0 !important;
  }
}

@media (max-width: 620px) {
  .single-product div.product form.cart .timer-order-total > strong {
    font-size: clamp(26px, 8.5vw, 34px) !important;
  }
}
