Solution (source code)

= Solution

Let $h=x-\pi/2$. The trigonometric identity $\sin(\pi/2+h)=\cos h$ changes the expression to $h^2/(\cos h-1)$. Since $\cos h-1=-h^2/2+O(h^4)$,
$$
\boxed{\lim_{x\to\pi/2}\frac{(x-\pi/2)^2}{\sin x-1}=-2}.
$$
The negative sign is also forced geometrically: near its maximum, $\sin x-1$ is negative while the numerator is nonnegative. Both numerator and denominator vanish quadratically, so one application of a first-derivative argument alone would not yet resolve the indeterminate form.