diff --git a/modules/blox-tailwind/assets/js/hb-head.js b/modules/blox-tailwind/assets/js/hb-head.js
new file mode 100644
index 00000000..71b60800
--- /dev/null
+++ b/modules/blox-tailwind/assets/js/hb-head.js
@@ -0,0 +1,7 @@
+import { initTheme, applyHugoStyleFixes } from './hb-init.js'
+
+initTheme()
+applyHugoStyleFixes()
+
+
+
diff --git a/modules/blox-tailwind/assets/js/hb-init.js b/modules/blox-tailwind/assets/js/hb-init.js
new file mode 100644
index 00000000..f221c2f1
--- /dev/null
+++ b/modules/blox-tailwind/assets/js/hb-init.js
@@ -0,0 +1,44 @@
+// Hugo Blox JS Global Init (CSP-friendly)
+export function initTheme() {
+ const root = document.documentElement;
+ const defaultTheme = root.dataset.wcThemeDefault;
+ const setDark = () => { root.classList.add('dark'); root.style.colorScheme = 'dark'; };
+ const setLight = () => { root.classList.remove('dark'); root.style.colorScheme = 'light'; };
+
+ if ('wc-color-theme' in localStorage) {
+ localStorage.getItem('wc-color-theme') === 'dark' ? setDark() : setLight();
+ } else {
+ if (defaultTheme === 'dark') setDark();
+ else if (defaultTheme === 'light') setLight();
+ else if (defaultTheme === 'system') {
+ window.matchMedia('(prefers-color-scheme: dark)').matches ? setDark() : setLight();
+ }
+ }
+}
+
+export function applyHugoStyleFixes() {
+ document.addEventListener('DOMContentLoaded', function () {
+ const checkboxes = document.querySelectorAll("li input[type='checkbox'][disabled]");
+ checkboxes.forEach((e) => {
+ const parent = e.parentElement?.parentElement;
+ if (parent) parent.classList.add('task-list');
+ });
+
+ const liNodes = document.querySelectorAll('.task-list li');
+ liNodes.forEach((nodes) => {
+ const textNodes = Array.from(nodes.childNodes).filter(
+ (node) => node.nodeType === 3 && node.textContent && node.textContent.trim().length > 1,
+ );
+ if (textNodes.length > 0) {
+ const span = document.createElement('label');
+ textNodes[0].after(span);
+ const input = nodes.querySelector("input[type='checkbox']");
+ if (input) span.appendChild(input);
+ span.appendChild(textNodes[0]);
+ }
+ });
+ });
+}
+
+
+
diff --git a/modules/blox-tailwind/assets/js/vendor-libs.js b/modules/blox-tailwind/assets/js/vendor-libs.js
new file mode 100644
index 00000000..51eb3ef6
--- /dev/null
+++ b/modules/blox-tailwind/assets/js/vendor-libs.js
@@ -0,0 +1,5 @@
+// Dummy entry for Vite lib mode. We copy vendor libraries via vite-plugin-static-copy.
+export default {}
+
+
+
diff --git a/modules/blox-tailwind/layouts/_partials/site_head.html b/modules/blox-tailwind/layouts/_partials/site_head.html
index a5ac3962..2faa88c0 100644
--- a/modules/blox-tailwind/layouts/_partials/site_head.html
+++ b/modules/blox-tailwind/layouts/_partials/site_head.html
@@ -76,54 +76,12 @@
{{ end }}
-
-
-
+ {{/* Externalized init scripts for CSP-friendly head */}}
+ {{- $hb_head := resources.Get "js/hb-head.js" | js.Build | resources.Minify -}}
+ {{- if hugo.IsProduction -}}
+ {{- $hb_head = $hb_head | fingerprint "sha256" -}}
+ {{- end -}}
+
{{/* Analytics & Verification */}}
{{/* !CACHED! All analytics and verification code is at site level */}}
@@ -218,6 +176,7 @@
{{ $font_type = "woff2" }}
{{end}}
{{ $font := resources.Get (printf "dist/font/%s" $font_file) }}
+