5. If the complex number $z$ satisfies $|z|=1, A(-1,0)$, and $B(0,-1)$ are two points on the complex plane, then the function $f(z) = |(z+1)(\bar{z}-\mathrm{i})|$ reaches its maximum value when the figure formed by points $Z, A, B$ on the complex plane is ( ).
(A) Equilateral triangle
(B) Isosceles triangle
(C) Right triangle
(D) Isosceles right triangle