If you use "fr" instead of "%", you can prevent grid from getting bigger than its parent.
grid-template-columns: repeat(4, 25%);
grid-template-columns: repeat(4, 1fr);