A lightweight, accessible dark mode toggle built with pure CSS custom properties, vanilla JavaScript and localStorage - no frameworks needed. It detects the user's OS color-scheme preference on first load (prefers-color-scheme) and remembers their choice afterwards. Copy the HTML, CSS and JS below and drop it into any project.