// Lift the floating action button above the footer when the footer is on
// screen, so it never overlaps the request-time line or the companion icon.
// Mirrors the TOC's header-aware top-offset behaviour in toc.js.
(function () {
    var fab = document.querySelector(".fab");
    var footer = document.querySelector("footer");
    if (!fab || !footer) return;

    function updateBottom() {
        var rect = footer.getBoundingClientRect();
        var overlap = Math.max(0, window.innerHeight - rect.top);
        fab.style.bottom = (overlap + 16) + "px";
    }

    window.addEventListener("scroll", updateBottom, { passive: true });
    window.addEventListener("resize", updateBottom);
    updateBottom();
})();
