So I'm trying to rotate an object from -35 degrees to 35 degrees, or rather 325 degrees to 35 degrees

So I’m trying to rotate an object from -35 degrees and 35 degrees, or rather 325 degrees to 35 degrees and I’m trying to lock the rotations there.

I have this code:

void lockRotationUp()  {
        Rotation.x = transform.rotation.eulerAngles.x;
        Rotation.x = Mathf.Clamp (Rotation.x, 325,35);
        transform.localEulerAngles = new Vector3(Rotation.x, transform.localEulerAngles.y, transform.localEulerAngles.z);
}

but it just flips between 325 and 35 degrees, no in-the-middle, but if I write it this way:

void lockRotationUp()  {
        Rotation.x = transform.rotation.eulerAngles.x;
        Rotation.x = Mathf.Clamp (Rotation.x, -35,35);
        transform.localEulerAngles = new Vector3(Rotation.x, transform.localEulerAngles.y, transform.localEulerAngles.z);
    }

it freaks out when it hits zero, does anyone know how to properly lock the rotation from 325 degrees to 35 degrees?

I fixed one aspect of it, the locking aspect, but occasionally it flips back to the other side, here’s the next iteration of the code:

void lockRotationUpDown()  {
        Rotation.x = transform.rotation.eulerAngles.x;
       
        if (Rotation.x < minBound)
        {
            Rotation.x += 360.0f;
        }
        Rotation.x = Mathf.Clamp(Rotation.x, 360.0f-minBound, 360.0f+minBound);

        if (Rotation.x >= 360.0f)
        {
            Rotation.x -= 360.0f;
        }
        transform.localEulerAngles = new Vector3(Rotation.x, transform.localEulerAngles.y, transform.localEulerAngles.z);
    }