<style>
.hover-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3; /* adjust if needed */
  overflow: hidden;
}

/* BOTH images fill the container */
.hover-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease;
}

/* Normal image */
.hover-image img:first-child {
  object-fit: cover;
  opacity: 1;
}

/* Hover image */
.hover-image img:last-child {
  object-fit: contain;
  opacity: 0;
}

/* Hover swap */
.hover-image:hover img:last-child {
  opacity: 1;
}

.hover-image:hover img:first-child {
  opacity: 0;
}

/* ?? Disable hover on mobile */
@media (hover: none), (pointer: coarse) {
  .hover-image img:last-child {
    display: none;
  }

  .hover-image img:first-child {
    opacity: 1 !important;
  }
}
</style>
