<script type="module">
document.addEventListener("DOMContentLoaded", async () => {
const loader = document.querySelector(".loader");
const left = document.querySelector(".left-column");
const right = document.querySelector(".right-column");
try {
// ✅ Fetch and parse the JSON data
const res = await fetch("./data.json");
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
// ✅ Populate the DOM with JSON data
console.log("Data loaded:", data);
// ✅ Reveal the columns once data is ready
left.classList.replace("hidden", "visible");
right.classList.replace("hidden", "visible");
} catch (err) {
console.error("Error loading JSON:", err);
loader.textContent = "⚠️ Failed to load data.";
return;
}
// ✅ Hide the loader when done
loader.remove();
});
</script>