Inverse kinematics of robotic arm

I am trying to calculate inverse kinematics of a robotic arm made of 3 segments.
To do this, I need to find the intersections of a sphere with a circle.

I am trying with this:

But I am totally new to Wolfram notebooks, I just copied and pasted what I found around and messed with it…

How do I add to this nb some lines?

  1. line from sphere center to lower intersection
  2. line from circle center to lower intersection

Then, how do I calculate the angle in the picture below?

Here is an attempt:

center1 = {1, 1, 3};
center2 = {2, 2, 1};
intersections = SolveValues[{h == 0, g == 0, i == 0}, {x, y, z}]
Graphics3D[{{Opacity[.5], Sphere[center1, 2],
   Sphere[center2, Sqrt[2]],
   InfinitePlane[{1, 1, 0}, {{0, 1, 0}, {0, 0, 1}}]},
  Thickness[.01], PointSize[.03],
  Point[intersections],
  Line[{center1, intersections[[1]], center2}]}]
angle = VectorAngle[intersections[[2]] - center1, {0, 0, -1}]

I get “SolveValues:This system cannot be solved with the methods available to SolveValues.”

Very strange. Try this

Solve[{(x - 1)^2 + (y - 1)^2 + (z - 3)^2 - 4 == 0,
  x - 1 == 0,
  (x - 2)^2 + (y - 2)^2 + (z - 1)^2 - 2 == 0},
 {x, y, z}]