A computational framework for immiscible three-phase flow in deformable porous media