"a blue hat"
masculine vs feminine. Grammatical gender, not sex. There are many nouns in Arabic (and other gendered languages) which are feminine but have nothing to do with being female. For example, hand, foot etc. And similarly with masculine nouns. It doesn't make sense to refer to gender as male or female.