<script>
(function () {
    var content = document.getElementById("content");
    if (!content) return;
    if (!document.body.classList.contains("type-text")) return;
    if (content.querySelector(".blog-post") || content.querySelector(".blog-garden-table") || content.querySelector(".blog-subcategories") || content.querySelector(".blog-search")) return;
    var clone = content.cloneNode(true);
    clone.querySelectorAll("script, style, pre, code, nav, a, .blog-prevnext").forEach(function (el) { el.remove(); });
    var words = (clone.textContent || "").trim().split(/\s+/).filter(Boolean).length;
    var mins = Math.max(1, Math.round(words / 200));
    var title = document.getElementById("title");
    if (!title) return;
    var p = document.createElement("div");
    p.className = "reading-time";
    p.textContent = mins + " min read";
    title.parentNode.insertBefore(p, title.nextSibling);
})();
</script>