Flex content overflowing container

My rotated text goes beyond the edge of its container. How can I fix it?

to get help, it is best to put your code into a public area like codepen.io so people can check it out live and play with it.

I was able to fix it with transform-origine.