function renderProjects() { const container = document.getElementById("project-list"); if (!container || typeof projects === "undefined") return; container.innerHTML = projects.map(function (p) { var tags = p.tags.map(function (t) { return '' + t + ""; }).join(""); var links = ""; if (p.links && p.links.length > 0) { links = '"; } return ( '
' + '
' + '' + p.name + "" + '' + p.category + "" + "
" + (p.period ? '' + p.period + '' : '') + '

' + p.description + "

" + '
' + tags + "
" + links + "
" ); }).join(""); } function setupNavHighlight() { var links = document.querySelectorAll(".nav-link[href^='#']"); var sections = []; links.forEach(function (link) { var id = link.getAttribute("href").slice(1); var el = document.getElementById(id); if (el) sections.push({ el: el, link: link }); }); if (sections.length === 0) return; window.addEventListener("scroll", function () { var scrollY = window.scrollY + 80; var current = sections[0]; for (var i = 0; i < sections.length; i++) { if (sections[i].el.offsetTop <= scrollY) { current = sections[i]; } } links.forEach(function (l) { l.classList.remove("active"); }); current.link.classList.add("active"); }); } document.addEventListener("DOMContentLoaded", function () { renderProjects(); setupNavHighlight(); });