.stack-cards-wrapper {
  position: relative;
  width: 100%;
  margin: auto;
}

.stack-card {
  position: absolute;
  top: 0;
  right: 0;
  width: 90%;
  transform-origin: right;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  background: #eff0f0;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border-radius: 32px;
  padding: 32px;
}
/* .stack-card:nth-last-child(n + 5) {
  transform: translate(-50%, 0) scale(0.7);
  opacity: 0;
}
.stack-card:nth-last-child(4) {
  transform: translate(calc(-50% + 120px), 0) scale(0.76);
}
.stack-card:nth-last-child(3) {
  transform: translate(calc(-50% + 60px), 0) scale(0.84);
}
.stack-card:nth-last-child(2) {
  transform: translate(-50%, 0) scale(0.92);
}
.stack-card:nth-last-child(1) {
  transform: translate(calc(-50% - 60px), 0) scale(1);
  z-index: 2;
} */
.stack-card {
  transform: translateX(calc(var(--index) * -40px)) scale(calc(1 - ( ((var(--total-cards) - 1) - var(--index)) * 0.08)));
}
.stack-card:nth-last-child(n + 5) {
  transform: translateX(0) scale(0.7);
  opacity: 0;
}
.stack-card.swap {
  animation: swapCard 0.3s ease forwards;
  pointer-events: none;
}
.stack-card .stack-card-image {
  width: 100%;
  height: 370px;
  overflow: hidden;
  object-position: center;
  border-radius: 32px;
}
.stack-card .stack-card-image img {
  min-height: 100%;
  min-width: auto;
  object-fit: cover;
}
.stack-card-content {
  margin-top: 24px;
}
.stack-card-tag {
  font-size: 16px;
  text-transform: uppercase;
  color: var(--tertiary-color);
  font-weight: 800;
  margin-bottom: 16px;
}
.stack-card-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 16px;
}
.stack-card-description {
  font-size: 16px;
  color: #66696b;
  font-weight: 700;
  margin-bottom: 16px;
}
.stack-card-button {
  color: var(--primary-color);
  background: var(--secondary-color);
  text-decoration: none;
  border-radius: 100%;
  font-weight: 600;
  font-size: 16px;
}
.stack-card .stack-card-next-button {
  position: absolute;
  bottom: 40px;
  right: 60px;
  width: 42px;
  height: 42px;
  background: var(--primary-color);
  border-radius: 100%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stack-card-buttons {
  display: flex;
  gap: 10px;
}
.stack-card-buttons .stack-card-button,
.stack-card-buttons .ressource-youtube-video {
  color: var(--primary-color);
  background: var(--secondary-color);
  text-decoration: none;
  border-radius: 50px;
  font-weight: 800;
  font-size: 20px;
  padding: 12px 40px;
}
.stack-card-buttons .ressource-youtube-video {
  border-color: #0b2c434d;
  background: #fff;
}
@keyframes swapCard {
  0% {
    transform: translateX(calc(var(--index) * -30px)) scale(1);
    opacity: 1;
    filter: blur(0px);
    z-index: 2;
  }
  100% {
    transform: translate(calc(-50% - 280px), -25px) scale(1.1);
    opacity: 0;
    filter: blur(40px);
    z-index: -1;
  }
}
@keyframes swapCardMobile {
  0% {
    transform: translateY(calc(var(--index) * 30px)) scale(1);
    opacity: 1;
    filter: blur(0px);
    z-index: 2;
  }
  100% {
    transform: translateY(280px) scale(1.1);
    opacity: 0;
    filter: blur(40px);
    z-index: -1;
  }
}
@media (max-width: 768px) {
  .stack-card {
    width: 100%;
    transform-origin: top;
    transform: translateY(calc(var(--index) * 30px)) scale(calc(1 - ( ((var(--total-cards) - 1) - var(--index)) * 0.08)));
  }
  .stack-card:nth-last-child(n + 5) {
    transform: translateY(-60px) scale(0.7);
    opacity: 0;
  }
  .stack-card.swap {
    animation: swapCardMobile 0.3s ease forwards;
    pointer-events: none;
  }
  .stack-card .stack-card-image {
    height: 200px;
  }
  .stack-card-buttons {
    flex-direction: column;
    align-items: flex-start;
  }
  .stack-card-buttons .stack-card-button,
  .stack-card-buttons .ressource-youtube-video {
    padding: 12px 20px;
    font-size: 16px;
  }
  .stack-card {
    padding: 20px;
  }
  .stack-card .stack-card-next-button {
    bottom: 20px;
    right: 20px;
  }
}
@media (max-width: 479px) {
  .stack-card .stack-card-image {
    height: 150px;
  }
}