In this work, the formalism of the exact factorization was extended to treat the photon-electron-nuclear dynamics, to describe the coupled motion of photons, electrons, and nuclei at the quantum-mechanical level. The factorization choice was the one where the marginal amplitude is chosen as the wavefunction for the photon-nuclear subsystem, and the electronic subsystem is then conditionally dependent on the photonnuclear positions. This choice is particularly interesting since, when CTMQC is employed for trajectory-based simulations, it suggests a treatment of photonic and nuclear degrees of freedom on equal footing in terms of coupled trajectories. In this way, the full correlation with the electronic subsystem is maintained, clearly within the approximations underlying CT-MQC.