  The fields of cavity quantum electrodynamics and magnetism have recently
merged into \textit{`cavity spintronics'}, investigating a quasiparticle that
emerges from the strong coupling between standing electromagnetic waves
confined in a microwave cavity resonator and the quanta of spin waves, magnons.
This phenomenon is now expected to be employed in a variety of devices for
applications ranging from quantum communication to dark matter detection. To be
successful, most of these applications require a vast control of the coupling
strength, resulting in intensive efforts to understanding coupling by a variety
of different approaches. Here, the electromagnetic properties of both resonator
and magnetic samples are investigated to provide a comprehensive understanding
of the coupling between these two systems. Because the coupling is a
consequence of the excitation vector fields, which directly interact with
magnetisation dynamics, a highly-accurate electromagnetic perturbation theory
is employed which allows for predicting the resonant hybrid mode frequencies
for any field configuration within the cavity resonator, without any fitting
parameters. The coupling is shown to be strongly dependent not only on the
excitation vector fields and sample's magnetic properties but also on the
sample's shape. These findings are illustrated by applying the theoretical
framework to two distinct experiments: a magnetic sphere placed in a
three-dimensional resonator, and a rectangular, magnetic prism placed on a
two-dimensional resonator. The theory provides comprehensive understanding of
the overall behaviour of strongly coupled systems and it can be easily modified
for a variety of other systems.
