#menuToggle {
  display: block;
  position: absolute;
  padding: 20px;
  top: 0px;
  left: 0px;

  z-index: 1;

  -webkit-user-select: none;
  user-select: none;
}

#menuToggle a {
  text-decoration: none;

  transition: color 0.3s ease;
}

#menuToggle a:hover {
  color: tomato;
}

#menuToggle .menuCheckbox {
  margin: 20px 20px 20px 20px;
  display: block;
  width: 40px;
  height: 32px;
  position: absolute;
  top: -7px;
  left: -5px;

  cursor: pointer;

  opacity: 0; /* hide this */
  z-index: 2; /* and place it over the hamburger */

  -webkit-touch-callout: none;
}

/*
 * Just a quick hamburger
 */
#menuToggle span {
  display: block;
  width: 33px;
  height: 4px;
  margin-bottom: 5px;
  position: relative;
  background: var(--text-colour);

  border-radius: 3px;

  z-index: 1;

  transform-origin: 4px 0px;

  transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1),
    background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1), opacity 0.55s ease;
}

#menuToggle span:first-child {
  transform-origin: 0% 0%;
}

#menuToggle span:nth-last-child(2) {
  transform-origin: 0% 100%;
}

/* 
 * Transform all the slices of hamburger
 * into a crossmark.
 */
#menuToggle .menuCheckbox:checked ~ span {
  opacity: 1;
  transform: rotate(45deg) translate(-2px, -1px);
}

/*
 * But let's hide the middle one.
 */
#menuToggle .menuCheckbox:checked ~ span:nth-last-child(3) {
  opacity: 0;
  transform: rotate(0deg) scale(0.2, 0.2);
}

/*
 * Ohyeah and the last one should go the other direction
 */
#menuToggle .menuCheckbox:checked ~ span:nth-last-child(2) {
  transform: rotate(-45deg) translate(0, -1px);
}

/*
 * Make this absolute positioned
 * at the top left of the screen
 */
#menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  width: 400px;
  right: 72px;
  margin: 0;
  padding: 0;

  background-color: #303134;

  list-style-type: none;
  -webkit-font-smoothing: antialiased;
  /* to stop flickering of text in safari */
  transform: none;
  transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
}

/*
 * And let's slide it in from the left
 */
#menuToggle .menuCheckbox:checked ~ div {
  transform-origin: 0% 0%;
  transform: translate(100%, 0);
}

@media (max-width: 1000px) {
  #menuToggle .menuCheckbox {
    width: 38px;
    height: 26px;
    margin: 0;
    left: 0;
  }
  #menuToggle {
    padding: 2px;
  }
  #menu {
    right: 36px;
  }
}
@media (max-width: 400px) {
  #menu {
    width: 100vw;
  }
}
