/* Product attribute labels belong above their controls in both views. */
#comjshop .productfull .jshop_prod_attributes > .row,
#comjshop.productfull .jshop_prod_attributes > .row {
  flex-direction: column;
  align-items: stretch;
}

#comjshop .productfull .jshop_prod_attributes > .row > .attributes_title,
#comjshop .productfull .jshop_prod_attributes > .row > .attributes_title + div,
#comjshop.productfull .jshop_prod_attributes > .row > .attributes_title,
#comjshop.productfull .jshop_prod_attributes > .row > .attributes_title + div {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
}

#comjshop .productfull .jshop_prod_attributes select,
#comjshop.productfull .jshop_prod_attributes select {
  min-width: 0;
}

/* The full card keeps the quantity and purchase controls on the same line when they fit. */
#comjshop.productfull .main-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

@media (min-width: 768px) {
  #comjshop.productfull .main-buttons > .prod_qty_input {
    flex: 0 0 auto;
    margin-inline-end: 0;
  }
}

.productfull {
  --vivaldi-gallery-height: 400px;
  --vivaldi-thumbs-inset: 26px;
}

/* Use the same gallery dimensions in the full card and in quick view. */
.productfull .image_middle #list_product_image_middle :is(img.image, img#main_image),
.productfull .image_middle :is(video, .video_full iframe) {
  width: 100%;
  height: var(--vivaldi-gallery-height) !important;
  max-width: 100%;
  max-height: none;
  object-fit: scale-down;
}

.productfull .vivaldi-compact-thumbs #list_product_image_thumb .product-thumbs-swiper {
  height: var(--product-photo-height, var(--vivaldi-gallery-height));
  padding-block: var(--vivaldi-thumbs-inset);
}

.productfull .vivaldi-compact-thumbs #list_product_image_thumb .product-thumbs-swiper::before,
.productfull .vivaldi-compact-thumbs #list_product_image_thumb .product-thumbs-swiper::after {
  height: var(--vivaldi-thumbs-inset);
}

/* Keep the frame on the button and let the photo use the full portrait slot. */
.productfull #list_product_image_thumb .product-thumb-btn > img.jshop_img_thumb {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.product-thumbs-swiper .product-thumbs-arrow {
  border: 0;
  padding: 0;
}

/* The quick view runs in an iframe and uses the browser's own scroll container. */
.product-popup .vivaldi-compact-thumbs .product-thumbs-swiper > .swiper-wrapper {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
}

.product-popup .vivaldi-compact-thumbs .swiper-wrapper::-webkit-scrollbar {
  display: none;
}

.product-popup .vivaldi-compact-thumbs .swiper-wrapper > .swiper-slide {
  scroll-snap-align: start;
}

.product-popup .product-popup__thumbs.vivaldi-compact-thumbs #list_product_image_thumb .swiper-slide {
  height: calc((var(--product-photo-height, var(--vivaldi-gallery-height)) - 2 * var(--vivaldi-thumbs-inset) - 16px) / 3) !important;
  margin-bottom: 8px !important;
}

.product-popup .product-popup__thumbs.vivaldi-compact-thumbs #list_product_image_thumb .swiper-slide:last-child {
  margin-bottom: 0 !important;
}

.product-popup .vivaldi-compact-thumbs .product-thumbs-swiper:not(:has(.swiper-slide:nth-child(4))) .product-thumbs-arrow {
  display: none;
}

.product-popup .vivaldi-compact-thumbs .product-thumbs-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 767.98px) {
  .productfull {
    --vivaldi-gallery-height: 340px;
    --vivaldi-thumbs-inset: 20px;
  }

  .productfull .vivaldi-compact-thumbs #list_product_image_thumb .product-thumbs-arrow {
    width: 18px;
    height: 18px;
  }
}
