Phenolphthalein is a weak acid that changes color in the presence of a base. It is colorless in acidic solutions and turns pink in basic solutions. This is because the phenolphthalein molecule loses two hydrogen ions (H+) when it reacts with a base, causing the solution to become more basic. The loss of these hydrogen ions changes the structure of the phenolphthalein molecule, which in turn causes it to absorb light at a different wavelength. This change in wavelength results in the solution turning pink.