/* A shared shelf, image stage and purchase area for both brands and the catalog. */
:root {
  --card-page-width: 76rem;
  --card-page-gutter: clamp(14px, 4vw, 64px);
  --card-columns: 5;
  --card-gap: clamp(10px, 1.5vw, 22px);
  --card-inset: clamp(10px, 1.2vw, 18px);
  --card-bottom: clamp(9px, 1vw, 14px);
  --card-photo: clamp(105px, 10.5vw, 150px);
  --card-title: clamp(1.2rem, 1.45vw, 1.375rem);
  --card-button: 2.8rem;
}

body[data-pet="hund"] :is(#menues, #sortiment),
body[data-pet="katze"] .wrap,
body:has(.tiles) main {
  box-sizing: border-box;
  width: min(var(--card-page-width), calc(100% - 2 * (var(--card-page-gutter) - var(--shop-frame, 0px))));
  max-width: none;
  padding-inline: 0;
  margin-inline: auto;
}
body[data-pet="katze"] .wrap > :is(#menues, #sortiment) {
  width: 100%;
  margin-inline: 0;
  padding-inline: 0;
}

#menues #products.grid, #menues > .grid, .merch-shelf .merch-grid, .tiles {
  display: grid;
  grid-template-columns: repeat(var(--card-columns), minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--card-gap);
  align-items: stretch;
}

#menues article, #sortiment .merch-card, .tiles .tile {
  --lift: clamp(25px, 3.6vw, 54px);
  box-sizing: border-box;
  min-inline-size: 0;
  padding: 0 var(--card-inset) var(--card-bottom);
}
#menues .shelf-offer, .tiles .tile > a { min-width: 0; }

#menues .product-photo.pack, #menues .cat-product .pack-cut,
#sortiment .merch-photo, .tiles .tile .photo {
  box-sizing: border-box;
  width: 100%;
  height: var(--card-photo);
  flex: none;
  aspect-ratio: auto;
  padding: 0 5% 2px;
}
#menues .cat-product .pack-cut {
  padding-inline: 14%;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  mix-blend-mode: normal;
}
#menues .product-photo.pack img, #sortiment .merch-photo img, .tiles .tile .photo > * {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: transparent;
  mix-blend-mode: normal;
}
#menues .shelf-offer .card-body { padding-top: 9px; }
#menues .shelf-offer h3, #sortiment .merch-product h3, .tiles .tile h2 {
  margin: 0;
  font: 650 var(--card-title)/1.12 Arial, Helvetica, sans-serif;
  letter-spacing: -.045em;
  hyphens: auto;
  overflow-wrap: anywhere;
}
#sortiment .merch-product {
  display: flex;
  flex: 1;
  flex-direction: column;
}
#sortiment .merch-product h3, .tiles .tile h2 {
  margin-block-start: auto;
  padding-block-start: 3px;
}
#sortiment .merch-card, .tiles .tile > a {text-align: start;}

/* Price, pack size and button read in the same order on every card. */
#menues .shelf-offer .offer-price {
  margin-top: auto;
  padding-top: 4px;
  gap: 0;
}
#sortiment .merch-price, .tiles .tile .cost {
  order: 2;
  margin: 3px 0 0;
  padding: 0;
}
#menues .offer-price strong, #sortiment .merch-price, .tiles .tile .cost {
  min-block-size: 0;
  align-content: end;
  font: 700 1.12rem/1.15 Arial, Helvetica, sans-serif;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
#menues .offer-price small, #sortiment .merch-size, .tiles .tile .size {
  order: 3;
  display: block;
  min-block-size: 0;
  margin: 2px 0 0;
  font: 400 .85rem/1.33 Arial, Helvetica, sans-serif;
  overflow-wrap: anywhere;
}
#menues .shelf-action, #sortiment .merch-action, .tiles .tile-action {
  order: 4;
  box-sizing: border-box;
  min-block-size: var(--card-button);
  margin: 7px 0 0;
  padding: 5px 7px;
  font-size: .9rem;
  line-height: 1.15;
}
@media (max-width: 1100px) { :root { --card-columns: 4; } }
@media (max-width: 900px) { :root { --card-columns: 3; } }
@media (max-width: 700px) {
  :root {
    --card-columns: 2;
    --card-gap: 14px 10px;
    --card-photo: clamp(90px, 25vw, 124px);
    --card-title: clamp(1.075rem, 4.5vw, 1.3rem);
  }
  #menues .shelf-action, #sortiment .merch-action, .tiles .tile-action { font-size: .85rem; }
}

/* Keep the pack and price close together. On short titles the picture inherits the spare space. */
:root:not([data-entwurf]) #auswahl .tiles {
  --catalog-photo-height: clamp(88px, 8.5vw, 120px);
}
:root:not([data-entwurf]) #auswahl .tile .photo {
  position: relative;
  flex: 1 0 var(--catalog-photo-height);
  height: auto;
  min-height: var(--catalog-photo-height);
  padding: 0;
}
:root:not([data-entwurf]) #auswahl .tile .photo img {
  position: absolute;
  inset: 0 0 2px;
  height: calc(100% - 2px);
  object-position: center;
}
:root:not([data-entwurf]) #auswahl .tile h2 {
  margin-block-start: 0;
  padding-block-start: 4px;
}
@media (max-width: 700px) {
  :root:not([data-entwurf]) #auswahl .tiles {
    --catalog-photo-height: clamp(76px, 21.5vw, 108px);
  }
}
