Statistical mechanics of nucleic acids under mechanical stress