Diophantine approximation on curves and the distribution of rational points: divergence theory