/* @horizontal-timeline */

.horizontal-timeline {
  background-color: $astronaut;
  position: relative;
  overflow: hidden;

  @include poly-padding--large;

  .horizontal-timeline__bg {
    background-size: cover !important;
    background-position: center center !important;
    transition: 0.7s;
    width: 120%;
    height: 120%;
    position: absolute;
    left: 0;
    top: 0;
  }

  &::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    z-index: 0;
    background-image: linear-gradient(to top, rgba(57, 51, 84, 0.3), #04032a);
  }

  h2 {
    color: white;
    font-size: 30px;
    position: relative;
    z-index: 1;

    @include poly-margin--large;

    @media (min-width: $medium-screen) {
      @include poly-padding-left--large;
    }
  }

  .timeline-slider {
    position: relative;
    z-index: 1;

    @include poly-margin--large;

    &__carousel {
      max-width: 1024px;
      margin: 0 auto;
    }

    .flickity-viewport {
      box-sizing: unset;
      background-color: white;
      padding: 0;
      box-shadow: rgba(0, 0, 0, 0.7) 5px 5px 20px;

      @media (min-width: $medium-screen) {
        background-color: transparent;
        padding: 20px;
        box-shadow: none;
      }
    }

    .slide {
      transition: $transition-basic;
      width: 100%;
      height: 450px;

      @media (min-width: $medium-screen) {
        width: 300px;
        height: 637px;
      }

      .timeline-pod {
        height: 100%;
        display: flex;
        flex-direction: column;

        &__title,
        &__content {
          height: 50%;
          flex-grow: 1;
          display: flex;
          flex-direction: column;
          color: black;
          transition: $transition-basic;

          @media (min-width: $medium-screen) {
            color: white;
          }

          @include poly-padding--large;
        }

        &__read-more {
          margin-left: -1.5rem;
        }

        &__image {
          margin: 0.5em 0;
          width: 100%;
          opacity: 0;
          transition: 0.3s;
        }

        &__popup {
          visibility: hidden;
        }

        &__title {
          flex-direction: column-reverse;
          font-size: 20px;
          font-family: 'Biryani', sans-serif;
          font-weight: 900;
          line-height: 1.2;

          img {
            width: 100%;
          }
        }

        &__content {
          border-left: 1px solid rgba(255, 255, 255, 0.4);

          p {
            font-size: 14px;
          }
        }

        &.reverse {
          .timeline-pod__content {
            order: -1;
          }

          .timeline-pod__title {
            order: 2;
            align-items: flex-start;
            .title {
              margin-bottom: auto;
            }
          }
        }

        .progress-bar {
          width: 100%;
          height: 3px;
          box-shadow: rgba(255, 255, 255, 0.7) 3px 0 10px;
          background: $blue-ribbon;
          position: relative;
          overflow: hidden;

          @media (max-width: $medium-screen) {
            box-shadow: rgba(0, 111, 238, 0.7) 3px 0 10px;
          }

          @media (min-width: $medium-screen) {
            background: white;
          }

          &::after {
            content: '';
            width: 0;
            height: 100%;
            background-color: $blue-ribbon;
            display: block;
            transition: $transition-basic;
          }
        }

        .active-dot {
          width: 40px;
          height: 40px;
          border: 1px solid rgba(0, 111, 238, 0.1);
          border-radius: $border-radius-circle;
          position: absolute;
          top: 50%;
          transform: translate(-50%, -50%);
          transition: $transition-basic;
          z-index: 5;
          opacity: 0;

          @include poly-margin-left--large;

          &::before {
            content: '';
            width: 24px;
            height: 24px;
            border: 1px solid rgba(0, 111, 238, 0.3);
            border-radius: $border-radius-circle;
            display: block;
            margin-top: 6px;
            margin-left: 6px;
          }

          span {
            border: 2px solid $blue-ribbon;
            background-color: white;
            border-radius: $border-radius-circle;
            box-shadow: rgba(0, 111, 238, 0.7) 1px 1px 10px;
            display: block;
            width: 14px;
            height: 14px;
            position: absolute;
            top: 12px;
            left: 12px;
          }
        }
      }

      &:first-child {
        .progress-bar {
          @include poly-margin-left--large;

          width: calc(100% - #{$small-spacing*2});

          @media (min-width: $medium-screen) {
            width: calc(100% - #{$base-spacing*2});
          }
        }

        .timeline-pod__content {
          border-left: none;
        }
      }

      &:last-child {
        .progress-bar {
          @include poly-margin-right--large;

          width: calc(100% - #{$small-spacing*2});

          @media (min-width: $medium-screen) {
            width: calc(100% - #{$base-spacing*2});
          }
        }
      }

      &:not(.is-selected) {
        .cta {
          &__label {
            color: white;
          }

          svg {
            fill: white;
          }
        }
      }

      &.is-selected {
        background-color: white;

        .timeline-pod__image {
          opacity: 1;
        }


        @media (min-width: $medium-screen) {
          box-shadow: rgba(0, 0, 0, 0.7) 5px 5px 20px;
        }

        .timeline-pod__content {
          color: $blue-ribbon;
        }

        .timeline-pod__title {
          font-size: 30px;
          color: $blue-ribbon;
        }

        .progress-bar {
          box-shadow: rgba(0, 111, 238, 0.7) 3px 0 10px;

          &::after {
            width: 100%;
          }
        }

        .active-dot {
          opacity: 1;
        }
      }

      &.has-been {
        .progress-bar {
          box-shadow: rgba(0, 111, 238, 0.7) 3px 0 10px;

          &::after {
            width: 100%;
          }
        }
      }
    }
  }
}
