When dealing with unequal sample sizes in statistics, you can consider using methods like pooled variance, weighted means, bootstrapping, Bayesian approaches, non-parametric tests, or meta-analysis to handle the disparities effectively. The choice depends on the nature of your data and the specific analysis you want to perform.
The answer depends on whether your intention in a contrast is to treat means as having equal import regardless of group size (n), which is the unweighted means approach, or to weight means relative to their sample size, which of course, is a weighted means approach.
For an unweighted means approach, two contrasts are orthogonal if the sum of coefficient product terms, across groups, equals zero: e.g., c11c21 + c12c22 + ... + c1kc2k = 0 (where cij is the coefficient used for the i-th contrast and j-th group).
For a weighted means approach, two contrasts are orthogonal if: n1c11c21 + n2c12c22 + ... + nkc1kc2k = 0 (where cij is defined as above and nj is the sample size for group j).
In many experimental designs, the usual intention of behind a contrast is to compare means as having equal import regardless of group size. Therefore (using cij and nj as defined above):
SS(contrast i) = (ci1*M1 + ci2M2 + ... + cikMk)^2 / (ci1^2/n1 + ci2^2/n2 + ... + cik^2/nk) (where Mj is the mean for group j)
Here's a link that walks through a worked example: https://www.uvm.edu/~statdhtx/StatPages/Unequal-ns/Unequal_n's_contrasts.html
Finally, B. J. Winer's 1971 text, Statistical principles in experimental design (2nd ed.). also addresses the issue.