Dark Mode in Next.js: System-Aware, Flicker-Free, and the Implementation I Ship

How to implement dark mode in Next.js with next-themes, avoid the dreaded flash of unstyled content, and persist user preferences correctly.