Eliminate Theme‑Toggle Layout Shifts in Chakra UI with useColorModeScript
Chakra UI’s default theme toggle adds the color‑mode class after the first paint, causing layout shifts. The built‑in useColorModeScript hook injects a pre‑paint script that writes the correct class to <html> before the browser renders, eliminating the flash and keeping CLS at zero.