:root {
  --normal-time: #3498db;
  --upcoming-event: #f39c12;
  --ended-event: #c0392b;
  --ongoing-event: #27ae60;
}

.timeline-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 30px 0 30px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

#timeline-heading {
  position: relative;
  padding: 20px 20px;
  font-weight: 700;
  font-size: 3rem;
  display: grid;
}

#timeline-heading::after {
  position: relative;
  top: 0;
  left: 0;
  content: "";
  width: 100%;
  height: 3px;
  background: black;
}

.timeline-line {
  position: relative;
  height: 4px;
  background: var(--normal-time);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 2px;
}

.timestamp-marker {
  position: relative;
  height: 25px;
  width: 3px;
  background: var(--normal-time);
  border-radius: 0% 0% 100% 100%;
  flex-shrink: 0;
  transform: translateY(45%);
}

.timestamp-label {
  position: absolute;
  top: 25px;
  white-space: nowrap;
  font-size: 13px;
  transform: translateX(-50%);
}

.timestamp-label::after {
  content: " (" attr(data-type) " Day)";
  font-size: 11px;
  color: #777;
}

.time-segment {
  height: 4px;
  flex-shrink: 0;
}

.event-range {
  position: absolute;
  top: 0;
  height: 4px;
  border-radius: 3px;
  pointer-events: none;
  background: linear-gradient(
    to left,
    #ffffff00 0%,
    var(--status-color, #ffffff00) 40%,
    var(--status-color, #ffffff00) 60%,
    #ffffff00 100%
  );
}

.event-range[data-status="upcoming"],
.timeline-item-container.upcoming {
  --status-color: var(--upcoming-event);
}
.event-range[data-status="ended"],
.timeline-item-container.closed {
  --status-color: var(--ended-event);
}
.event-range[data-status="ongoing"],
.timeline-item-container.open {
  --status-color: var(--ongoing-event);
}

.event-range::before {
  position: absolute;
  content: "";
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--status-color);
  transform: translate(-50%, -25%);
}

.event-range::after {
  --height: 25px;
  position: absolute;
  content: "";
  left: 50%;
  width: 2px;
  height: var(--height);
  background-color: var(--status-color);
  transform: translate(-50%, calc(-1.01 * var(--height)));
}

.timeline-items {
  position: relative;
  display: flex;
  height: 140px;
  text-align: center;
  align-items: center;
  justify-content: center;
  padding-top: 175px;
}

.timeline-item-container {
  position: absolute;
  bottom: 25px;
  width: 200px;
  height: 100px;
  text-align: center;
  justify-content: center;
}

.timeline-item h3 {
  position: relative;
  left: 50%;
  color: #34495e;
  width: 150px;
  text-align: center;
  letter-spacing: 0px;
  transform: translate(-50%, 40%);
  transition: transform 0.3s, letter-spacing 0.3s;
}

.timeline-item-container .hovering {
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  opacity: 0;
  transform: translate(0%, 50%);
  transition: opacity 0.3s;
  margin-top: 5px;
}

.timeline-item {
  position: absolute;
  width: 200px;
  height: 100px;
  bottom: 0%;
  color: #555;
  text-align: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--status-color);
  transition: height 0.2s, bottom 0.2s;
}

.timeline-item-container:hover .timeline-item {
  height: 130px;
}

.timeline-item-container:hover .timeline-item h3 {
  transform: translate(-50%, 35%);
  letter-spacing: 0.5px;
}

.timeline-item-container:hover .hovering {
  transform: translateY(73%);
  opacity: 1;
}

.timeline-item-container:hover .hovering:nth-child(2) {
  transition-delay: 0.1s;
  opacity: 1;
}

.timeline-item-container:hover .hovering:nth-child(3) {
  transition-delay: 0.3s;
  opacity: 1;
}

p.status {
  position: absolute;
  left: 50%;
  width: fit-content;
  height: fit-content;
  font-weight: bold;
  transform: translate(-50%);
  bottom: -12.5%;
  margin: 0px;
  background-color: var(--status-color);
  padding: 2px 5px;
  color: #fff;
  border-radius: 4px;
  z-index: 10;
}

