.galeria-superpuesta {
  position: relative;
  width: 100%;
  height: 85vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: visible;
  overflow-y: hidden;
}
.stack-container {
  position: relative;
  width: 98%;
  /*max-width: 900px;*/
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.stack-item {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  transition: transform 1s ease, opacity 1s ease;
  cursor: pointer;
  will-change: transform, opacity;
}

.stack-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  /* box-shadow: 0 20px 40px rgba(0,0,0,0.3); */
  object-fit: cover;
}

/* Rotaciones fijas tipo "Karoverse" */
.stack-item:nth-child(1) { z-index: 6; transform: translate(-50%, -50%) rotate(0deg) scale(1); }
.stack-item:nth-child(2) { z-index: 5; transform: translate(-50%, -50%) rotate(4deg) scale(0.98); }
.stack-item:nth-child(3) { z-index: 4; transform: translate(-50%, -50%) rotate(-5deg) scale(0.97); }
.stack-item:nth-child(4) { z-index: 3; transform: translate(-50%, -50%) rotate(3deg) scale(0.96); }
.stack-item:nth-child(5) { z-index: 2; transform: translate(-50%, -50%) rotate(-4deg) scale(0.95); }
.stack-item:nth-child(6) { z-index: 1; transform: translate(-50%, -50%) rotate(2deg) scale(0.94); }

.stack-item.saliendo {
  opacity: 0;
  transform: translate(-50%, -70%) rotate(10deg) scale(0.9);
}
/* === Transición suave (por defecto) === */
.galeria-superpuesta.transicion-suave .stack-item {
  transition: transform 1s ease, opacity 1s ease;
}

.galeria-superpuesta.transicion-suave .stack-item.saliendo {
  opacity: 0;
  transform: translate(-50%, -70%) rotate(10deg) scale(0.9);
}

/* === Transición rápida tipo Karoverse === */
.galeria-superpuesta.transicion-rapida .stack-item {
  transition: transform 0.35s cubic-bezier(0.5, 0, 0.3, 1), opacity 0.35s cubic-bezier(0.5, 0, 0.3, 1);
}

.galeria-superpuesta.transicion-rapida .stack-item.saliendo {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
}


.galeria-superpuesta.transicion-rapida .stack-item {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: 100%;
  width: auto;
  max-height: 85vh;
  height: auto;
  transform-origin: center center;
  transition: transform 0.35s cubic-bezier(0.5, 0, 0.3, 1), opacity 0.35s cubic-bezier(0.5, 0, 0.3, 1);
  cursor: pointer;
  will-change: transform, opacity;
}
@media(max-width:600px) {
  .galeria-superpuesta {
    height: 40vh;
  }
  .galeria-superpuesta.transicion-rapida .stack-item.horizontal {
    width: 95%;
  }
  .galeria-superpuesta.transicion-rapida .stack-item.vertical {
    width: 65%;
    height: 95%;
    top: 51%;
  }
  .galeria-superpuesta.transicion-rapida .stack-item.vertical img{
    height: 100%;
  }
}

/* Carta que sale: solo cambia opacity y scale, mantiene rotate */
.galeria-superpuesta.transicion-rapida .stack-item.saliendo {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
}

/* ---- Ajuste de proporción dentro de cada carta ---- */
.stack-item.horizontal {
  /*transform: translate(-50%, -50%) scale(3); /* agranda ligeramente la carta */
  transform-origin: center center;
}

.stack-item.horizontal img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.stack-item.vertical img {
  width: auto;
  height: 80vh;
  object-fit: cover;
}
