You can filter nth-child results using the "of <selector>" syntax:

li:nth-child(2n of :not(.hidden)) {
  background-color: grey;
}
Read more
Subscribe to CSS
Mastodon Mastodon