Unit – The camera rotates without camera

I've set the camera to go behind the object called "cameraS" and set its X-rotation to that object, moving back and forth along the axis behind the object. If it moves backwards, it also moves to the right for some reason and turns left.

    public Transform target;
public Vector3 offset;
public float sensitivity;
private float horizontal;
private float desiredYAngle;
public Vector3 zoom;
private Quaternion rotation;
// Start is called before the first frame update
void Start()
{
    offset = target.position - transform.position;
    zoom = new Vector3(0f, 0f, 0f);
}

// Update is called once per frame
void LateUpdate() {
    horizontal = Input.GetAxis("Mouse X") * sensitivity;
    zoom -= new Vector3(Input.GetAxis("Mouse Y") * sensitivity * 0.5f, 0f, 0f);
    if(zoom.x < 0){
        zoom = new Vector3(0, 0, 0);
    }
    if(zoom.x > 20){
        zoom = new Vector3(20, 0, 0);
    }
    target.Rotate(0, horizontal, 0);
    desiredYAngle = target.eulerAngles.y;
    rotation = Quaternion.Euler(0, desiredYAngle, 0);
    transform.position = target.position - (rotation * (offset + new Vector3(offset.x - zoom.x, 0f, 0f)));
    transform.LookAt(target);
}