section#timeline {
  width: 80%;
  margin-top: 5%;
  margin-left: 10%;
  margin-right: 10%;
  position: relative;
  display: grid;
}
section#timeline:before {
  content: "";
  display: block;
  position: absolute;
  left: 50%;
  top: 0;
  margin: 0 0 0 -1px;
  width: 2px;
  height: 100%;
  background: var(--white);
  z-index: -1;
}

section#timeline article {
  margin-top: 20px;
  width: 100%;
  position: relative;
  display: grid;
  grid-template-columns: 4fr 1fr 4fr;

  border-radius: 12px;
  z-index: 0;

  &:hover {
    section.card::before {
      transform: scale(100);
    }
    section.card p {
      color: var(--white);
    }
    span.timePeriod {
      background-color: var(--wheat);
      color: var(--black);
      transition: background-color 500ms ease-in, color 500ms linear;
    }
  }
}

section#timeline article span.timePeriod {
  background-color: var(--black);
  color: var(--white);
  border-radius: 6px;
  margin-left: 5px;
  margin-top: 15px;
  padding: 10px;
  justify-self: start;
  align-self: start;
  transition: all 0.2s ease-in-out;
}

section#timeline article section.card {
  width: 90%;
  margin-left: 5%;
  background-color: var(--wheat);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  &::before {
    content: "";
    z-index: 0;
    display: block;
    position: relative;
    top: 50px;
    width: 100%;
    height: 5px;
    transform: scale(1);
    transition: transform 0.5s linear;
  }
}

section#timeline article span.date {
  display: block;
  width: 60px;
  height: 50px;
  padding: 5px 0;
  margin-top: 10px;
  border-radius: 100%;
  font-size: 12px;
  font-weight: 900;
  background: var(--gray);
  color: var(--white);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 7px var(--white);
  justify-self: center;
}
section#timeline article span.date i {
  margin: 4px 0 0 12px;
}

section#timeline article h2 {
  padding: 15px;
  margin-top: -5px;
  color: var(--white);
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: -1px;
  border-radius: 12px 12px 0 0;
  position: relative;
}

section#timeline article p {
  padding: 15px;
  margin: 0;
  font-size: 14px;
  color: var(--gray);
  border-radius: 0 0 12px 12px;
  position: relative;
  transition: all 0.75s linear;
}
section#timeline article:nth-child(2n + 2) {
  section.card {
    margin-left: 5%;
  }
  span.timePeriod {
    margin-right: 5px;
    justify-self: end;
    transition: all 0.2s ease-in-out;
  }
  h2:after {
    left: -5px;
  }
}
section#timeline article:nth-child(1) {
  section.card::before {
    background: var(--orange);
  }
  section.card h2 {
    background: var(--orange);
  }
  section.card h2::after {
    background: var(--orange);
  }
}
section#timeline article:nth-child(2) {
  section.card::before {
    background: var(--orange);
  }
  h2 {
    background: var(--orange);
  }
  h2:after {
    background: var(--orange);
  }
}
section#timeline article:nth-child(3) {
  section.card::before {
    background: var(--orange);
  }
  h2 {
    background: var(--orange);
  }
  h2:after {
    background: var(--orange);
  }
}
section#timeline article:nth-child(4) {
  section.card::before {
    background: var(--orange);
  }
  h2 {
    background: var(--orange);
  }
  h2:after {
    background: var(--orange);
  }
}

@media (max-width: 900px) {
  section#timeline:before {
    left: 20px;
  }
  section#timeline article {
    display: flex;
    flex-direction: column-reverse;
  }
  section#timeline article:nth-child(2n + 2) {
    display: flex;
    flex-direction: column;

    section.card {
      margin: 20px 0 0 90px;
    }
  }
  section#timeline article span.date {
    position: absolute;
    bottom: 75%;
    left: -9px;
  }
  section#timeline article span.timePeriod {
    margin: 0 0 0 0;
    position: relative;
    left: 90px;
  }
  section#timeline article section.card {
    position: relative;
    width: 75%;
    margin-top: 20px;
    margin-left: 90px;
  }
}
