  In the framework of the GAPS project, we observed the planet-hosting star
KELT-9 (A-type star, VsinI$\sim$110 km/s) with the HARPS-N spectrograph at the
TNG. In this work we analyse the spectra and the extracted radial velocities
(RVs), to constrain the physical parameters of the system and to detect the
planetary atmosphere of KELT-9b. We extracted from the high-resolution optical
spectra the mean stellar line profiles with an analysis based on the Least
Square Deconvolution technique. Then, we computed the stellar RVs with a method
optimized for fast rotators, by fitting the mean stellar line profile with a
purely rotational profile instead of using a Gaussian function. The new spectra
and analysis led us to update the orbital and physical parameters of the
system, improving in particular the value of the planetary mass to $M_{\rm
p}=2.88\pm0.35\,M_{\rm Jup}$. We discovered an anomalous in-transit RV
deviation from the theoretical Rossiter-McLaughlin effect solution, calculated
from the projected spin-orbit angle $\lambda=-85.78\pm0.46$ degrees measured
with Doppler tomography. We prove that this deviation is caused by the
planetary atmosphere of KELT-9b, thus we name this effect Atmospheric
Rossiter-McLaughlin effect. By analysing the magnitude of the RV anomaly, we
obtained information on the extension of the planetary atmosphere as weighted
by the model used to retrieve the stellar mean line profiles, which is up to
$1.22\pm0.02\,R_{\rm p}$. The Atmospheric Rossiter-McLaughlin effect will be
observable for other exoplanets whose atmosphere has non-negligible correlation
with the stellar mask used to retrieve the RVs, in particular ultra-hot
Jupiters with iron in their atmosphere. The duration and amplitude of the
effect will depend not only on the extension of the atmosphere, but also on the
in-transit planetary RVs and on the projected rotational velocity of the parent
star.
