Text this: Ramanujan sums via generalized Möbius functions and applications