.random-pile-gallery {
  position: relative;
  width: 780px;   /* adjust container width */
  height: 500px;  /* adjust container height */
  justify-self: center;
}

.random-pile-gallery .pile-item {
  position: absolute;
  cursor: pointer;
  width: 251px;
  height: 280px;           /* total height: image + bottom frame */
  background: #fff;
 
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
  padding:10px;
  display: flex;
  flex-direction: column;   /* stack image + bottom space */
  justify-content: flex-start;
  transition: transform 0.2s;
  border-radius: 4px;
  overflow: visible;        /* ensure image isn’t clipped */
}

.random-pile-gallery .pile-item img {
  width: 251px;
  height: 251px;           /* fixed square */
  object-fit: cover;
  border-radius: 2px;
  margin-bottom: 29px;      /* bottom white space for frame */
}


/* Spin in (hover enter) */
@keyframes spinIn {
  0%   { transform: rotate(var(--start-rot)) scale(1); }
  100% { transform: rotate(360deg) scale(1.5); }
}

/* Spin out (hover leave) */
@keyframes spinOut {
  0%   { transform: rotate(0deg) scale(1.5); }
  100% { transform: rotate(var(--end-rot)) scale(1); }
}
