First:
yes, card counting is 100% legal. You can get kicked out of the casino for doing it (or they might just ask you to play other games), but that's just because they're a private company who can choose to deny you their service. But you cannot get into legal trouble because you're not breaking a law. So it's very much different from other types of "cheating" like switching out chips in
roulette after you bet them, which is actually against the law.
Second: before you even spend any effort into learning it, make sure to figure out what setup the casino uses. E.g., my casino uses shuffling machines, so it's a complete non-starter; decks are continuously shuffled and counting is impossible. But that's not common outside Europe I believe. They might use more than one deck though. So yeah, figure out if it's even feasible.
Third: I recommend watching this video to get a taste for it,
. If you're only curious about it rather than actually wanting to do it, this will probably satisfy that itch.
And fourth, if after #1-3 you're considering actually doing it, I mean, don't rely on this forum, there will be guides out there that give you the optimal strategy. Blackjack is not complicated, it's not poker, there is an optimal strategy you can just memorize, and you can calculate exactly at which point (like with how much information about cards) the game becomes profitable, and how profitable it becomes. IIrc you only get an edge of 1-3% in the best case, but that's enough to make a solid profit.
Fwiw my overall guess is that it's not super practical nowadays though because casinos have made it harder and you gotta be pretty good to not make it so obvious that they kick you out. I think the best time for counting has passed. But idk, maybe you could still make a decent profit.