Variational characterization of Gibbs-non-Gibbs dynamical transitions for the Curie-Weiss model