Free orbital movement with face locking without experiencing gimbal lock, any ideas?

Thank you so much! I kinda grasped the idea but when i recreate it in level;

For Roll it does rotate as intended but for Pitch; Z flips as before. I guess chatgpt smarter than me because I only understand half of this:

2024-12-02 17-33-00

At least you put me 1 step forward :pray: