Wavepackets in inhomogeneous periodic media: Effective particle-field dynamics and Berry curvature