aperture – What causes images to have flat depth?

I am learning about photography and I remember reading about an effect that causes images to look like there is no depth but now I cannot find what it is called or what causes it.

I remember an exagerated example in which the image was pointing down the street to a beach in which the ocean and sky kind of blended and looked like they were at the same depth, they kind of looked like a wall in the back.

Based on my understanding I think this might be caused by small aperture and/or infinite zoom but I’m not sure and it is hard to search because I am missing names of terms so the google is not returning accurate results.

Does anyone know how this effect is called or what causes it?