/* Shared gallery geometry. Loaded after theme styles; colors and shape remain theme-owned. */
body [data-yc-gallery].yc-product-gallery {
  --yc-gallery-height: clamp(18rem, 56svh, 32rem);
  --yc-gallery-thumb-size: 4rem;
  display: grid;
  grid-template-columns: var(--yc-gallery-thumb-size) minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
}
body [data-yc-gallery].yc-product-gallery--single { grid-template-columns: minmax(0, 1fr); }
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__thumbnails {
  grid-column: 1;
  grid-row: 1;
  order: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: var(--yc-gallery-thumb-size);
  max-width: 100%;
  max-height: var(--yc-gallery-height);
  padding: 2px;
  overflow: hidden auto;
  scrollbar-width: none;
}
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__thumbnails::-webkit-scrollbar { display: none; }
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__thumbnails button {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 2.75rem;
  aspect-ratio: 1;
  padding: 0.25rem;
  border: 1px solid var(--yc-color-border);
  border-radius: min(var(--yc-radius-sm, 0.25rem), 0.5rem);
  background: var(--yc-color-surface);
  overflow: hidden;
  opacity: 0.75;
}
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__thumbnails button[aria-pressed="true"] {
  border-color: var(--yc-color-brand);
  outline: 1px solid var(--yc-color-brand);
  outline-offset: -1px;
  opacity: 1;
}
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__thumbnails picture,
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__thumbnails img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__viewport {
  grid-column: 2;
  grid-row: 1;
  order: 0;
  position: relative;
  width: 100%;
  height: var(--yc-gallery-height);
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  border: 1px solid var(--yc-color-border);
  border-radius: var(--yc-radius-lg, 0.5rem);
  overflow: auto hidden;
}
body [data-yc-gallery].yc-product-gallery--single .yc-product-gallery__viewport { grid-column: 1; }
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__slide {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 0;
}
body [data-yc-gallery].yc-product-gallery .yc-product-gallery__slide img {
  padding: clamp(0.5rem, 1.5vw, 1.25rem);
  box-sizing: border-box;
}
/* Absent configuration must not crop a product; explicit merchant fit choices still win. */
body.yc-theme-images-default [data-yc-gallery].yc-product-gallery .yc-product-gallery__slide img {
  object-fit: contain !important;
}
body [data-yc-gallery].yc-product-gallery button:focus-visible {
  outline: 2px solid var(--yc-color-brand);
  outline-offset: -3px;
}
@media (max-width: 48rem) {
  /* The product title is already the next heading; retain only useful ancestor links. */
  .yc-breadcrumbs:has(+ .yc-product) li:has([aria-current="page"]) { display: none; }
  body [data-yc-gallery].yc-product-gallery {
    --yc-gallery-height: clamp(9rem, 24svh, 14rem);
    --yc-gallery-thumb-size: 3rem;
    gap: 0.5rem;
  }
}
@media (max-width: 48rem) and (max-height: 37.5rem) {
  body .yc-section:has(> .yc-product) { padding-top: 1rem; }
  .yc-breadcrumbs:has(+ .yc-product) { margin-bottom: 0.75rem; }
}
