Abstract: The design complexity of photonic crystals and periodic gratings has been continuously increasing, driven by exploration of their unique physical phenomena and widespread applications.