Comparing between steady-state excitonic transitions and ultrafast polaronic photoexcitations in layered perovskites: the role of electron–phonon interaction