/*
 * "Got any merch?" section
 * Figma: Desktop 70:139 (1440 × 578) · Mobile 86:94 (390 × 578)
 *
 * The T-shirt and cap deliberately spill outside the grey band (above it on
 * both layouts, and below it on mobile), so the section sits above its
 * neighbours and never clips its overflow.
 */

.merch {
  position: relative;
  z-index: 1;
  background: var(--surface-alt);
  color: var(--text-on-alt);
  container-type: inline-size;
}

/* ---------- Mobile (390 frame, scaled fluidly up to 560px) ---------- */

.merch__inner {
  /* 1 design px on the 390 mobile frame */
  --u: calc(min(100cqi, 560px) / 390);
  position: relative;
  max-width: 560px;
  margin-inline: auto;
  padding-top: calc(76 * var(--u));
}

.merch__text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: calc(305 * var(--u));
  margin-left: calc(58 * var(--u));
}

.merch__intro {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.merch__caption {
  min-height: 30px;
  /* Just help text: smaller than the Core/Caption style */
  font-size: 12px;
  line-height: 18px;
}

.merch__shirt {
  position: relative;
  width: calc(337.84 * var(--u));
  height: calc(465.73 * var(--u));
  /* Shirt starts 51px above the bottom of the text block and hangs 177px below the section */
  margin: calc(-51 * var(--u)) 0 calc(-176.73 * var(--u)) calc(9 * var(--u));
}

.merch__shirt img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 85.98%;
  height: 93.55%;
  object-fit: cover;
  transform: translate(-50%, -50%) rotate(6.49deg);
}

.merch__cap {
  position: absolute;
  top: calc(-102 * var(--u));
  left: calc(165 * var(--u));
  width: calc(217 * var(--u));
  height: auto;
  aspect-ratio: 1;
}

/* ---------- Desktop (1440 frame) ---------- */

@media (min-width: 768px) {
  .merch__inner {
    display: grid;
    /* Text column is 391px; the merch artwork's bounding box overlaps it by 48px */
    grid-template-columns: 343px minmax(0, 818.84px);
    max-width: 1440px;
    padding: 0 12px 0 clamp(48px, 40vw - 310px, 266px);
  }

  .merch__text {
    grid-column: 1;
    justify-content: space-between;
    gap: 24px;
    width: 391px;
    min-height: 578px;
    margin: 0;
    padding-block: 76px 66px;
  }

  .merch__media {
    grid-column: 2;
    position: relative;
    align-self: start;
    aspect-ratio: 818.84 / 879.21;
    /* Artwork rises 281px above the band and drops 20px below it (percentages of its width) */
    margin-block: -34.32% -2.47%;
  }

  .merch__shirt {
    position: absolute;
    top: 0;
    left: 0;
    width: 77.89%;
    height: 100%;
    margin: 0;
  }

  .merch__cap {
    top: 39.52%;
    left: 50.07%;
    width: 49.93%;
  }
}

/* ---------- Scroll parallax (js/parallax.js sets --merch-shift, px) ---------- */

.merch__shirt,
.merch__cap {
  --merch-shift: 0px;
  transform: translate3d(0, var(--merch-shift), 0);
  will-change: transform;
}
