To let a merchant change layout, wire a setting to CSS through a custom property. Put the value in an inline style as a variable, then read it with var() in the stylesheet.
<div class="grid" style="--cols: {{ section.settings.columns }}">
...
</div>
{% stylesheet %}
.grid { grid-template-columns: repeat(var(--cols, 3), 1fr); }
{% endstylesheet %}
This is the one inline style that's fine in production. One custom property is OK. An inline style="grid-template-columns: ..." is not: it locks the rule in markup, so a mobile media query can't override it.
In a {% for %} loop, forloop.index is the current number (1, 2, 3...). Use it to number the steps.