Surface interactions and topological restrictions in liquids confined in nanopores. I. Light and neutron response in homologous systems