Design done just before start of the sprint is a good idea as this saves time within the sprint. During the sprint, on the spot changes can be made as few things cannot be visualized better until they are implemented. However, doing design work ahead of 3, 4 sprints can make it an isolated effort that can become irrelevant until development starts to implement it.