/* === BASE SLIDER STYLES === */
.carousel-item {
  opacity: 0;
  transition: none !important;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
}
.carousel-item.active {
  opacity: 1;
  position: relative;
  z-index: 2;
}

/* === SCALE UP === */
.carousel-item.scale-up-in {
  animation: scaleUpIn 0.8s ease-in-out forwards;
}
.carousel-item.scale-up-out {
  animation: fadeOutSoft 0.6s ease-in-out forwards;
}
@keyframes scaleUpIn {
  from { transform: scale(1.05); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes fadeOutSoft {
  from { opacity: 1; }
  to   { opacity: 0.3; }
}

/* === FADE IN === */
.carousel-item.fade-in-in {
  animation: fadeIn 0.8s ease-in-out forwards;
}
.carousel-item.fade-in-out {
  animation: fadeOut 0.6s ease-in-out forwards;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* === GO DOWN === */
.carousel-item.go-down-in {
  animation: goDownIn 0.8s ease-in-out forwards;
}
.carousel-item.go-down-out {
  animation: goDownOut 0.6s ease-in-out forwards;
}
@keyframes goDownIn {
  from { transform: translateY(-50%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes goDownOut {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(50%); opacity: 0; }
}

/* === BACK SLIDE === */
.carousel-item.back-slide-in {
  animation: backSlideIn 0.8s ease-in-out forwards;
}
.carousel-item.back-slide-out {
  animation: backSlideOut 0.6s ease-in-out forwards;
}
@keyframes backSlideIn {
  from { transform: translateX(-30%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes backSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(30%); opacity: 0; }
}

/* === BLUR IN === */
.carousel-item.blur-in-in {
  animation: blurInIn 0.8s ease-in-out forwards;
  z-index: 1;
  position: relative;
}
.carousel-item.blur-in-out {
  animation: blurInOut 0.8s ease-in-out forwards;
  z-index: 0;
  position: relative;
  pointer-events: none;
  filter: blur(5px);
  opacity: 0.5 !important;
}
@keyframes blurInIn {
  0% {
    opacity: 0;
    filter: blur(8px);
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
  }
}
@keyframes blurInOut {
  0% {
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    opacity: 0.5;
    filter: blur(8px);
  }
}

/* === GRID REVEAL === */
.grid-reveal-wrapper {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.grid-reveal-cell {
  background-size: 600% 400% !important;
  background-repeat: no-repeat;
  background-position: center;
  animation: revealCell 0.6s forwards;
  opacity: 0;
}
@keyframes revealCell {
  0% {
    transform: scale(1.4);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.grid-reveal-in {
  z-index: 0;
}
.grid-reveal-out {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* === CONTROLES Y CAPTION === */
.carousel-control-prev,
.carousel-control-next {
  z-index: 2;
}
.carousel {
  position: relative;
  background: #5f3184;
}
.carousel-caption {
  position: absolute !important;
  z-index: 99 !important;
  padding: 1rem;
}

/* === RESPONSIVE FIX PARA PROPORCIÓN EN MÓVIL Y EVITAR DISTORSIÓN === */
#header-carousel .carousel-item {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* relación 16:9 */
  overflow: hidden;
}
#header-carousel .carousel-item img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 768px) {
  .grid-reveal-wrapper {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }
  .grid-reveal-cell {
    background-size: 600% 400%; /* 6x4 cuadraditos */
  }
}

