  The loss of gauge invariance in models of light-matter interaction which
arises from material and photonic space truncation can pose significant
challenges to conventional quantum optical models when matter and light
strongly hybridize. In structured photonic environments, necessary in practice
to achieve strong light-matter coupling, a rigorous model of field quantization
within the medium is also needed. Here, we use the framework of macroscopic QED
by quantizing the fields in an arbitrary material system, with a
spatially-dependent dispersive and absorptive dielectric, starting from a
fundamental light-matter action. We truncate the material and mode degrees of
freedom while respecting the gauge principle by imposing a partial gauge fixing
constraint during canonical quantization, which admits a large number of gauges
including the Coulomb and multipolar gauges. We also consider gauge conditions
with explicit time-dependence, enabling us to unambiguously introduce
phenomenologically time-dependent light-matter interactions in any gauge. Our
results allow one to derive rigorous models of ultrastrong light-matter
interactions in structured photonic environments with no gauge ambiguity.
Results for two-level systems and the dipole approximation are discussed, as
well as how to go beyond the dipole approximation for effective single-particle
models. By comparing with the limiting case of an inhomogeneous dielectric,
where dispersion and absorption can be neglected and the fields can be expanded
in terms of the generalized transverse eigenfunctions of the dielectric, we
show how lossy systems can introduce an additional gauge ambiguity, which we
resolve and predict to have fundamental implications for open quantum system
models. Finally, we show how observables in mode-truncated systems can be
calculated without ambiguity by using a simple gauge-invariant photodetection
model.
