/* Product detail gallery — scoped to the storefront PDP, no global overrides. */
.bmk-product-gallery[data-bmk-product-gallery] {
  min-width: 0;
  grid-template-columns: 80px minmax(0, 1fr);
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 640px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
  min-width: 0;
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-thumb {
  display: flex;
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  align-items: center;
  justify-content: center;
  padding: 5px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--bmk-line, #e5e5e5);
  border-radius: 9px;
  scroll-snap-align: start;
  transition: border-color .15s ease;
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-thumb:is(:hover, :focus-visible, .is-active) {
  border-color: #111;
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-thumb:focus-visible,
.bmk-product-gallery[data-bmk-product-gallery] .bmk-gallery-arrow:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-product-main-image {
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
}

.bmk-product-gallery[data-bmk-product-gallery] .bmk-product-main-image > img {
  display: block;
  transition: opacity .16s ease;
}

.bmk-gallery-controls {
  position: absolute;
  inset-inline: 14px;
  top: 50%;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  direction: ltr;
  transform: translateY(-50%);
}

.bmk-gallery-arrow {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #111;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
  cursor: pointer;
  pointer-events: auto;
}

.bmk-gallery-arrow svg { width: 18px; height: 18px; }
.bmk-gallery-arrow:hover { background: #fff; }

.bmk-gallery-counter {
  position: absolute;
  z-index: 2;
  inset-inline-end: 14px;
  bottom: 14px;
  padding: 6px 10px;
  color: #111;
  background: rgba(255, 255, 255, .92);
  border-radius: 24px;
  font-size: 11px;
  font-weight: 700;
  direction: ltr;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .bmk-product-gallery[data-bmk-product-gallery] {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }
  .bmk-product-gallery[data-bmk-product-gallery] .bmk-product-main-image {
    order: 0;
    position: relative;
    top: auto;
    width: 100%;
    min-height: 290px;
    aspect-ratio: 1 / 1;
  }
  .bmk-product-gallery[data-bmk-product-gallery] .bmk-product-main-image > img {
    max-height: 440px;
    width: 90%;
    height: 90%;
  }
  .bmk-product-gallery[data-bmk-product-gallery] .bmk-thumbs {
    order: 1;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    padding: 2px 1px 7px;
  }
  .bmk-product-gallery[data-bmk-product-gallery] .bmk-thumb {
    flex: 0 0 66px;
    width: 66px;
    height: 66px;
  }
  .bmk-product-gallery[data-bmk-product-gallery]:not(.has-multiple) .bmk-thumbs {
    display: none;
  }
  .bmk-gallery-controls { inset-inline: 8px; }
  .bmk-gallery-arrow { width: 34px; height: 34px; }
  .bmk-gallery-counter { inset-inline-end: 9px; bottom: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .bmk-product-gallery[data-bmk-product-gallery] .bmk-product-main-image > img,
  .bmk-product-gallery[data-bmk-product-gallery] .bmk-thumb {
    transition: none;
  }
}
