Rank corpus embeddings for each CLIP-style query by stable cosine similarity, including safe handling of zero vectors.