Post hoc tests, like Bonferroni, allow us to detect which of the groups is the different one after ANOVA.
To use it, we calculate effectively what is like the independent t-test for each of the pairwise groups. This value is then compared to the $t$ critical value.
The $t$ critical value is found using Degrees of Freedom (DoF) $= N-k$ where $k$ is number of groups.
My question is why do we use $N-k$ when comparing to a $t$ value made up from 2 groups only. Why isn't DoF equal to total sum of items in the 2 groups, minus 2 like in independent $t$ test?