//
// Timeline
// --------------------------------------------------

.timeline {
  $margin: $grid-unit-y * 3;
  $header-width: $grid-unit-x * 7.5 + $margin;

  margin-bottom: $margin;

  &-header {
    font-size: $font-size-large;
    margin-left: $header-width;
    transform: translateX(-50%);
    display: inline-block;

    @include themes(color, color-new-body-light);
  }

  &-group {
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: $margin;

    &:before {
      content: "";
      position: absolute;
      display: block;
      top: 0;
      bottom: 0;
      width: 1px;
      left: $header-width;

      @include themes(background-color, color-new-border);
    }
  }

  &-item {
    display: flex;
    align-items: center;
    margin-bottom: $margin;

    &-header {
      font-size: $font-size-h4;
      font-weight: $font-weight-medium;
      flex: 0 0 $header-width;

      @include themes(color, color-new-heading);
    }

    &-body {
      position: relative;
      padding-left: $margin;
      min-height: $grid-unit-y * 5;
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-width: 0;

      &:before {
        content: "";
        display: block;
        top: 0;
        left: -1px;
        bottom: 0;
        width: 3px;
        background-color: $brand-primary;
        position: absolute;

        @include border-radius(2px);
      }
    }
  }

  &-title {
    line-height: $grid-unit-y * 2.5;

    @include themes(color, color-new-heading);
  }

  &-subtitle {
    line-height: $grid-unit-y * 2.5;

    @include themes(color, color-new-body-light);
    @include text-overflow;
  }

  // Item Color Variations
  &-item {
    &-warning {
      .timeline-item-body:before {
        background-color: $brand-warning;
      }
    }

    &-danger {
      .timeline-item-body:before {
        background-color: $brand-danger;
      }
    }

    &-info {
      .timeline-item-body:before {
        background-color: $brand-info;
      }
    }

    &-success {
      .timeline-item-body:before {
        background-color: $brand-success;
      }
    }
  }

  // Header Width Variations
  &-sm {
    $header-width: $grid-unit-x * 5.5 + $margin;

    .timeline-header {
      margin-left: $header-width;
    }

    .timeline-group {
      &:before {
        left: $header-width;
      }
    }

    .timeline-item-header {
      flex: 0 0 $header-width;
    }
  }
}
