Viñales bags pole for Emilia Romagna race as Bagnaia penalised