pub fn cosine_similarity(a: &[f32], b: &[f32]) -> f32
Cosine similarity between two vectors (handles zero-norm gracefully).