  We observed the extreme close-in hot Jupiter system WASP-12 with HST. Near-UV
transits up to three times deeper than the optical transit of WASP-12b reveal
extensive diffuse gas, extending well beyond the Roche lobe. The distribution
of absorbing gas varies between visits. The deepest NUV transits are at
wavelength ranges with strong photospheric absorption, implying the absorbing
gas may have temperature and composition similar to the stellar photosphere.
Our spectra reveal significantly enhanced absorption (greater than 3 \sigma
below the median) at ~200 wavelengths on each of two HST visits; 65 of these
wavelengths are consistent between the two visits, using a strict criterion for
velocity matching which excludes matches with velocity shifts exceeding ~20
km/s. Excess transit depths are robustly detected throughout the inner wings of
the MgII resonance lines independently on both HST visits. We detected
absorption in FeII 2586A, the heaviest species yet detected in an exoplanet
transit. The MgII line cores have zero flux, emission cores exhibited by every
other observed star of similar age and spectral type are conspicuously absent.
WASP-12 probably produces normal MgII profiles, but the inner portions of these
strong resonance lines are likely affected by extrinsic absorption. The
required Mg+ column is an order of magnitude greater than expected from the
ISM, though we cannot completely dismiss that possibility. A more plausible
source of absorption is gas lost by WASP-12b. We show that planetary mass loss
can produce the required column. Our Visit 2 NUV light curves show evidence for
a stellar flare. We show that some of the possible transit detections in
resonance lines of rare elements may be due instead to non-resonant transitions
in common species. We present optical observations and update the transit
ephemeris.
