/* Picture boxes in the shapes of the prepared copies (tools/images/slots.json, dist/image-fit.js): each copy has
   exactly the shape of its box, so it fills the box with the product whole — no bands, nothing cut. Loaded after
   the other stylesheets; the sizes in the comments are the box on a wide screen and on a phone. */

/* catalog-card 4:3 — catalogue, search and «Для бизнеса» cards (415×311, 168×126) */
.ec-card-photo {
  height: auto;
  aspect-ratio: 4 / 3;
}
/* method-card 16:9 — the two printing methods on «Футболки» (632×356, 349×196) */
.so-methods .ec-card-photo {
  height: auto;
  aspect-ratio: 16 / 9;
}
.so-methods .ec-card-photo img {
  object-fit: cover;
}

/* gallery-main 4:3 (639×479, 351×263); calendar pages of 16:9 slides: gallery-wide (639×359, 351×197) */
.so-gallery > img {
  height: auto;
  max-height: none;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.so-gallery.is-wide > img {
  aspect-ratio: 16 / 9;
}
/* gallery-thumb 4:3 (76×57); gallery-wide-thumb 16:9 (96×54, 88×50: still a 44 px tap target) */
.so-thumbs button {
  height: auto;
}
.so-thumbs img {
  display: block;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.so-gallery.is-wide .so-thumbs button {
  width: 108px;
}
.so-gallery.is-wide .so-thumbs img {
  aspect-ratio: 16 / 9;
}

/* variant-card 4:3 — «Все варианты», the same frame as the large photo (152×114, 127×95) */
.so-variant-card img {
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* choice-option 1:1 (95×95). A selected button stays white: the picture's white background then merges with the
   button instead of looking like a pasted-in tile; the border shows the choice. */
.so-choice img {
  object-fit: cover;
  border-radius: 8px;
}
.so-choice.has-image.selected {
  background: #fff;
  box-shadow: 0 0 0 3px #efe5fa;
}

/* home-category 7:5 — tiles of the sections (244×174, 166×119) */
.category > img,
.category:last-child > img,
.gift-cover {
  height: auto;
  aspect-ratio: 7 / 5;
}
/* home-product 1:1 — «Популярное» (306×306, 168×168) */
.product .photo {
  height: auto;
  aspect-ratio: 1;
}
.product .photo img[src*='blossom-business-cards'],
.product .photo img[src*='personal-photo-poster'] {
  object-fit: cover;
}

/* idphoto-direction 16:9 — the two cards on «Фото на документы» (633×356, 349×196) */
.sc-id-options .pp-direction-photo {
  height: auto;
  aspect-ratio: 16 / 9;
}

@media (max-width: 800px) {
  /* the section label on the low catalogue card of a phone */
  .ec-tag {
    top: 6px;
    left: 6px;
    padding: 2px 6px;
  }
}
@media (max-width: 720px) {
  .so-gallery.is-wide .so-thumbs button {
    width: 100px;
  }
}
