You could replace the css in step 3 above with a media query so the post width is only reset above the tablet view width:
@media only screen and (min-width: 960px) {
.home .post-list .post {
width: 33%;
}
}
For the tablet view and narrower it would default to 50% width. The problem with this is, in the tablet view the php change you made in step 2 above is still sending 3 posts per row, but now the post size is 50%, so you end up with:
post post
post
post post
post
You could try using a plugin like this to determine the browser:
https://www.ads-software.com/plugins/php-browser-detection/
(Don’t know anything about that plugin so not sure how reliable or effective it is.)
Then, in index.php, you would change this:
<?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>
to this:
<?php if(is_desktop()) {
if($i % 3 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>';
} else {
if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>';
} ?>