.timeline-dates {
  position: relative;
  text-align: center;
  font-size: 14px;
  color: #555;
  height: 120px;
  z-index: 50;
  pointer-events: none;
  transform: translate(0%, -7%);
}

.current-time-wrapper {
  position: absolute;
  top: 0;
  width: 20px;
  height: 140%;
  pointer-events: none;
}

.current-time-wrapper::after {
  content: "";
  position: absolute;
  top: 6%;
  left: 50%;
  width: 2px;
  height: 70px;
  background: #e74c3c;
  transform: translateX(-50%);
  z-index: 1;
}

.current-time-pulse {
  position: absolute;
  top: 2%;
  left: 50%;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background-color: #e74c3c;
  box-shadow: 0 0 0 5px rgba(231, 76, 60, 0.4);
  transform: translate(-50%, -50%);
  z-index: 10;
  animation: pulse 1.5s infinite;
  pointer-events: all;
}

.now-date-label {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  white-space: nowrap;
  background-color: #e74c3c;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 15;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 1199.98px) {
  .timeline-container {
    overflow-y: auto;
    padding: 0px 40px;
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .timeline-line {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 4px;
    height: auto;
    background: var(--normal-time);
    border-radius: 2px;
    margin: 0 35%;
  }

  .timestamp-marker {
    right: 13px;
    width: 30px;
    height: 4px;
    background: var(--normal-time);
    border-radius: 100% 0% 0% 100%;
    position: relative;
    flex-shrink: 0;
  }

  .timestamp-label {
    position: absolute;
    right: 110%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    white-space: nowrap;
  }

  .event-range {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    border-radius: 3px;
    pointer-events: none;
    background: linear-gradient(
      to top,
      #ffffff00 0%,
      var(--status-color, #ffffff00) 40%,
      var(--status-color, #ffffff00) 60%,
      #ffffff00 100%
    );
  }

  .event-range::before {
    position: absolute;
    content: "";
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--status-color);
    transform: translate(-50%, -50%);
  }

  .event-range::after {
    --height: 60px;
    position: absolute;
    top: 50%;
    content: "";
    left: 100%;
    width: var(--height);
    height: 2px;
    background-color: var(--status-color);
    transform: translate(calc(-0.01 * var(--height)), -50%);
  }

  .timeline-items {
    position: relative;
    left: -10%;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    height: auto;
    margin-top: 0;
  }

  .timeline-item-container {
    position: absolute;
    display: flex;
    flex-direction: row;
    align-items: center;
    left: 0%;
    transform: translate(0%, 0%);
    width: auto;
    height: fit-content;
    text-align: center;
    justify-content: center;
  }

  .timeline-item-container .hovering {
    position: relative;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
    opacity: 1;
    transition: none;
    margin-top: 5px;
  }

  p.status {
    position: absolute;
    top: 50%;
    left: -5%;
    width: fit-content;
    height: fit-content;
    font-weight: bold;
    transform: translate(-50%, -50%);
    margin: 0px;
    background-color: var(--status-color);
    padding: 2px 5px;
    color: #fff;
    border-radius: 4px;
    z-index: 20;
  }

  .timeline-item {
    position: relative;
    height: auto;
    width: auto;
    left: 0;
    padding: 20px 30px;
  }

  .timeline-item h3 {
    position: relative;
    width: auto;
    padding: 0px;
    left: 50%;
    color: #34495e;
    margin: 0px;
    text-wrap: nowrap;
    text-align: center;
    transition: none;
  }

  .timeline-item-container:hover .timeline-item {
    height: auto;
  }

  .timeline-item-container:hover .timeline-item h3 {
    transform: translate(-50%, 40%);
    letter-spacing: 0px;
  }

  .timeline-item-container:hover .hovering {
    transform: translate(0%, 50%);
    opacity: 1;
  }

  .timeline-dates {
    position: relative;
    left: -35.25%;

  }

  .current-time-wrapper {
    position: absolute;
    right: 0%;
    transform: translateX(-50%);
    width: 100%;
    height: 20px;
  }

  .current-time-wrapper::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 100px;
    height: 2px;
    background: #e74c3c;
    transform: translateX(-100%);
  }

  .now-date-label {
    left: -100px;
    transform: translate(-50%, -75%);
  }
}
