Julien Martin efc2ef442c feat(vitrine): proposition « Horizon nuit » (nocturne, or, serif)
- Cormorant Garamond + Sora, fond profond et halos discrets
- Accueil en colonnes : prose vitrée, principes en file or, zone constellation
- Nav minimaliste caps, menu mobile, CTA en contours dorés
- Pages intérieures en panneau translucide

Made-with: Cursor
2026-04-22 19:00:31 +02:00

43 lines
1.3 KiB
JavaScript

(function () {
var nav = document.getElementById("hn-nav");
if (!nav) return;
var toggle = document.getElementById("hn-nav-toggle");
var mq = window.matchMedia("(max-width: 51.99rem)");
function setOpen(open) {
nav.classList.toggle("is-open", open);
if (toggle) {
toggle.setAttribute("aria-expanded", open ? "true" : "false");
toggle.setAttribute("aria-label", open ? "Fermer le menu" : "Ouvrir le menu");
}
}
if (toggle) {
toggle.addEventListener("click", function () {
var next = !nav.classList.contains("is-open");
setOpen(next);
if (next) {
var first = nav.querySelector(".hn-nav-list a");
if (first) requestAnimationFrame(function () { first.focus(); });
}
});
}
document.addEventListener("keydown", function (e) {
if (e.key === "Escape" && nav.classList.contains("is-open")) {
setOpen(false);
if (toggle) toggle.focus();
}
});
nav.querySelectorAll(".hn-nav-list a").forEach(function (a) {
a.addEventListener("click", function () {
if (mq.matches) setOpen(false);
});
});
mq.addEventListener("change", function (ev) {
if (!ev.matches) setOpen(false);
});
})();