$max-image-height: 600px;
$max-copy-height: 200px;
$min-event-height: $max-image-height + $max-copy-height;
$dual-min-width: 600px;
$max-width: 1600px;
$arrow-width: 5%;
$event-width: 45%;
$label-radius: 3em;
$padding: 0.5em;
$radius: 0.35em;
$dot-radius: 5%;
$arrow-offset: 20px;
$fade-height: 80px;
$text-color: #313740;
$label-color: lighten(#2d384b, 15%);
$event-color: #f0f0f0;
$button-color: #5592cb;
$header-color: lighten(#2d384b, 30%);
$transparent-white: rgba(255, 255, 255, 0);

*,
*:after,
*:before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
p {
  margin: 0;
  padding: 0;
}

h2 {
  font-size: 1.75em;
}

.rt-timeline-container {
  padding: 1em;
  justify-content: center;
  align-items: center;
  display: flex;
}

.rt-timeline {
  max-width: $max-width;
  padding: 0em;
  list-style-type: none;
  background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNi0wNC0wM1QyMzowNDo4MjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjQuMjwveG1wOkNyZWF0b3JUb29sPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj41PC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0PgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+NzI8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj45PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj45PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Cux0bOIAAABoSURBVBgZY2CgFmCEGVRYWCjk5ORUwcbG5vrr16/d+/bt6+jv738HkmeCKYIqKAXyDYAKS0F8mBxcEcgEmCCIRubDFYGsQFaEzGeGSUhISJyVk5NjYmZm5gYqWAxy04kTJ77D5KlDAwD54yLs/6kqyAAAAABJRU5ErkJggg==');
  background-repeat: repeat-y;
  background-position: 50% 0;
}

.rt-label-container {
  clear: both;
  margin: 1em auto 1em auto;
  display: flex;
  justify-content: center;

  &:first-of-type {
    margin-top: 0 !important;
  }

  &:last-of-type {
    margin-bottom: 0;
  }
}

.rt-label {
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  border-radius: 50%;
  background: $label-color;
  font-size: 2em;
  box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4);
  width: $label-radius;
  height: $label-radius;
}

.rt-clear {
  clear: both;
}

.rt-backing {
  border-radius: $radius;
  background: $event-color;
  color: $text-color;
  box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4);
}

.rt-event {
  position: relative;
  float: right;
  clear: right;
  width: $event-width;
  margin-top: 2em;
  margin-left: 0;
  margin-right: 0;
  list-style-type: none;
  display: block;
  min-height: $min-event-height;
  @media all and (max-width: $dual-min-width) {
    min-height: auto;
    width: 85%;    
    svg {
      display: none;
    }

    .rt-dot {
      display: none;
    }
  }

  .rt-dot {
    position: absolute;
    margin-top: $arrow-offset;
    left: -(11% + ($dot-radius * 0.5));
    right: auto;
    fill: currentcolor;
    color: $header-color;
    width: $dot-radius;
    z-index: 100;
  }

  .rt-svg-container {
    position: relative;

    svg {
      transform: scale(-1, 1);
    }

    .rt-arrow {
      z-index: 100;
      position: absolute;
      margin-top: $arrow-offset;
      left: -($arrow-width);
      right: auto;
      fill: currentcolor;
      width: $arrow-width + 0.25%;
      color: $header-color;
    }
  }

  &:nth-of-type(2n) {
    float: left;
    clear: left;
    text-align: right;

    svg {
      transform: scale(1, 1);
    }

    .rt-arrow {
      left: auto;
      right: -$arrow-width;
    }

    .rt-dot {
      left: auto;
      right: -(11% + ($dot-radius * 0.5));
    }
  }
}

li:nth-child(3) {
  margin-top: ($max-copy-height + $max-image-height) * 0.5;

  @media all and (max-width: $dual-min-width) {
    margin-top: 1em;
  }
}

.rt-title {
  margin: 4px;
  font-weight: bold;
}

.rt-date {
  margin: 4px;
  font-weight: normal;
}

.rt-header-container {
  color: white;
  padding: $padding * 0.5;
  background-color: $header-color;
  border-radius: $radius $radius 0 0;
  overflow: hidden;
}

.rt-image-container {
  padding: 0;
  overflow: hidden;
}

.rt-image {
  vertical-align: top;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: $max-image-height;
  object-fit: contain;
}

.rt-footer-container {
  padding: $padding;
  justify-content: center;
  align-items: center;
  display: flex;
  overflow: hidden;
}

.rt-btn {
  text-align: center;
  background-color: $text-color;
  font-size: 1.5em;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: $radius;
  padding: $padding;
  width: 100%;
  color: white;
  text-decoration: none;
}

.rt-text-container {
  padding: $padding;
  max-height: $max-copy-height;
  font-weight: lighter;
  overflow: hidden;
  text-overflow: ellipsis;
  content: '';
  position: relative;
  text-align: left;
}

.rt-text-container:before {
  content: '';
  font-weight: lighter;
  width: 100%;
  height: $fade-height;
  position: absolute;
  left: 0;
  top: $max-copy-height - $fade-height;
  background: transparent;
  background: -webkit-linear-gradient($transparent-white, $event-color); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient($transparent-white, $event-color); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient($transparent-white, $event-color); /* For Firefox 3.6 to 15 */
  background: linear-gradient($transparent-white, $event-color); /* Standard syntax */
}
