/* Conteneur principal */
.timeline-wrapper {
  overflow: hidden;
}

.timeline-container {
  max-width: 1440px;
  margin: 0 auto;
}

/* ========== SWIPER IMAGES ========== */
.image-swiper {
  perspective: 1440px;
}

.image-swiper::before {
  content: "";
  top: 0;
  bottom: 0;
  border-radius: 300px 300px 0 0;
  width: 31.8%;
  left: 50%;
  position: absolute;
  transform: translate(-50%, 0%);
  border: 2px solid #003a78;
}

@media (max-width: 1024px) {
  .image-swiper::before {
    width: 50%;
  }
}

.image-swiper .swiper-wrapper {
  align-items: center;
}

.image-swiper .swiper-slide {
  /* Transition gérée par JS pour l'animation personnalisée */
  transform-style: preserve-3d;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.image-swiper .swiper-slide-active {
  /*border: 0px solid #003a78;*/
  border-radius: 300px 300px 0 0;
  padding: 20px;
  transition: border-radius 0s, border 1s ease;
}

.image-swiper .swiper-slide-active img {
  aspect-ratio: 1 / 1.3;
}

.image-swiper .swiper-slide-adjacent {
  /*border: 12px solid #003a78;*/
  border-radius: 0;
  padding: 0;
  transition: all 0.5s ease;
}

.image-swiper img {
  width: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center center;
  /* Optimisation GPU pour les animations fluides */
  will-change: transform, opacity;
  transition: all 0.6s ease;
}

/* ========== NAVIGATION ========== */
.nav-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: -2rem;
  margin-bottom: 3rem;
  padding: 0 2rem;
  position: relative;
  z-index: 40;
}

.nav-prev,
.nav-next {
  border: 1px solid #fff !important;
  color: #fff !important;
  font-family: inherit !important;
  font-size: 15px !important;
  width: 45px !important;
  height: 45px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Optimisation pour les interactions */
  will-change: transform, color;
  position: relative;
  overflow: visible;
}

.nav-prev:hover,
.nav-next:hover {
  color: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.5);
  /* transform: scale(1.1); */
}

/*
.nav-prev:active,
.nav-next:active {
  transform: scale(0.95);
}
*/



/* On déclare une propriété animable pour l'angle */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/*
.nav-prev,
.nav-next {
    overflow: visible;
}
*/

/* Contour animé façon horloge */
.nav-prev::after,
.nav-next::after {
  content: "";
  position: absolute;
  inset: -1px;
  /* ajuster selon le design */
  border-radius: 50%;
  /* boutons ronds = horloge */
  padding: 1px;
  /* épaisseur du trait */
  pointer-events: none;
  opacity: 0;

  /* Le tour est géré par l'angle --angle */
  background: conic-gradient(currentColor var(--angle),
      transparent 0deg);

  /* On creuse le centre pour ne garder que le trait circulaire */
  -webkit-mask: radial-gradient(farthest-side,
      transparent calc(100% - 1px),
      #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side,
      transparent calc(100% - 1px),
      #000 calc(100% - 1px));
}

/* Hover */
.nav-prev:hover,
.nav-next:hover {
  border-color: transparent !important;
}

/* Hover : on lance l'animation du tour complet */
.nav-prev:hover::after,
.nav-next:hover::after {
  opacity: 1;
  animation: clock-border 0.4s linear forwards;
}

@keyframes clock-border {
  from {
    --angle: 0deg;
  }

  to {
    --angle: 360deg;
  }
}

/* ========== TIMELINE SECTION ========== */
.timeline-section {
  position: relative;
}

.timeline-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, #006BDE00 0%, #006BDE 10%, #006BDE 90%, #006BDE00 100%);
  border-radius: 2px;
  margin-bottom: -0.8rem;
}

/* ========== SWIPER ANNÉES ========== */
.year-swiper {
  padding-bottom: 1rem;
  padding-top: 0.45rem;
  z-index: 30;
}

.year-swiper .swiper-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  /* Optimisation pour les interactions */
  will-change: transform;
}

.year-dot {
  width: 10px;
  height: 10px;
  background: var(--e-global-color-secondary);
  border-radius: 50%;
  margin-bottom: 1rem;
  transition: all 0.5s ease;
  /* Optimisation GPU */
  will-change: transform, background-color;
}

.year-label {
  font-family: "Cormorant Infant", serif;
  font-size: clamp(30px, 7vw, 80px);
  font-style: italic;
  font-weight: 700;
  line-height: normal;
  color: var(--e-global-color-secondary);
  transition: all 0.5s ease;
  transform-origin: top center;
  /* Optimisation GPU */
  will-change: transform;
}

/* ========== SECTION TEXTE ========== */
.text-section {
  min-height: 200px;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.text-swiper .swiper-slide {
  text-align: center;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.text-title {
  font-family: var(--e-global-typography-accent-font-family), sans-serif;
  font-size: var(--e-global-typography-accent-font-size);
  font-weight: var(--e-global-typography-accent-font-weight);
  line-height: var(--e-global-typography-accent-line-height);
  color: var(--e-global-color-4c1e238);
}

.text-desc {
  color: #FFF;
  font-family: var(--e-global-typography-text-font-family), sans-serif;
  font-size: var(--e-global-typography-text-font-size);
  font-weight: var(--e-global-typography-text-font-weight);
  line-height: var(--e-global-typography-text-line-height);
  max-width: 700px;
  margin: 0 auto;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {

  .image-swiper .swiper-slide-active {
    padding: 20px;
  }

  .nav-buttons {
    padding: 0 1rem;
    margin: 1rem 0;
  }

  .nav-prev,
  .nav-next {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.2rem !important;
  }
}

/* Amélioration des performances sur mobile */
@media (hover: none) and (pointer: coarse) {

  /* Désactiver will-change sur mobile pour économiser les ressources */
  .image-swiper img,
  .year-dot,
  .year-label,
  .nav-prev,
  .nav-next {
    will-change: auto;
  }
}

/* ========== FALLBACK GLOBAL (JS absent ou en échec) ========== */

/* Forcer l'affichage côte à côte si Swiper n'est pas initialisé */
.image-swiper:not(.swiper-initialized) .swiper-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-swiper:not(.swiper-initialized) .swiper-slide {
  flex: 0 0 auto;
  width: 33.333%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Slides latéraux : réduits et gris */
.image-swiper:not(.swiper-initialized) .swiper-slide img {
  transform: scale(0.7);
  opacity: 0.75;
  border: 20px solid #FFF;
  filter: grayscale(1);
  width: 100%;
}

/* Slide du milieu : arche sans bordure blanche */
.image-swiper:not(.swiper-initialized) .swiper-slide:nth-child(4) img {
  transform: scale(1);
  opacity: 1;
  border-radius: 300px 300px 0 0;
  border: 0 !important;
  filter: none;
  aspect-ratio: 1 / 1.3;
}