How can I limit my rotation around an object ?

I’ve searched for the answer on the forums, but since I couldn’t find one that works for me I’ll ask again.
So I have a camera rotating around an object. I want to limit the rotation to stop when it reaches X degrees of 90 or -90 aka when it looks at it exactly from above or below. I tried to use clamp, tried to set the degrees = 90 with eulerAngles if its above 90 or below -90 and both did not work, it’s possible I didn’t implement them properly.(Mind that, I clamped at the Start() function shouldn’t that work ? ) It’s like the camera completely ignores the limit.
** TL:DR ** I want to restrict the camera’s rotation around an object but Mathf.Clamp and eulerAngles didn’t work . Any guesses ? My code looks like this ** (Start function, variable delcaration etc are skipped)** :

void Update()
{

    horizontalInput = Input.GetAxis("Horizontal");
    verticalInput = Input.GetAxis("Vertical");
    if (horizontalInput != 0)
    {
        transform.RotateAround(center.position, center.up, -horizontalInput * 90 * Time.deltaTime);
    }
    if (verticalInput != 0)
    {
       
        transform.RotateAround(center.position, transform.right, verticalInput * 90 * Time.deltaTime);

    }
}