// btnarriba.js
document.addEventListener("DOMContentLoaded", function () {
  const btn = document.createElement("button");
  btn.id = "btnarriba";
  btn.title = "Ir arriba";
  btn.textContent = "▴"; // Triángulo relleno
  document.body.appendChild(btn);

  btn.addEventListener("click", function () {
    window.scrollTo({ top: 0, behavior: "smooth" });
  });

  window.addEventListener("scroll", function () {
    if (document.documentElement.scrollTop > 100 || document.body.scrollTop > 100) {
      btn.style.display = "block";
    } else {
      btn.style.display = "none";
    }
  });
});


