Sharp degree bounds for sum-of-squares certificates on projective curves