// fullscreen.js — small helper to toggle fullscreen and update icon
export function initFullscreen(buttonSelector = "#fullscreen-btn", iconSelector = "#fullscreen-icon") {
  const btn = document.querySelector(buttonSelector);
  const icon = document.querySelector(iconSelector);
  if (!btn) return;

  btn.addEventListener("click", async () => {
    try {
      if (!document.fullscreenElement) {
        await document.documentElement.requestFullscreen();
        if (icon) icon.classList.replace("fa-expand-arrows-alt", "fa-compress-arrows-alt");
      } else {
        await document.exitFullscreen();
        if (icon) icon.classList.replace("fa-compress-arrows-alt", "fa-expand-arrows-alt");
      }
    } catch (e) {
      console.warn("Fullscreen toggle failed", e);
    }
  });
}
