#experience {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: top;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100vh;
  background-color: #e7e5e4;
}

#container-exepriences {
  height: 100vh;
}

.title-experience {
  color: #121516;
  top: 0;
  margin: 0vh 0vh;
}
#timeline {
  display: flex;
  font-family: "Space Mono", monospace;
  padding-bottom: 0;
  &:hover {
    .tl-item {
      width: 23.3333%;
    }
  }
}

.tl-item {
  transform: translate3d(0, 0, 0);
  position: relative;
  width: 33.33333%;
  height: 100%;
  min-height: 75vh;
  color: #121516;
  overflow: hidden;
  transition: width 0.7s ease 0.3s; /* Added 0.3s delay when returning to original width */

  &:before,
  &:after {
    transform: translate3d(0, 0, 0);
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  &:after {
    background: transparentize(#121516, 0.15);
    opacity: 1;
    transition: opacity 0.5s ease;
  }

  &:before {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, #e7e5e4 15%);
    z-index: 1;
    opacity: 0;
    transform: translate3d(0, 0, 0) translateY(0%);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  &:hover {
    width: 55% !important;
    height: 100%;
    &:after {
      opacity: 0;
    }

    &:before {
      opacity: 1;
      transform: translate3d(0, 0, 0) translateY(0);
      transition: opacity 1s ease, transform 1s ease 0.25s;
    }

    .tl-content {
      opacity: 1;
      transform: translateY(0);
      transition: all 0.75s ease 0.5s;
    }

    .tl-bg {
      filter: grayscale(0);
    }
  }
}

.tl-item:hover .tl-year {
  /* years translate animation going top */
  transform: translateX(-50%) translateY(-150%);
  transition: all 1s ease;
}

.tl-item:hover .tl-bg-text {
  /* set invisible  */
  transform: translate3d(0, 0, 0) translateY(100%);
  transition: all 1s ease;
  opacity: 0;
}

.tl-content {
  transform: translate3d(0, 0, 0) translateY(25px);
  position: relative;
  z-index: 1;
  text-align: justify;
  margin: 0 1.618em;
  padding-top: 15%;
  top: 60%;
  opacity: 0;

  h1 {
    text-transform: uppercase;
    color: #121516;
    font-size: 1rem;
    font-weight: bold;
  }

  li {
    font-size: 1.2rem;
    line-height: 1.5;
    list-style: none;
    text-align: center;
    color: #121516;

    &:before {
      content: "•";
      color: #121516; /* Change the color of the bullet point */
      display: inline-block;
      width: 1em; /* Adjust the width to create space for the bullet point */
      margin-left: -1em; /* Adjust the margin to align the text properly */
    }
  }
}

.tl-year {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  text-align: center;
  width: 80%;

  border-top: 1px solid #121516;
  border-bottom: 1px solid #121516;
  padding: 10px 15px;

  p {
    font-size: 1.728rem;
    line-height: 1.5;
    margin: 0;
  }
}

.tl-bg {
  transform: translate3d(0, 0, 0);
  position: absolute;
  width: 100%;
  /* set to column flex */
  gap: 5vh;
  display: flex;
  flex-direction: column;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}

.tl-bg-text {
  top: 0;
  left: 0;
  padding: 0;
  margin: 0;
  gap: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #121516;
  font-size: 1rem;
}
.tl-bg-text h3 {
  margin: 0;
  padding: 0;
  font-size: 1.2rem;
}

.tl-bg-text p {
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}
.tl-bg img {
  width: 40%;
  height: 40%;
  /* padding-top: 25%; */
  /* object-fit: contain;  */
  object-position: center center;
  transition: filter 0.5s ease, transform 0.5s ease;
  filter: grayscale(100%);
  max-width: 100%;
  max-height: 100%;
  filter: brightness(5) invert(1);
}

/* Add custom sizes if needed */
.tl-bg img.contain {
  object-fit: contain;

  object-position: center center;
  max-width: 150px;
  max-height: 150px;
  opacity: 1;
}

/* Mobile Experience Section Styles */
@media (max-width: 768px) {
  /* Experience section container */
  #experience {
    height: auto !important;
    min-height: 100vh;
    width: 100%;
    padding: 20px 0;
  }

  .title-experience {
    padding: 0;
    margin: 20px 0;
  }

  #container-exepriences {
    height: auto;
  }

  /* Timeline container */
  #timeline {
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  /* Timeline items */
  .tl-item {
    width: 100% !important;
    min-height: auto;
    height: auto;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(18, 21, 22, 0.2);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    -webkit-tap-highlight-color: transparent; /* Remove default touch highlight */
  }

  /* Timeline item header - contains logo and year */
  .tl-item-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 10px;
  }

  /* Logo background container */
  .tl-bg {
    position: relative !important;
    height: 60px !important;
    width: 60px !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    vertical-align: middle;
    margin-left: 0 !important;
    flex-shrink: 0;
    background-color: rgba(18, 21, 22, 0.05);
    border-radius: 8px;
    left: 0 !important;
    top: 0 !important;
  }

  /* Logo image */
  .tl-bg img {
    position: static !important;
    filter: grayscale(0) !important;
    filter: brightness(5) invert(1) !important;
    width: 70% !important;
    height: 70% !important;
    object-fit: contain;
    margin: 15px 20px;
  }

  /* Year container */
  .tl-year {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    text-align: left !important;
    border: none !important;
    padding: 0;
    margin-left: 15px !important;
    display: flex;
    width: auto !important;
    vertical-align: middle;
    flex: 1;
  }

  /* Year text */
  .tl-year p {
    font-size: 1.2rem !important;
    margin: 0;
    position: static !important;
    text-align: left !important;
    display: block !important;
  }
  /* Add a red line like in the image */
  .tl-bg-text {
    position: relative;
    padding: 0;
    margin: 10px 0 0 0;
    color: #e53935; /* Red color */
    width: 80%;
    display: inline-block;
    text-align: left;
    font-size: 0.8rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 70%;
    border-top: 2px solid #e53935; /* Add red line above text */
  }

  /* Company name styling */
  .tl-bg-text h3 {
    margin: 5px 0 0 0;
    padding: 0;
    font-size: 0.9rem;
    color: #121516;
    font-weight: bold;
  }

  /* Position title styling */
  .tl-bg-text p {
    margin: 2px 0 0 0;
    padding: 0;
    font-size: 0.75rem;
    color: #121516;
  }

  /* Collapsed state for content */
  .tl-content {
    opacity: 0;
    height: 0;
    overflow: hidden;
    transform: translateY(0) !important;
    top: auto !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
  }

  .tl-content h1 {
    padding: 0;
    margin: 0;
  }

  .tl-content li {
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #121516;
  }

  /* Active state for items when clicked */
  .tl-item.active {
    background-color: rgba(18, 21, 22, 0.05);
    width: 100% !important;
  }

  /* Content in active state */
  .tl-item.active .tl-content {
    opacity: 1;
    height: auto;
    padding: 0 0 0 0 !important;
    margin-top: 5px !important;
    overflow: visible;
    width: 100%;
  }

  /* Remove hover effects on mobile */
  .tl-item:hover {
    width: 100% !important;
  }

  .tl-item:hover .tl-year {
    transform: none !important;
  }

  .tl-item:hover .tl-bg-text {
    transform: none !important;
    opacity: 1;
  }

  /* Remove pseudo elements on mobile */
  .tl-item:before,
  .tl-item:after {
    display: none !important;
  }

  /* Override any hover effects that might interfere with mobile view */
  .tl-item:hover {
    width: 100% !important;
  }

  .tl-item:hover .tl-year,
  .tl-item.active .tl-year {
    transform: none !important;
  }

  /* Prevent any unwanted transitions */
  .tl-item .tl-bg,
  .tl-item .tl-year,
  .tl-item.active .tl-bg,
  .tl-item.active .tl-year {
    transition: none;
  }

  /* Override any absolute positioning for active items */
  .tl-item.active {
    position: relative;
  }
}

/* Tablet responsiveness adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  #timeline .tl-item {
    min-height: 60vh;
  }

  .tl-content {
    padding-top: 10%;
  }
}
