Skip to content

Commit 1679360

Browse files
committed
feat(mobile): add touch-friendly utilities and responsive helpers
1 parent 7a73f16 commit 1679360

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

src/index.css

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,110 @@ textarea:focus-visible,
424424
border-color: color-mix(in oklab, var(--color-text-secondary) 35%, transparent) !important;
425425
}
426426
.appearance-contrast .theme-text-secondary { color: color-mix(in oklab, var(--color-text-secondary) 120%, black) !important; }
427+
428+
/*
429+
* Mobile Optimization Utilities
430+
* Touch-friendly targets (WCAG 2.5.5 - 44x44px minimum)
431+
*/
432+
@layer utilities {
433+
/* Touch-friendly target sizes */
434+
.touch-target {
435+
min-height: 44px;
436+
min-width: 44px;
437+
}
438+
439+
.touch-target-lg {
440+
min-height: 48px;
441+
min-width: 48px;
442+
}
443+
444+
/* Safe area padding for notched devices */
445+
.safe-area-inset {
446+
padding-top: env(safe-area-inset-top, 0);
447+
padding-right: env(safe-area-inset-right, 0);
448+
padding-bottom: env(safe-area-inset-bottom, 0);
449+
padding-left: env(safe-area-inset-left, 0);
450+
}
451+
452+
.safe-area-bottom {
453+
padding-bottom: env(safe-area-inset-bottom, 0);
454+
}
455+
456+
/* Hide on mobile / show on desktop */
457+
.mobile-hidden {
458+
@apply hidden sm:block;
459+
}
460+
461+
.desktop-hidden {
462+
@apply block sm:hidden;
463+
}
464+
465+
/* Mobile-optimized scrolling */
466+
.scroll-touch {
467+
-webkit-overflow-scrolling: touch;
468+
overscroll-behavior: contain;
469+
}
470+
471+
/* Prevent text selection on touch (for buttons) */
472+
.no-select {
473+
-webkit-user-select: none;
474+
user-select: none;
475+
-webkit-touch-callout: none;
476+
}
477+
478+
/* Tap highlight removal */
479+
.no-tap-highlight {
480+
-webkit-tap-highlight-color: transparent;
481+
}
482+
}
483+
484+
/* Mobile-first responsive breakpoints */
485+
@media (max-width: 640px) {
486+
/* Increase touch targets on mobile */
487+
button,
488+
[role="button"],
489+
a,
490+
input[type="checkbox"],
491+
input[type="radio"] {
492+
min-height: 44px;
493+
}
494+
495+
/* Stack horizontal layouts on mobile */
496+
.mobile-stack {
497+
flex-direction: column !important;
498+
}
499+
500+
/* Full width on mobile */
501+
.mobile-full {
502+
width: 100% !important;
503+
max-width: 100% !important;
504+
}
505+
506+
/* Hide scrollbars on mobile (use swipe) */
507+
.mobile-hide-scrollbar {
508+
scrollbar-width: none;
509+
-ms-overflow-style: none;
510+
}
511+
.mobile-hide-scrollbar::-webkit-scrollbar {
512+
display: none;
513+
}
514+
}
515+
516+
/* Tablet breakpoint adjustments */
517+
@media (min-width: 641px) and (max-width: 1024px) {
518+
.tablet-cols-2 {
519+
grid-template-columns: repeat(2, 1fr) !important;
520+
}
521+
}
522+
523+
/* Landscape mode on mobile */
524+
@media (max-width: 896px) and (orientation: landscape) {
525+
.landscape-compact {
526+
padding-top: 0.5rem !important;
527+
padding-bottom: 0.5rem !important;
528+
}
529+
530+
.landscape-hidden {
531+
display: none !important;
532+
}
533+
}

0 commit comments

Comments
 (0)