Acid-base equilibria of weak polyelectrolytes in multilayer thin films