/* -- The root styles must go in the element of the structure with the name "Row". --*/

.timeline-2__row {
  --speech-bubble-width: 1.4rem;
  --speech-bubble-color: var(--dark-5);

  .card-timeline-2 {
    /* Speech bubble in card */
    &:after {
      content: "";
      position: absolute;
      display: block;
      width: 0;
      z-index: 1;
      border-style: solid;
      border-color: transparent var(--speech-bubble-color);
      border-width: var(--speech-bubble-width) var(--speech-bubble-width)
        var(--speech-bubble-width) 0;
      top: 50%;
      left: calc(-1 * var(--speech-bubble-width));
      margin-block-start: calc(-1 * var(--speech-bubble-width));
    }
  }

  /* Styles applied to all even elements */
  &:nth-child(even) {
    .timeline-2__empty {
      order: 3;
    }

    /* Styles for aligning text and content to the right */
    .card-timeline-2 {
      order: 1;
      text-align: end;

      /* Speech bubble */
      &:after {
        left: auto;
        right: calc(-1 * var(--speech-bubble-width));
        border-width: var(--speech-bubble-width) 0 var(--speech-bubble-width)
          var(--speech-bubble-width);
      }

      .card-timeline-2__container {
        align-items: end;
      }

      /* Styles in tablet and restore styles */
      @media (max-width: 767px) {
        text-align: start;

        .card-timeline-2__container {
          align-items: inherit;
        }

        &:after {
          left: calc(-1 * var(--speech-bubble-width));
          right: auto;
          border-width: var(--speech-bubble-width) var(--speech-bubble-width)
            var(--speech-bubble-width) 0;
        }
      }
    }
  }

  /* You can remove this style if you do not want the line to disappear on the first and last element. */
  &:first-child {
    .timeline-2__line {
      top: auto;
      bottom: calc(-1 * var(--space-3xl));
      height: calc(50% + var(--space-3xl));
    }
  }

  &:last-child {
    .timeline-2__line {
      height: 50%;
    }
  }
}
