import { Grid } from 'antd';

const { useBreakpoint } = Grid;

/**
 * Shared mobile detection hook.
 * Replaces duplicated `const screens = Grid.useBreakpoint(); const isMobile = !screens.md;`
 *
 * Breakpoints (Ant Design defaults):
 *   xs: 0px, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1600px
 */
export function useMobile() {
  const screens = useBreakpoint();
  const isMobile = !screens.md;    // < 768px
  const isSmall = !screens.sm;     // < 576px (very narrow phones)
  const isTablet = !!screens.md && !screens.lg; // 768–991px
  return { isMobile, isSmall, isTablet, screens };
}
