CSS Animation with visibility : visible and hidden

Hello, I’ve created a navigation menu which is hidden when the breakpoint is 640px and an icon appears. When I click on this icon my menu reopens from the left and I see that my text in the background changes the style. I’ve tried to use a display but apparently it doesn’t work with animation.
Do you have any idea how to prevent my text in the background from changing the style while the menu is opening?

Thanks for your help!

document.body.addEventListener("click", function (e) {

  if (e.target.matches(".fa-grip-lines")) {

    let elem = document.querySelector("#menuMobile");

    if (menuMobile.style.visibility === "hidden" && window.innerWidth < "640") {

      elem.classList.remove("menuMobile");

      elem.classList.add("mobile");

      elem.style.visibility = "visible";

      e.target.style.color = "white";



    } else if (

      menuMobile.style.visibility != "visible" &&

      window.innerWidth > "640"

    ) {

      elem.classList.remove("mobile");

    } else {

      menuMobile.style.visibility = "hidden";

      elem.classList.remove("mobile");

      elem.classList.add("menuMobile");

      e.target.style.color = "black";

      

    }

  }

});

<div class="sous-menu-burger">

        <i class="fas fa-grip-lines"></i>

    </div> 

    <div class="cont-main">

        <div id="menuMobile" class="menuMobile"> 

                <a href="#"><div class="home-a">Home</div></a>

                <a href="#"><div class="about-a">About</div></a>

                <a href="#"><div class="skills-a">Skills</div></a>

                <a href="#"><div class="projects-a">Projects</div></a>

                <a href="#"><div class="contacts-a">Contacts</div></a>

        </div>

        <div class="contText">

            <div class="titre">About</div>

            <div class="text">

            <div class="hello">"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

            </div>

        </div>

    </div>

</div>`;
.menuMobile {

      margin-top: 10%;

      margin-left: 10%;

      margin-right: 10%;

      margin-bottom: 35%;

      height: 62%;

      @media only screen and (max-width: $sm) {

        visibility: hidden;

        background-color: black;

      }

      @media only screen and (min-width: $sm) {

        visibility: visible !important;

        background-color: white;

      }

    }

    .mobile {

      position: absolute;

      width: 100%;

      height: 140%;

      z-index: 900;

      padding: 40% 10% 10% 20%;

      margin-left: 0%;

      margin-right: 0%;

      background-color: black;

 
      -webkit-animation: run 1s cubic-bezier(0.3, 0.460, 0.450, 0.940);

      -webkit-animation-duration: 1s;

    }

    @keyframes run {

      0% {

        right: 100%;

      }

      100% {

        right: 0;     

      }

    }