Describing the dynamics of nuclei in molecules requires a potential energy surface, which is traditionally provided by the Born-Oppenheimer or adiabatic approximation. However, we also need to assign masses to the nuclei. There, the Born-Oppenheimer picture does not account for the inertia of the electrons, and only bare nuclear masses are considered. Nowadays, experimental accuracy challenges the theoretical predictions of rotational and vibrational spectra and requires the participation of electrons in the internal motion of the molecule. More than 80 years after the original work of Born and Oppenheimer, this issue has still not been solved, in general. Here, we present a theoretical and numerical framework to address this problem in a general and rigorous way. Starting from the exact factorization of the electron-nuclear wave function, we include electronic effects beyond the Born-Oppenheimer regime in a perturbative way via position-dependent corrections to the bare nuclear masses. This maintains an adiabaticlike point of view: The nuclear degrees of freedom feel the presence of the electrons via a single potential energy surface, whereas the inertia of electrons is accounted for and the total mass of the system is recovered. This constitutes a general framework for describing the mass acquired by slow degrees of freedom due to the inertia of light, bounded particles; thus, it is applicable not only in electron-nuclear systems but in light-heavy nuclei or ions as well. We illustrate this idea with a model of proton transfer, where the light particle is the proton and the heavy particles are the oxygen atoms to which the proton is bounded. Inclusion of the light-particle inertia allows us to gain orders of magnitude in accuracy. The electron-nuclear perspective is adopted, instead, to calculate position-dependent mass corrections using density functional theory for a few polyatomic molecules at their equilibrium geometry. These data can serve as input for the computation of high-precision molecular spectra.