SMS: Modal decomposition of fluid-structure interaction with application to flag flapping