In-medium chiral perturbation theory