#product-info .product-gallery {
  display: grid;
  gap: 14px;
}

#product-info .product-gallery__stage {
  align-items: center;
  background: #fff;
  border: 1px solid var(--bs-border-color, #e5e7eb);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  min-height: 360px;
  padding: 18px;
}

#product-info .product-gallery__stage img {
  height: min(48vw, 480px);
  max-height: 480px;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

#product-info .product-gallery__thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}

#product-info .product-gallery__thumb {
  background: #fff;
  border: 1px solid var(--bs-border-color, #e5e7eb);
  border-radius: 8px;
  flex: 0 0 72px;
  padding: 4px;
}

#product-info .product-gallery__thumb:hover,
#product-info .product-gallery__thumb:focus-visible,
#product-info .product-gallery__thumb.is-active {
  border-color: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 2px rgb(13 110 253 / 12%);
}

#product-info .product-gallery__thumb img {
  aspect-ratio: 1;
  display: block;
  object-fit: contain;
  width: 100%;
}

#product-info .product-detail-summary {
  min-width: 0;
}

#product-info .product-detail-summary > h1 {
  font-size: clamp(1.5rem, 2.2vw, 2.15rem);
  line-height: 1.2;
  margin-top: 0;
}

#product-info .product-price-panel {
  background: linear-gradient(135deg, #fff8e8, #fff);
  border: 1px solid #f5dfad;
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

#product-info .product-price-panel .price-new {
  font-size: clamp(1.55rem, 3vw, 2rem);
}

#product-info .product-price-panel .price-old {
  color: var(--bs-secondary-color, #6b7280);
  text-decoration: line-through;
}

#product-info .product-share-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

#product-info .product-share-actions .btn {
  min-height: 44px;
  min-width: 44px;
}

#product-info #form-product > hr {
  margin: 18px 0 14px;
}

#product-info .product-buy-actions {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#product-info .product-buy-actions .input-group-text {
  min-height: 46px;
}

#product-info .product-buy-actions #input-quantity {
  flex: 0 1 64px;
  min-height: 46px;
  text-align: center;
}

#product-info .product-buy-actions #button-cart,
#product-info .product-buy-actions #button-buy-now {
  flex: 1 1 145px;
  min-height: 46px;
}

#product-info .variant-option-label {
  transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

#product-info .variant-option-label:focus-within,
#product-info .variant-option-choice input:focus-visible + .variant-option-label {
  outline: 2px solid var(--bs-primary, #0d6efd);
  outline-offset: 2px;
}

@media (min-width: 992px) {
  /* Keep the gallery row independent from the potentially long option form.
   * The reference product page uses a compact 38/62 gallery-summary split;
   * the legacy equal columns let the summary stretch the gallery grid row to
   * the full height of every option control. */
  #product-info > .row > #content > .row > .product-gallery {
    align-self: flex-start;
    flex: 0 0 43%;
    max-width: 43%;
  }

  #product-info > .row > #content > .row > .product-detail-summary {
    flex: 0 0 57%;
    max-width: 57%;
  }

  #product-info .product-gallery__stage {
    height: 508px;
    min-height: 508px;
    max-height: 508px;
    margin-left: auto;
    margin-right: auto;
    max-width: 508px;
    padding: 0;
  }

  #product-info .product-gallery__stage img {
    height: 100%;
    max-height: 100%;
    margin-bottom: 0 !important;
  }

  #product-info .product-detail-summary > h1 {
    font-size: 22.4px;
    line-height: 1.2;
  }
}

@media (max-width: 767.98px) {
  /* On narrow desktop-theme viewports the gallery link otherwise shrink-wraps
   * around the intrinsic image and leaves the main product photo tiny. */
  #product-info .product-gallery__stage > a {
    display: block;
    width: 100%;
  }

  #product-info .product-gallery__stage > a img {
    height: min(82vw, 320px);
    max-width: 100%;
    object-fit: contain;
    width: 100%;
  }

  #product-info.mobile-product-page {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  #product-info.mobile-product-page .mobile-product-gallery {
    display: grid;
    gap: 10px;
  }

  #product-info.mobile-product-page .mobile-product-main-image {
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    min-height: 250px;
    padding: 10px;
  }

  #product-info.mobile-product-page .mobile-product-main-image img {
    max-height: min(82vw, 360px);
  }

  #product-info.mobile-product-page .mobile-product-thumbs {
    margin-top: 0;
  }

  #product-info.mobile-product-page .mobile-product-thumbs a {
    flex: 0 0 62px;
    padding: 3px;
  }

  #product-info.mobile-product-page .mobile-product-thumbs a.is-active {
    border-color: var(--main-color, #333);
    box-shadow: 0 0 0 2px rgb(0 0 0 / 8%);
  }

  #product-info.mobile-product-page .mobile-product-pricing {
    border: 1px solid #f5dfad;
    box-shadow: 0 4px 14px rgb(20 30 50 / 5%);
  }

  #product-info.mobile-product-page .mobile-product-buy-actions {
    background: rgb(255 255 255 / 94%);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 8px 24px rgb(15 23 42 / 18%);
    padding: 8px;
    position: sticky;
    z-index: 11;
  }
}

@media (prefers-reduced-motion: reduce) {
  #product-info .product-gallery__thumb,
  #product-info .variant-option-label {
    transition: none;
  }
}
