SummaryWe use regular solution theory and implement a three-gradient model for a liquid/vapour system in contact with a complex surface topology to study the shape of a liquid drop in advancing and receding wetting scenarios. More specifically, we study droplets on an inverse opal: spherical cavities in a hexagonal pattern. In line with experimental data, we find that the surface may switch from hydrophilic (contact angle on a smooth surface θY < 90°) to hydrophobic (effective advancing contact angle θ > 90°). Both the Wenzel wetting state, that is cavities under the liquid are filled, as well as the Cassie–Baxter wetting state, that is air entrapment in the cavities under the liquid, were observed using our approach, without a discontinuity in the water front shape or in the water advancing contact angle θ. Therefore, air entrapment cannot be the main reason why the contact angle θ for an advancing water front varies. Rather, the contact line is pinned and curved due to the surface structures, inducing curvature perpendicular to the plane in which the contact angle θ is observed, and the contact line does not move in a continuous way, but via depinning transitions. The pinning is not limited to kinks in the surface with angles θkink smaller than the angle θY. Even for θkink > θY, contact line pinning is found. Therefore, the full 3D-structure of the inverse opal, rather than a simple parameter such as the wetting state or θkink, determines the final observed contact angle.