Minimal hypersurfaces and phase transitions