Elucidating the mechanism of a two-step spin transition in a nanoporous metal-organic framework.