From a6bd4c53ff33629a18c22f6e8a436bf51ec372af Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
Date: Tue, 19 May 2026 01:04:43 +0000
Subject: fix(nav): close dropdowns and hamburger on touch / outside click

Two related touch fixes:

- Dropdown :hover rule was sticky on touch devices after a tap, keeping
  the menu visible even when the click toggle set open to false. Gate
  the hover rule behind @media (hover: hover) so only true pointer
  devices use the hover path; touch uses the click-driven open class.

- Hamburger menu had no outside-click close. Added a window click
  handler that closes isMenuOpen when the target is outside .header.
  Clicks on the toggle and on nav items stay inside .header, so opening
  and item navigation are unaffected.
---
 src/routes/+layout.svelte | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index a7a03066..04c155eb 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -217,7 +217,12 @@ $: {
 
 <HeadTitle />
 
-<svelte:window on:keydown={(e) => { if (e.key === 'Escape' && isMenuOpen) isMenuOpen = false; }} />
+<svelte:window
+  on:keydown={(e) => { if (e.key === 'Escape' && isMenuOpen) isMenuOpen = false; }}
+  on:click={(e) => {
+    if (isMenuOpen && !(e.target as HTMLElement).closest('.header')) isMenuOpen = false;
+  }}
+/>
 
 <CommandPalette
   items={[
-- 
cgit v1.2.3

