Anti-Gravity isn't working

Hello! I am new to using Unity and I’m hoping for a hint about where the problem may be in my code that is preventing my gravity to inverse from being applied every time I hit the button to “flip” my character (rotate the char upside down to walk on the ceiling or floor)

 if (Input.GetKeyDown(KeyCode.G))
        {
            if (isFlipped == false)
            {
                if (player.isGrounded)
                {
                    transform.position = transform.position + Vector3.up * 2;
                }
                Debug.Log("Attempting to Flip");
                currentAngle = transform.eulerAngles;

                //lock controls until flipping completes : not yet made (don't worry about it)

                Vector3 rot = transform.rotation.eulerAngles;
                rot = new Vector3(rot.x, rot.y, rot.z + 180);
                transform.rotation = Quaternion.Euler(rot);


                isFlipped = true;
            }
            else
            {
                Debug.Log("Attempting to Flip");


                //lock controls until flipping completes

                Vector3 rot = transform.rotation.eulerAngles;
                rot = new Vector3(rot.x, rot.y, rot.z - 180);
                transform.rotation = Quaternion.Euler(rot);


                 isFlipped = false;
             }

         }


//jumping
         if (isFlipped == false)
         {
             if (player.isGrounded)
             {
                 vSpeed = 0;
                 if (Input.GetKeyDown(KeyCode.Space))
                 {
                     vSpeed = jumpHeight;
                 }
             }
             //gravity
             vSpeed -= gravity * Time.deltaTime;
             movement.y = vSpeed;

         }
         else
         {
             gravity = gravity * -1;

             if (player.isGrounded)
             {
                 vSpeed = 0;
                 if (Input.GetKeyDown(KeyCode.Space))
                 {
                     vSpeed = jumpHeight * -1;
                 }
             }
             //gravity
             vSpeed += gravity * Time.deltaTime;
             movement.y = vSpeed;
         }


         movement = transform.rotation * movement;
         player.Move(movement * Time.deltaTime);

Hi @Collywog ,
Pls check this video CHANGING GRAVITY PLAYER CONTROLLER - EASY UNITY TUTORIAL - YouTube
It’s in 2D, but I guess you can make use of that as a reference