Grain-scale discrete element simulations of bidisperse mixtures during bedload transport are used to understand, and model, bedload transport and particle-size segregation in granular media. For an initial distribution of fine particles on top of a coarse granular bed, this paper investigates the gravity driven percolation/segregation of the fine particles down into the quasi-static part of the bed. The segregation is observed to be driven by the inertial number at the bottom of the fine particle layer, and is independent of the number of fine particles. A novel travelling wave solution for the evolving concentration distribution is constructed using the continuum particle-size segregation model of Thornton, Gray & Hogg (J. Fluid Mech., vol. 550, 2006, pp. 1–25) and Gray & Chugunov (J. Fluid Mech., vol. 569, 2006, pp. 365–398). The observed behaviour is shown to be related to a local equilibrium between the influence of the concentration and of the inertial number. The existence of the exact solution relies on the segregation flux and the diffusion coefficient having the same dependency on the inertial number. This functional dependence allows the continuum model to quantitatively reproduce the discrete simulations. These results significantly improve on our understanding of the size segregation dynamics and represent a step forward in the up-scaling process to polydisperse granular flows in the context of turbulent bedload transport.