/* ZUGA protein formats — pill-stack tiles with fanned product shots. */

/* Paint above the band before so the wavy top edge sits on top of it. */
.section-zuga-formats {
  position: relative;
  z-index: 3;
}

.zuga-formats {
  position: relative;
  padding: clamp(6rem, 8vw, 10rem) 0 clamp(6rem, 8vw, 10rem);
  background: var(--zuga-formats-bg, var(--zuga-cream));
}

.zuga-formats__heading {
  margin-bottom: clamp(3.6rem, 5vw, 6rem);
  font-size: clamp(3.4rem, 4.4vw, 6rem);
  text-align: center;
}

/* Always one line: a column per tile, shrinking together up to 36rem each. */
.zuga-formats__list {
  display: grid;
  grid-template-columns: repeat(var(--zuga-formats-count, 3), minmax(0, 36rem));
  justify-content: center;
  gap: clamp(2rem, 3vw, 4rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.zuga-formats__item {
  min-width: 0;
}

.zuga-formats__tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 0.96;
  color: inherit;
  text-decoration: none;
  transition: scale 0.15s var(--zuga-ease-out);
}

/* Press feedback for touch (and mouse). */
.zuga-formats__tile:active {
  scale: 0.97;
}

.zuga-formats__tile:focus-visible {
  outline: 0.2rem solid var(--zuga-orange);
  outline-offset: 0.6rem;
}

/* Same tile language as the favorites cards: four overlapping pills. */
.zuga-formats__shape {
  position: absolute;
  inset: 0;
  transform: rotate(-1.5deg);
  transition: transform 0.6s var(--zuga-ease-spring);
}

.zuga-formats__shape > span {
  position: absolute;
  left: 0;
  right: 0;
  height: 29.4%;
  border-radius: 99rem;
  background: var(--zuga-tile);
  transition: transform 0.6s var(--zuga-ease-spring);
}

.zuga-formats__shape > span:nth-child(1) {
  top: 0;
}

.zuga-formats__shape > span:nth-child(2) {
  top: 23.53%;
  transition-delay: 0.04s;
}

.zuga-formats__shape > span:nth-child(3) {
  top: 47.06%;
  transition-delay: 0.08s;
}

.zuga-formats__shape > span:nth-child(4) {
  top: 70.59%;
  transition-delay: 0.12s;
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__shape {
    transform: rotate(0.5deg);
  }
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__shape > span:nth-child(odd) {
    transform: translateX(-0.8rem);
  }
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__shape > span:nth-child(even) {
    transform: translateX(0.8rem);
  }
}

/* Product area */
.zuga-formats__media {
  position: absolute;
  top: 10%;
  bottom: 24%;
  left: 12%;
  right: 12%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.zuga-formats__single {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.6s var(--zuga-ease-spring);
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__single {
    transform: translateY(-4%) scale(1.05);
  }
}

.zuga-formats__blank {
  display: block;
  width: 56%;
  height: 100%;
  border: 0.2rem dashed rgba(232, 80, 28, 0.3);
  border-radius: 1.6rem;
  background: rgba(255, 255, 255, 0.4);
}

/* Fanned products (cans, pouches, bars): they overlap at rest and spread out
   on hover. Each item gets a fixed share of the width (3 × 50% − overlaps ≈
   92%) so wide pouches and slim cans both fit; height is capped by the area. */
.zuga-formats__stack {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.zuga-formats__stack img {
  display: block;
  width: 50%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  margin: 0 -9.5%;
  filter: drop-shadow(0 0.8rem 0.8rem rgba(120, 60, 160, 0.18));
  transform-origin: 50% 100%;
  transition: transform 0.6s var(--zuga-ease-spring);
}

.zuga-formats__stack--3 img:nth-child(1) {
  transform: rotate(-7deg) scale(0.92);
}

.zuga-formats__stack--3 img:nth-child(2) {
  position: relative;
  z-index: 1;
}

.zuga-formats__stack--3 img:nth-child(3) {
  transform: rotate(7deg) scale(0.92);
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__stack--3 img:nth-child(1) {
    transform: translateX(-12%) rotate(-14deg) scale(0.92);
  }
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__stack--3 img:nth-child(2) {
    transform: translateY(-5%) scale(1.04);
  }
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__stack--3 img:nth-child(3) {
    transform: translateX(12%) rotate(14deg) scale(0.92);
  }
}

.zuga-formats__stack--2 img:nth-child(1) {
  transform: rotate(-6deg);
}

.zuga-formats__stack--2 img:nth-child(2) {
  transform: rotate(6deg);
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__stack--2 img:nth-child(1) {
    transform: translateX(-10%) rotate(-12deg);
  }
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__stack--2 img:nth-child(2) {
    transform: translateX(10%) rotate(12deg);
  }
}

@media (hover: hover) and (pointer: fine) {
  .zuga-formats__tile:hover .zuga-formats__stack--1 img {
    transform: translateY(-5%) rotate(-4deg) scale(1.05);
  }
}

.zuga-formats__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9%;
  font-family: var(--zuga-font);
  font-size: clamp(1.8rem, 1.7vw, 2.4rem);
  font-weight: 700;
  text-align: center;
  color: var(--zuga-text, var(--zuga-orange));
}

/* Phones: still one line, as a swipeable row. */
@media screen and (max-width: 749px) {
  .zuga-formats__list {
    display: flex;
    justify-content: flex-start;
    gap: 1.6rem;
    margin: 0 -1.5rem;
    padding: 1rem 1.5rem 1.6rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scroll-padding: 0 1.5rem;
    scrollbar-width: none;
  }

  .zuga-formats__list::-webkit-scrollbar {
    display: none;
  }

  .zuga-formats__item {
    flex: 0 0 72%;
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zuga-formats__shape,
  .zuga-formats__shape > span,
  .zuga-formats__stack img,
  .zuga-formats__single {
    transition: none;
  }
}
