Hubble Space Telescope spectra of the phase-modulated wind in the SMC O+WR binary R31