/* Original pixels through a transparent cutout mask, on the product colour. */
.product-media-stage {
  --media-space-width: 84cqw;
  --media-space-height: 88cqh;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  container-type: size;
  background: transparent;
  z-index: 1;
}

.product-media-frame {
  position: relative;
  width: min(var(--media-space-width), calc(var(--media-space-height) * var(--media-ratio)));
  aspect-ratio: var(--media-ratio);
  overflow: hidden;
  background: transparent;
  filter: drop-shadow(0 14px 12px #18345516);
  transform-origin: center 65%;
  transition: transform 650ms cubic-bezier(.16, 1, .3, 1);
}

.product-media-frame > img {
  position: absolute;
  top: var(--media-crop-top);
  left: var(--media-crop-left);
  display: block;
  width: var(--media-crop-width);
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  object-fit: initial;
  transform: none;
  animation: none;
  -webkit-mask-image: var(--media-mask, none);
  mask-image: var(--media-mask, none);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  mask-mode: alpha;
}

.product-card-visual:has(.product-media-stage),
.detail-visual:has(.product-media-stage),
.story-photo:has(.product-media-stage),
.cart-item-image:has(.product-media-stage) {
  background: var(--product-color, #d2ebf6);
}

.sheet-visual:has(.product-media-stage) {
  background: var(--sheet-color, #d2ebf6);
}

.product-card-visual:has(.product-media-stage),
.detail-visual:has(.product-media-stage) {
  box-shadow: none;
}

.product-card-visual:has(.product-media-stage)::before,
.detail-visual:has(.product-media-stage)::before {
  content: "";
  position: absolute;
  width: 73%;
  aspect-ratio: 1;
  top: 13%;
  left: 13.5%;
  border: 1px solid #ffffff9c;
  border-radius: 50%;
  pointer-events: none;
  transition: transform 700ms cubic-bezier(.16, 1, .3, 1);
}

.detail-visual:has(.product-media-stage)::after {
  content: "✳";
  position: absolute;
  top: 12%;
  right: 10%;
  color: #ffffffad;
  font-size: clamp(28px, 4vw, 54px);
  pointer-events: none;
}

.product-card-visual .product-media-stage {
  --media-space-width: 87cqw;
  --media-space-height: 87cqh;
}

.detail-visual .product-media-stage {
  --media-space-width: 88cqw;
  --media-space-height: 89cqh;
}

.detail-visual .product-media-frame {
  transform: rotate(var(--product-tilt, 0deg)) translateY(var(--product-y, 0px));
  animation: product-media-arrive 650ms cubic-bezier(.16, 1, .3, 1) backwards;
}

.product-gallery .gallery-tabs {
  flex-wrap: wrap;
}

.detail-visual:has(.product-media-stage) .detail-photo-note {
  z-index: 1;
  color: #3e496b;
  background: transparent;
}

.story-photo .product-media-stage {
  --media-space-width: 85cqw;
  --media-space-height: 85cqh;
}

.story-photo:has(.product-media-stage) .story-caption {
  z-index: 1;
  max-width: calc(100% - 40px);
  color: #303d64;
  background: transparent;
  line-height: 1.6;
}

.sheet-visual:has(.product-media-stage) {
  min-height: 365px;
  border: 1px solid #e1e8ef;
}

.sheet-visual .product-media-stage {
  --media-space-width: 90cqw;
  --media-space-height: 87cqh;
  height: calc(100% - 25px);
}

.sheet-visual:has(.product-media-stage) > :is(small, figcaption) {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  margin: 0;
  color: #3e5370;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.cart-item-image:has(.product-media-stage) {
  position: relative;
  overflow: hidden;
}

.cart-item-image .product-media-stage {
  --media-space-width: 93cqw;
  --media-space-height: 94cqh;
}

.cart-item-image .product-media-frame > img {
  width: var(--media-crop-width);
  height: auto;
  object-fit: initial;
}

.world-image.product-lineup-scene {
  position: relative;
  background: #cce7f0;
}

.product-lineup {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.product-lineup::before {
  content: "";
  position: absolute;
  width: 75%;
  aspect-ratio: 1;
  left: 12.5%;
  top: 10%;
  border: 1px solid #ffffffb3;
  border-radius: 50%;
}

.lineup-item { position: absolute; width: 43%; height: 80%; bottom: 5%; }
.lineup-item-1 { left: 0; transform: rotate(-9deg); }
.lineup-item-2 { left: 29%; width: 42%; height: 62%; bottom: 10%; z-index: 2; }
.lineup-item-3 { right: 0; transform: rotate(9deg); }
.lineup-item .product-media-stage { --media-space-width: 98cqw; --media-space-height: 95cqh; }
.world-card .lineup-item .product-media-frame > img { transform: none; }
.world-card:hover .product-lineup .product-media-frame { transform: translateY(-6px); }

.product-card:hover .product-card-visual::before {
  transform: scale(1.08);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .product-card:hover .product-media-frame {
    transform: translateY(-3px) scale(1.01);
  }

  .detail-visual:hover .product-media-frame {
    transform: rotate(var(--product-tilt, 0deg)) translateY(var(--product-y, 0px)) scale(1.01);
  }
}

@keyframes product-media-arrive {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 780px) {
  .product-card-visual .product-media-stage {
    --media-space-width: 90cqw;
    --media-space-height: 88cqh;
  }

  .detail-visual .product-media-stage {
    --media-space-width: 90cqw;
    --media-space-height: 88cqh;
  }

}

@media (max-width: 680px) {
  .sheet-visual:has(.product-media-stage) {
    min-height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-media-frame,
  .detail-visual .product-media-frame,
  .world-card:hover .product-lineup .product-media-frame {
    animation: none;
    transition: none;
    transform: none;
  }
}

@media print {
  .technical-sheet .sheet-visual:has(.product-media-stage) {
    min-height: 220px;
    height: 220px;
    max-height: 220px;
    align-self: center;
    break-inside: avoid;
  }

  .technical-sheet .sheet-visual .product-media-stage {
    --media-space-width: 90cqw;
    --media-space-height: 95cqh;
    height: calc(100% - 18px);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .technical-sheet .sheet-visual .product-media-frame {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  .technical-sheet .sheet-visual:has(.product-media-stage) > :is(small, figcaption) {
    bottom: 4px;
    font-size: 6.5pt;
  }
}
