.carrousel {
  margin-top: -50px;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

.carrousel .thumbnail .item {
  position: absolute;
  width: 150px;
  height: 250px;
  top: 70%;
  transform: translateY(-70%);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  background-position: 50% 50%;
  background-size: cover;
  border-radius: 20px;
  left: 60%;
  z-index: 100;
  transition: 1s;
}

.carrousel .thumbnail .item:nth-child(1) {
  top: 0;
  left: 0;
  transform: translateY(0, 0);
  border-radius: 0;
  width: 100%;
  height: 100%;
  transform: none;
}

.carrousel .thumbnail .item:nth-child(2) {
  left: 57%;
}

.carrousel .thumbnail .item:nth-child(3) {
  left: calc(57% + 180px);
}

.carrousel .thumbnail .item:nth-child(4) {
  left: calc(57% + 360px);
}

.carrousel .thumbnail .item:nth-child(5) {
  left: calc(57% + 540px);
}

.carrousel .thumbnail .item:nth-child(n + 6) {
  left: calc(57% + 720px);
  opacity: 0;
}

.item .content {
  position: absolute;
  top: 50%;
  width: 400px;
  transform: translateY(-50%);
  text-align: left;
  left: 100px;
  color: white;
  display: none;
  background-color: rgba(0, 0, 0, 0.671);
}

.thumbnail .item:nth-child(1) .content {
  display: block;
}

.content .name {
  font-size: 60px;
  font-weight: bold;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 3px 4px 4px rgba(0, 0, 0, 0.8);
  opacity: 0;
  animation: animate 1s ease-in-out 0.6s 1 forwards;
}

.content .describ {
  margin-top: 10px;
  margin-bottom: 20px;
  margin-left: 5px;
  font-size: 20px;
  opacity: 0;
  animation: animate 1s ease-in-out 0.9s 1 forwards;
}

@keyframes animate {
  from {
    opacity: 0;
    transform: translate(0, 100px);
    filter: blur(33px);
  }
  to {
    opacity: 1;
    transform: translate(0);
    filter: blur(0);
  }
}

.carrousel .timeRunning {
  position: absolute;
  z-index: 1000;
  width: 0%;
  height: 4px;
  background: linear-gradient(135deg, #ffd58d, #ffa200, #ff5900);
  left: 0;
  top: 0;
  animation: runningtime 5s linear infinite;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.carrousel:hover .timeRunning {
  opacity: 0.5;
}

@keyframes runningtime {
  0% {
    width: 0%;
  }
  95% {
    width: 100%;
  }
  100% {
    width: 100%;
  }
}

@media screen and (max-width: 999px) {
  header {
    padding-left: 50px;
  }
  .item .content {
    left: 50px;
    width: 200px;
    height: auto;
  }
  .content .name {
    margin-top: 10px;
    margin-left: 10px;
    font-size: 15px;
    text-transform: uppercase;
    line-height: 1;
    animation: animate 1s ease-in-out 0.6s 1 forwards;
  }

  .content .describ {
    margin-top: 10px;
    margin-bottom: 20px;
    margin-left: 5px;
    font-size: 10px;
    animation: animate 1s ease-in-out 0.9s 1 forwards;
  }
}

@media screen and (max-width: 690px) {
  header nav a {
    font-size: 14px;
    margin-right: 0;
  }
  .item .content {
    top: 40%;
  }
  .content .title,
  .content .name {
    font-size: 45px;
  }
  .content .btn button {
    padding: 10px 15px;
    font-size: 14px;
  }
}

.carrousel .container {
  position: absolute;
  transform: translateX(7%);
  left: 50%;
  bottom: 7%;
  width: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
}

.carrousel .container .next {
  padding: 12px 30px;
  border: 2px solid white;
  border-radius: 25px;
  background-color: transparent;
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carrousel .container .next:hover {
  background: linear-gradient(135deg, #ffd58d, #ffa200, #ff5900);
  color: #ffffff;
  border-color: #ffffff;
}

.line {
  flex: 1;
  height: 2px;
  background: linear-gradient(135deg, #ffd58d, #ffa200, #ff5900);
  margin: 0 10px;
}

.number {
  font-size: 1.5rem;
  font-weight: bold;
}

.number h2 {
  margin: 0;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.number h2.active {
  opacity: 1;
}

/* ===== Effet de profondeur & animations avancées ===== */
.carrousel.depth-mode {
  perspective: 1600px;
  perspective-origin: center 50%;
  contain: layout paint;
}

.carrousel.depth-mode .thumbnail .item {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* Empêche les clics pendant l'animation */
.carrousel.depth-animating .next {
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

/* Élément courant qui sort */
.carrousel.depth-animating .thumbnail .item.depth-out {
  animation: carouselDepthOut 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 150;
}

/* Élément suivant qui entre */
.carrousel.depth-animating .thumbnail .item.depth-in {
  animation: carouselDepthIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 200;
  box-shadow: 0 25px 55px -10px rgba(0, 0, 0, 0.55);
}

/* Légère pulsation du bouton après transition */
.carrousel.depth-mode .next:active {
  transform: scale(0.94) translateZ(0);
}
.carrousel.depth-mode .next {
  transition: transform 0.35s cubic-bezier(0.4, 0.12, 0.2, 1), box-shadow 0.4s;
}
.carrousel.depth-mode .next:hover {
  box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.4);
}

/* Keyframes optimisées pour plus de rapidité et fluidité */
@keyframes carouselDepthOut {
  0% {
    transform: none;
    opacity: 1;
    filter: brightness(1) blur(0px);
  }
  30% {
    transform: translate3d(-8%, 0, -200px) rotateY(-15deg) scale(0.9);
    opacity: 0.8;
  }
  70% {
    transform: translate3d(-20%, 0, -400px) rotateY(-30deg) scale(0.7);
    opacity: 0.3;
    filter: brightness(0.85) blur(1px);
  }
  100% {
    transform: translate3d(-30%, 0, -500px) rotateY(-35deg) scale(0.6);
    opacity: 0;
    filter: brightness(0.8) blur(2px);
  }
}

@keyframes carouselDepthIn {
  0% {
    transform: translate3d(45%, -4%, 400px) rotateY(30deg) scale(0.6);
    opacity: 0;
    filter: brightness(0.85) saturate(0.95) blur(2px);
  }
  40% {
    opacity: 0.7;
    transform: translate3d(25%, -2%, 200px) rotateY(18deg) scale(0.8);
    filter: brightness(0.95) saturate(1) blur(1px);
  }
  80% {
    opacity: 0.95;
    transform: translate3d(8%, -1%, 40px) rotateY(6deg) scale(0.95);
    filter: brightness(1) saturate(1.02) blur(0px);
  }
  100% {
    transform: none;
    opacity: 1;
    filter: brightness(1.02) saturate(1.05) blur(0px);
  }
}

/* Transition fluide des miniatures non concernées (léger recul) */
.carrousel.depth-animating
  .thumbnail
  .item:not(.depth-in):not(.depth-out):nth-child(n + 3) {
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
  transform: translateY(-70%) translateX(6%) scale(0.96) translateZ(-40px);
  opacity: 0.8;
  filter: blur(0.2px);
}

.carrousel.depth-animating
  .thumbnail
  .item:not(.depth-in):not(.depth-out):nth-child(n + 6) {
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
  transform: translateY(-70%) translateX(15%) scale(0.8) translateZ(-120px);
  filter: blur(1px);
}

/* Réduction des effets sur mobiles */
@media (max-width: 680px) {
  @keyframes carouselDepthOut {
    0% {
      transform: none;
      opacity: 1;
    }
    60% {
      transform: translate3d(-8%, 0, -260px) scale(0.8);
      opacity: 0.55;
    }
    100% {
      transform: translate3d(-12%, 0, -380px) scale(0.65);
      opacity: 0;
    }
  }
  @keyframes carouselDepthIn {
    0% {
      transform: translate3d(40%, 0, 260px) scale(0.6);
      opacity: 0;
    }
    60% {
      transform: translate3d(10%, 0, 60px) scale(0.92);
      opacity: 1;
    }
    100% {
      transform: none;
      opacity: 1;
    }
  }
}

/* Respect des préférences d’accessibilité */
@media (prefers-reduced-motion: reduce) {
  .carrousel.depth-mode * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
