diff --git a/site/main.js b/site/main.js new file mode 100644 index 0000000..a505217 --- /dev/null +++ b/site/main.js @@ -0,0 +1,24 @@ +// Smooth scroll for anchor links (CSS scroll-behavior covers most cases, +// this handles the ↓ scroll-hint click on browsers that need it) +document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', e => { + const target = document.querySelector(anchor.getAttribute('href')); + if (target) { + e.preventDefault(); + target.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + }); +}); + +// Subtle parallax on hero background glow +const hero = document.querySelector('.hero'); +if (hero) { + window.addEventListener('scroll', () => { + const scrolled = window.scrollY; + const heroHeight = hero.offsetHeight; + if (scrolled < heroHeight) { + // Move the pseudo-element glow upward slightly as user scrolls + hero.style.setProperty('--parallax-offset', `${scrolled * 0.3}px`); + } + }, { passive: true }); +} diff --git a/site/style.css b/site/style.css index 46aa2ab..4a6c754 100644 --- a/site/style.css +++ b/site/style.css @@ -47,7 +47,7 @@ a { text-decoration: none; } content: ''; position: absolute; inset: 0; - background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(201,168,76,0.07) 0%, transparent 70%); + background: radial-gradient(ellipse 80% 60% at 50% calc(40% - var(--parallax-offset, 0px)), rgba(201,168,76,0.07) 0%, transparent 70%); pointer-events: none; }