HAMR Thermal Reliability via Inverse Electromagnetic Design