Electromagnetic modes and resonances of two-dimensional bodies