Solve a spiral matrix traversal problem.
Implement spiral_order(matrix) to return all elements in clockwise spiral order. The input is a rectangular list of lists of integers, and the output is a flat list containing each element exactly once. Return an empty list when the matrix is empty.
def spiral_order(matrix):