why am i not able to castle in this position?
[Event "Oymanli26 vs. pabloo222iwiwi"] [Site "Chess.com"] [Date "2025-09-20"] [White "Oymanli26"] [Black "pabloo222iwiwi"] [Result "1-0"] [WhiteElo "546"] [BlackElo "516"] [TimeControl "180"] [Termination "Oymanli26 won by resignation"] 1. e4 d5 2. Nf3 e5 3. exd5 Qxd5 4. Qe2 f6 5. d4 Nc6 6. Be3 b6 7. dxe5 Nxe5 8. Nxe5 Qxe5 9. Nc3 Bb7 10. O-O-O Ne7 11. f4 Qf5 12. g4 Qc5 13. Bxc5 1-0
Yes, you can castle even if your castling rook is under attack, provided it's not the king that is under threat or is passing through a threatened square, and that neither the king nor the rook has moved, and no pieces are between them. The key restrictions are on the king, which cannot be in check, move through a threatened square, or land on a threatened square.