/*
 * Official catalog-part thumbnails use a shared visual standard.
 * Runtime analysis finds the actual part bounds, then this layer applies the
 * non-destructive translate/scale needed to make the longest side occupy 84%
 * of a square frame. Original files remain untouched and object-fit stays contain.
 */
.collection-media,
.catalog-media {
  aspect-ratio: 1 / 1;
  padding: .12rem;
  place-items: center;
  overflow: hidden;
}

.collection-media img,
.catalog-media img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.collection-media.part-thumbnail-normalized-frame,
.catalog-media.part-thumbnail-normalized-frame {
  padding: 0;
  background: #f7f7f8;
}

.collection-media img.part-thumbnail-normalized,
.catalog-media img.part-thumbnail-normalized {
  transform-origin: center center;
  transform: translate(var(--part-thumb-shift-x, 0%), var(--part-thumb-shift-y, 0%)) scale(var(--part-thumb-zoom, 1));
  background: transparent;
}

/* Collection cards use a slightly tighter frame before normalization is ready. */
.collection-card.compact .collection-media {
  padding: .06rem;
}

@media (max-width: 650px) {
  .collection-card.compact .collection-media,
  .catalog-media {
    padding: 0;
  }
}
