added a debounced resize handler to ensure the carousel snaps to active slide after resizes