Percus-Yevick equation for an inhomogeneous fluid: Critical region