Most optical systems involve a combination of lenses separated by free-space regions where light acquires the required angle-dependent phase delay for a certain functionality. Very recently, flat-optics structures have been proposed to compress these large free-space volumes and miniaturize the overall optical system. However, these early designs can only replace free-space volumes of limited length, or operate in a very narrow angular range, or require a high-index background. These issues raise questions about the applicability of these devices in practical scenarios. Here, we first derive a fundamental trade-off between the length of compressed free space and the operating angular range, which explains some of the limitations of earlier designs, and we then propose a solution to relax this trade-off using nonlocal metasurface structures composed of suitably coupled resonant layers. This strategy, inspired by coupled-resonator-based band-pass microwave filters, allows replacing free-space volumes of arbitrary length over wide angular ranges, and with very high transmittance. Finally, we theoretically demonstrate, for the first time, the potential of combining local and nonlocal metasurfaces to realize compact, fully solid-state, planar structures for focusing, imaging, and magnification, in which the focal length of the lens (and, hence, its magnifying power) does not dictate the actual distance at which focusing is achieved. Our findings are expected to extend the reach of the field of metasurfaces and open new unexplored opportunities.