Terahertz metamaterials for sensing and detection