Sub-second and ppm-level optical sensing of hydrogen using templated control of nano-hydride geometry and composition