The cosmic-ray puzzle and the census of the interstellar medium: the Fermi LAT view of Cassiopeia, Cepheus and the Perseus arm