"use client";

import { useHeaderUI } from "./HeaderUIProvider";

/**
 * Production: `<div class="body-overlay"></div>` is a direct child of body
 * (rendered by both index.php line 6 and header.php line 5 — production has two; we render one).
 * CSS (consolidated into /public/css/site.css) styles it as fixed-position fullscreen overlay.
 */
export default function BodyOverlay() {
  const { isMenuOpen, isSidebarOpen, closeAll } = useHeaderUI();
  const active = isMenuOpen || isSidebarOpen;
  return <div className={`body-overlay${active ? " active" : ""}`} onClick={closeAll} />;
}
