
#timeline {
  display: flex;
  background-color: #031625;
  padding:0px;
}

/* Al hacer hover en el contenedor, cada item no cambia su tamaño base */
#timeline:hover .tl-item {
  width: 33.3333%;
}

.tl-item {
  transform: translate3d(0, 0, 0);
  position: relative;
  width: 33.3333%; /* ✅ Cambiado para 3 elementos */
  height: 100vh;
  min-height: 600px;
  color: #fff;
  overflow: hidden;
  transition: width 0.5s ease;
}

.tl-item:before, 
.tl-item:after {
  transform: translate3d(0, 0, 0);
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.tl-item:after {
  background: rgb(11 93 89 / 82%);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.tl-item:before {
  /*background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, black 75%);*/
  background: linear-gradient(-45deg, rgba(70,193,242,0.85), rgba(0,154,218,0.85), rgba(57,110,175,0.85), rgba(39,80,155,0.85));

  /*background: #000000bd;*/
  z-index: 1;
  opacity: 0;
  transform: translate3d(0, 0, 0) translateY(50%);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

/* Al hacer hover en cada item */
.tl-item:hover {
  width: 40% !important; /* ✅ Ajustado para que el item activo se destaque más */
}

.tl-item:hover:after {
  opacity: 0;
}

.tl-item:hover:before {
  opacity: 1;
  transform: translate3d(0, 0, 0) translateY(0);
  transition: opacity 1s ease, transform 1s ease 0.25s;
}

.tl-item:hover .tl-content {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.75s ease 0.5s;
}

.tl-item:hover .tl-bg {
  filter: grayscale(0);
}

.tl-content {
  transform: translate3d(0, 0, 0) translateY(25px);
  position: relative;
  z-index: 1;
  text-align: center;
  margin: 0 1.618em;
  top: 50%;
  opacity: 0;
}



.tl-year {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  z-index: 1;
  border-top: 1px solid #fff;
  border-bottom: 1px solid #fff;
  text-align:center;
	padding:10px;
}

.tl-year p {
 
  font-size: 2.5rem;
  /*line-height:50px;*/
  font-weight:900;
  
}

.tl-year p span {
 
  font-size: 1.2rem;
  font-weight:900;
  color:#f1ab3e;
  
}

.tl-bg {
  transform: translate3d(0, 0, 0);
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-size: cover;
  background-position: center center;
  transition: filter 0.5s ease;
  filter: grayscale(100%);
}


@media (max-width: 768px) {
  #timeline {
    flex-direction: column;
  }

  .tl-item {
    width: 100% !important;
    height: auto;
    min-height: 400px;
  }

  /* ✅ Corregir que no se achique al hacer hover en móvil */
  .tl-item:hover {
    width: 100% !important; 
  }

  /* Mantener el efecto de aparición de imagen */
  .tl-content {
    top: 35px;
    transform: translateY(25px);
    opacity: 0;
    transition: all 0.75s ease 0.5s;
    padding: 1rem;
  }

  .tl-item:hover .tl-content {
    opacity: 1;
    transform: translateY(0);
  }

  /* ✅ Año centrado y visible */
  .tl-year {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    z-index: 2;
  }

  .tl-year p {
    font-size: 2rem;
    line-height: 1;
    color: #fff;
    text-align: center;
  }

  /* ✅ Imagen de fondo y efecto */
  .tl-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%);
    z-index: 0;
  }

  .tl-item:hover .tl-bg {
    filter: grayscale(0);
  }
}

/* ===== EFECTO AUTOMÁTICO SOLO EN PANTALLAS PEQUEÑAS ===== */
@media (max-width: 768px) {
  .tl-item.active:after {
    opacity: 0;
  }

  .tl-item.active:before {
    opacity: 1;
    transform: translate3d(0, 0, 0) translateY(0);
    transition: opacity 1s ease, transform 1s ease 0.25s;
  }

  .tl-item.active .tl-content {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.75s ease 0.5s;
  }

  .tl-item.active .tl-bg {
    filter: grayscale(0);
  }

  #timeline {
    flex-direction: column;
  }

  .tl-item {
    width: 100% !important;
    height: auto;
    min-height: 100vh;
	text-align:center;
  }

  .tl-item.active, 
  .tl-item:hover {
    width: 100% !important;
	text-align:center;
  }

  .tl-year {
    position: relative;
    top: 30px;;
    left: auto;
    transform: none;
    margin: 2rem auto;
    text-align: center;
    display: inline-block;
	margin:0 auto;
  }
}


/* ✅ Centrado limpio al hacer hover */
.tl-item:hover {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* ✅ Anular posición previa del contenido cuando se muestre */
.tl-item:hover .tl-content {
  opacity: 1;
  transform: none;      /* ❌ elimina el translateY original */
  top: auto;            /* ❌ anula el 55% original */
  position: relative;   /* mantiene el flujo natural */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  margin: 0 auto;
}

/* ✅ Imagen bien centrada y tamaño controlado */
.tl-item:hover .tl-content img {
  display: block;
  margin: 1rem auto 0 auto; /* pequeño espacio con el título */
  max-width: 90%;
  height: auto;
}

/* ✅ Año centrado */
.tl-item:hover .tl-year {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin-bottom: 1.5rem;
}
