Molecular basis of activity changes in acid catalysis within nanoconfined water