
/* Mobile menu toggle button */

.main-menu-btn {
  float: right;
  margin: 6px 10px;
  position: relative;
  display: inline-block;
  width: 29px;
  height: 29px;
  text-indent: 29px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}


/* hamburger icon */

.main-menu-btn-icon,
.main-menu-btn-icon:before,
.main-menu-btn-icon:after {
  position: absolute;
  top: 50%;
  left: 2px;
  height: 2px;
  width: 24px;
  background: #555;
  -webkit-transition: all 0.25s;
  transition: all 0.25s;
}

.main-menu-btn-icon:before {
  content: '';
  top: -7px;
  left: 0;
}

.main-menu-btn-icon:after {
  content: '';
  top: 7px;
  left: 0;
}


/* x icon */

#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon {
  height: 0;
  background: transparent;
}

#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before {
  top: 0;
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
}

#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after {
  top: 0;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}


/* hide menu state checkbox (keep it visible to screen readers) */

#main-menu-state {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}


/* hide the menu in mobile view */

#main-menu-state:not(:checked) ~ #main-menu {
  display: none;
}

#main-menu-state:checked ~ #main-menu {
  display: block;
}

@media (min-width: 768px) {
  /* hide the button in desktop view */
  .main-menu-btn {
    position: absolute;
    top: -99999px;
  }
  /* always show the menu in desktop view */
  #main-menu-state:not(:checked) ~ #main-menu {
    display: block;
  }
}

/* ========================= */
* apply the animations just in desktop view */

@media (min-width:768px) {
  /* prevent text rendering degrade during animation in Mac browsers */
  #main-menu {
    -webkit-font-smoothing: subpixel-antialiased;
  }
  /* show animation */
  #main-menu ul.show-animation {
    -webkit-animation: show-animation 0.2s;
    animation: show-animation 0.2s;
  }
  @-webkit-keyframes show-animation {
    0% {
      -webkit-transform: scale3d(0, 0, 1);
      opacity: 0;
    }
    60% {
      -webkit-transform: scale3d(1.05, 1.05, 1);
    }
    100% {
      -webkit-transform: scale3d(1, 1, 1);
      opacity: 1;
    }
  }
  @keyframes show-animation {
    0% {
      transform: scale3d(0, 0, 1);
      opacity: 0;
    }
    60% {
      transform: scale3d(1.05, 1.05, 1);
    }
    100% {
      transform: scale3d(1, 1, 1);
      opacity: 1;
    }
  }
  /* hide animation */
  #main-menu ul.hide-animation {
    -webkit-animation: hide-animation 0.2s;
    animation: hide-animation 0.2s;
  }
  @-webkit-keyframes hide-animation {
    0% {
      -webkit-transform: scale3d(1, 1, 1);
      opacity: 1;
    }
    100% {
      -webkit-transform: scale3d(0, 0, 1);
      opacity: 0;
    }
  }
  @keyframes hide-animation {
    0% {
      transform: scale3d(1, 1, 1);
      opacity: 1;
    }
    100% {
      transform: scale3d(0, 0, 1);
      opacity: 0;
    }
  }
}


