Transformation of wave spectra across the surf zone