Transmission of horizontally polarized waves and trapped waveguide modes in inhomogeneous media