From b2fe8acbfeedbfff6b49019764e56570555be392 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
Date: Fri, 15 May 2026 09:02:42 +0000
Subject: feat(a11y): respect prefers-reduced-motion

Add a global reduced-motion media query that collapses animation and
transition durations and disables smooth scroll. Skip Lenis init when
the same preference is set so the JS-driven smooth scroll falls back to
the browser default, which the spec already honours.
---
 src/routes/+layout.svelte | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/routes/+layout.svelte')

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index e1677b44..4aaf2159 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -98,9 +98,11 @@ const handleScroll = () => {
 
 onMount(async () => {
 	if (browser) {
-		lenis = new Lenis({ autoRaf: true });
+		if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
+			lenis = new Lenis({ autoRaf: true });
 
-		lenisStore.set(lenis);
+			lenisStore.set(lenis);
+		}
 
 		if (await localforage.getItem("redirect")) {
 			window.location.href = (await localforage.getItem("redirect")) ?? "/";
-- 
cgit v1.2.3

