I write (and mostly read) SF and fantasy, but I'm pretty sure that detective and ghost stories are similar: you can stay inside the genre and still write in a very wide variety of styles, plots, atmospheres and themes. I'm currently working on a fantasy where the hero is a mathematician. This is...