How waves shape salt marshes