@import url("https://fonts.googleapis.com/css?family=Varela+Round");

:root {
  --GAP: 15px;
  --WHITE: #FBFBFB;
  --BACKGROUND: linear-gradient(to bottom, #2C3531, #116466, #2c2c2c);
  --COLOR1: #029ece;
  --COLOR1g: #00868f;
  --COLOR2: #020086;
  --COLOR2g: #0097d3;
  --COLOR3: #2b48ec;
  --COLOR3g: #8e6fff;
  --COLOR4: #7595ff;
  --COLOR4g: #008d92;
  --COLOR5: #00bd8e;
  --COLOR5g: #0084b8;
}

* {
  box-sizing: border-box;
}

.menu > ol > li {
  cursor: pointer;
}

.menu > ol > li:hover .sub-menu,
.menu > ol > li:focus .sub-menu {
  max-height: 500px;
}

nav {
  top: -20px;
  left: 0%;
  right: 0%;
  position: fixed;
  z-index: 100;
  background-image: var(--gradient-color);
  margin-top: 5%;
  border-radius: 15px;
  width: 95%;
}

a:focus {
  outline: none;
  position: relative;
}

a:after {
  content: "";
  background: var(--WHITE);
  position: absolute;
  bottom: 5px;
  left: var(--GAP);
  height: 3px;
  width: 0;
  transition: 0.5s;
  transition-delay: 0.2s;
}

body {
  background: var(--BACKGROUND);
  font-family: "Varela Round", Nunito, Montserrat, sans-serif;
  margin: 0;
  padding: 0;
}

.menu {
  margin: var(--GAP);
}

.menu > ol {
  list-style: none;
  margin: calc(var(--GAP) * 2) 0;
  padding: 0;
}

.menu > ol > li {
  border-left: 5px solid var(--gradient-color);
  margin-bottom: 1px;
  position: relative;
  transition: 0.5s;
}

.menu > ol > li:nth-child(1) {
  --accent-color: var(--COLOR1);
  --gradient-color: var(--COLOR1g);
}

.menu > ol > li:nth-child(2) {
  --accent-color: var(--COLOR2);
  --gradient-color: var(--COLOR2g);
}

.menu > ol > li:nth-child(3) {
  --accent-color: var(--COLOR3);
  --gradient-color: var(--COLOR3g);
}

.menu > ol > li:nth-child(4) {
  --accent-color: var(--COLOR4);
  --gradient-color: var(--COLOR4g);
}

.menu > ol > li:nth-child(5) {
  --accent-color: var(--COLOR5);
  --gradient-color: var(--COLOR5g);
}

.menu > ol > li a {
  color: var(--WHITE);
  display: block;
  padding: var(--GAP);
  position: relative;
  text-decoration: none;
  z-index: 1;
}

.menu > ol > li a:not(:last-child):before {
  content: "\f078";
  font-family: fontAwesome;
  font-size: 0.75em;
  line-height: 50px;
  position: absolute;
  right: 25px;
  top: 0;
  bottom: 0;
  margin: auto;
  transition: 0.5s;
}

.menu > ol > li:focus,
.menu > ol > li:hover {
  z-index: 100;
  transform: scale(1.1);
}

.menu > ol > li:focus:after,
.menu > ol > li:hover:after {
  background: linear-gradient(to left, var(--accent-color), var(--gradient-color));
  max-width: 800px;
}

.menu > ol > li:focus .sub-menu,
.menu > ol > li:focus-within .sub-menu {
  max-height: 500px;
}

.menu > ol > li:focus a:before,
.menu > ol > li:focus-within a:before {
  transform: rotate(-180deg);
}

.menu > ol > li:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transition: 0.5s;
  max-width: 0;
  overflow: hidden;
}

.menu .sub-menu {
  border-left: 1px solid var(--WHITE);
  margin-left: calc(var(--GAP) * 1.5);
  list-style: none;
  max-height: 0px;
  overflow: hidden;
  padding-left: calc(var(--GAP) / 2);
  position: relative;
  transition: 0.5s;
  z-index: 1;
}

.menu .sub-menu li {
  font-size: 0.9em;
}

.menu .sub-menu li a:after {
  bottom: 5px;
  height: 1px;
}

.menu .sub-menu li a:hover:after,
.menu .sub-menu li a:focus:after {
  width: 15px;
}

@media (min-width: 767px) {
  a:focus:after,
  a:hover:after {
    width: 50px;
  }

  nav {
    top: -20px;
    left: 0;
    right: 0;
    --GAP: 10px;
    width: 100%;
  }

  a:after {
    left: 0;
    right: 0;
    margin: auto;
  }

  .menu {
    margin: 0;
    margin-top: 0vh;
  }

  .menu > ol {
    display: block;
    max-width: none;
    text-align: center;
  }

  .menu > ol > li {
    border-top: 5px solid var(--accent-color);
    border-left: 0;
    display: inline-block;
    margin-left: -5px;
    vertical-align: top;
    width: 120px;
  }

  .menu > ol > li:hover:after,
  .menu > ol > li:focus:after,
  .menu > ol > li:focus-within:after {
    background: linear-gradient(to bottom, var(--accent-color), var(--gradient-color));
    border-radius: 3px;
    top: -15px; /* Adjust this value as needed */
    bottom: -15px; /* Adjust this value as needed */
    left: -15px; /* Adjust this value as needed */
    right: -15px; /* Adjust this value as needed */
  }

  .menu > ol > li:hover .sub-menu,
  .menu > ol > li:focus .sub-menu,
  .menu > ol > li:focus-within .sub-menu {
    max-height: 750px;
  }

  .menu > ol > li a:not(:last-child):before {
    right: 12.5px;
  }

  .menu > ol > li:hover a:before {
    transform: rotate(180deg);
  }

  .menu > ol .sub-menu {
    border-left: 0;
    margin: calc(15px - 15px) calc(15px - 15px) calc(15px - 15px);
    padding-left: 0;
  }
}

@media (min-width: 775px) {
  .menu > ol > li {
    width: 150px;
  }

  .menu > ol > li a:not(:last-child):before {
    right: 25px;
  }
}

body.menu-open .menu {
  transform: translateX(0);
  transform: translateX(-200%);
}

.menu {
  transform: translateX(-200%);
  transition: transform 0.5s;
}

#menu-icon {
  display: block;
  cursor: pointer;
  position: fixed;
  top: 0px;
  left: 0%;
  z-index: 999;
  color: var(--WHITE);
  font-size: 24px;
  width: 100%;
  background-color: #116466;
  padding-left: 2%;
}

@media only screen and (min-width: 767px) {
  #menu-icon {
    display: none;
  }
}