Why is the rotatoin on Y resetting?

Notes on clamping camera rotation and NOT using .eulerAngles because of gimbal lock: