
An object that is immersed in afluid and approaching a substrate mayfind apotential energy minimum at a certain distance due to the balance between attractive and repulsiveCasimir-Lifshitz forces, a phenomenon referred to as quantum trapping. This equilibriumdepends on the relative values of the dielectric functions of the materials involved. Herein, westudy quantum trapping effects in planar nanocomposite materials and demonstrate that they arestrongly dependent on the characteristics of the spatial inhomogeneity. As a model case, weconsider spherical particles embedded in an otherwise homogeneous material. We propose aneffective medium approximation that accounts for the effect of inclusions andfind that anunprecedented and counterintuitive intense repulsive Casimir-Lifshitz force arises as a result ofthe strong optical scattering and absorption size-dependent resonances caused by their presence. Our results imply that the properanalysis of quantum trapping effects requires comprehensive knowledge and a detailed description of the potential inhomogeneity(caused by imperfections, pores, inclusions, and density variations) present in the materials involved

