/* Without JavaScript the portfolio remains a normal, visible image gallery. */
.memory-card, .memory-front {
  display: block;
  width: 100%; height: 100%;
  border-radius: inherit;
}
.memory-front { overflow: hidden; }
.memory-back { display: none; }

.gallery.memory-ready .gallery-item {
  perspective: 1200px;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
.gallery.memory-ready .gallery-item:hover { box-shadow: none; }
.memory-ready .memory-card {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform 1250ms cubic-bezier(.22,.65,.25,1);
}
.memory-ready .memory-front, .memory-ready .memory-back {
  position: absolute; inset: 0;
  display: block;
  border-radius: inherit;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 9px 26px rgb(20 58 39 / 14%), 0 3px 7px rgb(20 58 39 / 5%);
}
.memory-ready .memory-back {
  transform: rotateY(0deg);
  background: #feb7ff;
}
.memory-ready .gallery-item:nth-child(3n + 2) .memory-back { background: #c0edce; }
.memory-ready .gallery-item:nth-child(3n) .memory-back { background: #1e4635; }
@media (min-width: 761px) {
  .memory-ready .gallery-item:nth-child(9n + 1) .memory-back,
  .memory-ready .gallery-item:nth-child(9n + 5) .memory-back,
  .memory-ready .gallery-item:nth-child(9n + 9) .memory-back { background: #feb7ff; }
  .memory-ready .gallery-item:nth-child(9n + 2) .memory-back,
  .memory-ready .gallery-item:nth-child(9n + 6) .memory-back,
  .memory-ready .gallery-item:nth-child(9n + 7) .memory-back { background: #c0edce; }
  .memory-ready .gallery-item:nth-child(9n + 3) .memory-back,
  .memory-ready .gallery-item:nth-child(9n + 4) .memory-back,
  .memory-ready .gallery-item:nth-child(9n + 8) .memory-back { background: #1e4635; }
}
.memory-ready .memory-front { transform: rotateY(180deg); }
.memory-ready .gallery-item.is-revealed .memory-card { transform: rotateY(180deg); }
.memory-ready .gallery-item:not(.is-revealed) .gallery-zoom { opacity: 0; }
/* Place the zoom badge in the square corner, opposite the lower-right curve. */
.gallery-item:nth-child(4n + 2) .gallery-zoom {
  right: auto;
  left: clamp(10px, 1vw, 20px);
}
.gallery-item:nth-child(10) { border-bottom-right-radius: 15vw; }
@media (max-width: 760px) {
  .gallery-item:nth-child(10) { border-bottom-right-radius: 25vw; }
}
@media (prefers-reduced-motion: reduce) {
  .memory-ready .memory-card { transition: none; }
}
