/* Anti-FOUC theme bootstrap. External (not inline) to satisfy CSP
   script-src 'self'. Runs synchronously in <head> before first paint:
   sets html.dark from saved choice or system preference so the dark
   theme never flashes white. Mirrors ThemeProvider's logic/key. */
(function () {
    try {
        var KEY = "avalog-theme";
        var t = localStorage.getItem(KEY);
        if (t !== "light" && t !== "dark") {
            t = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
        }
        var el = document.documentElement;
        if (t === "dark") el.classList.add("dark");
        el.setAttribute("data-theme", t);
    } catch (e) {
        /* localStorage/matchMedia unavailable — default light */
    }
})();