'use client'; import { useEffect, useState } from 'react'; /** True at ≥ 768 px (Tailwind `md`). False during SSR and the first client render (mobile-first). */ export function useIsDesktop(): boolean { const [desktop, setDesktop] = useState(false); useEffect(() => { const mq = window.matchMedia('(min-width: 768px)'); const apply = () => setDesktop(mq.matches); apply(); mq.addEventListener('change', apply); return () => mq.removeEventListener('change', apply); }, []); return desktop; }