  We present a simultaneous detection of gravitational magnification and dust
reddening effects due to galactic halos and large-scale structure. The
measurement is based on correlating the brightness of ~85,000 quasars at z>1
with the position of 20 million galaxies at z~0.3 derived from the Sloan
Digital Sky Survey and is used to constrain the galaxy-mass and galaxy-dust
correlation functions up to cosmological scales.
  The presence of dust is detected from 20 kpc to several Mpc, and we find its
projected density to follow: Sigma_dust ~ theta^-0.8, a distribution similar to
mass. The amount of dust in galactic halos is found to be comparable to that in
disks. On large scales its wavelength dependence is described by R_V=3.9+/-2.6,
consistent with interstellar dust. We estimate the resulting opacity of the
Universe as a function of redshift and find A_V~0.03 mag up to z=0.5. This, in
turn, implies a cosmic dust density of Omega_dust ~ 5x10^-6, roughly half of
which comes from dust in halos of ~L* galaxies.
  We present magnification measurements, corrected for dust extinction, from
which the galaxy-mass correlation function is inferred. The mean mass profile
around galaxies is found to be Sigma ~ 30 (theta/arcmin)^-0.8 h M_sun/pc^2 up
to a radius of 10 Mpc, in agreement with gravitational shear estimates.
