Implement NumPy multi-head attention with QKV projections, optional masking, stable softmax, and output projection.