/* JR Platform Theme V1.4 — isolated mobile/touch UX layer.
   Everything below is mobile-only; desktop/PC layouts remain governed by style.css. */

@media (max-width:780px){
 html{scroll-padding-top:calc(var(--jr-header-h,58px) + var(--jr-admin-offset,0px));-webkit-text-size-adjust:100%}
 body{overscroll-behavior-y:none}
 body.jrpt-member{padding-bottom:calc(var(--jr-mobile-nav-h,64px) + env(safe-area-inset-bottom))}
 body.jrpt-chat-app{padding-bottom:0}
 body.jrpt-menu-open{overflow:hidden;touch-action:none}
 :where(button,[role="button"],input[type="button"],input[type="submit"],input[type="reset"],select){touch-action:manipulation;-webkit-tap-highlight-color:transparent}
 :where(input:not([type="checkbox"]):not([type="radio"]),textarea,select){font-size:16px}

 /* Header / navigation: no edge-swipe interception; use explicit 44px controls. */
 .jrpt-edge-handle{display:none!important}
 .jrpt-fallback-header{grid-template-columns:minmax(0,1fr) auto;height:58px;padding-left:calc(10px + env(safe-area-inset-left));padding-right:calc(8px + env(safe-area-inset-right))}
 .jrpt-fallback-header form{display:none}.jrpt-fallback-menu{display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:50%;background:#3a3b3c;color:#e4e6eb}.jrpt-fallback-menu svg{width:22px;height:22px}
 .jrpt-mobile-nav a,.jrpt-mobile-nav button{min-width:0;min-height:56px;padding:4px 2px;touch-action:manipulation}
 .jrpt-mobile-nav b{display:grid;place-items:center;width:26px;height:26px}.jrpt-mobile-nav .jrpt-icon{width:22px;height:22px}
 .jrpt-mobile-drawer{width:min(90vw,390px)!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
 .jrpt-mobile-drawer header button{width:44px!important;height:44px!important;display:grid;place-items:center}.jrpt-mobile-drawer header button svg{width:22px;height:22px}
 .jrpt-mobile-drawer nav a{min-height:50px;padding:8px 10px!important}.jrpt-mobile-drawer nav b{width:34px!important;height:34px;display:grid;place-items:center}.jrpt-mobile-drawer nav .jrpt-icon{width:21px;height:21px}

 /* Main content: use the available phone width, preserve desktop widths above 780px. */
 .jrpt-main,.jrpt-main.no-sidebars{width:100%!important;max-width:none!important;padding:8px 7px calc(14px + env(safe-area-inset-bottom))!important;margin:0!important;display:block!important}
 .jrpt-content{width:100%;min-width:0}.jrpt-content>article>h1{font-size:22px;margin:6px 4px 12px}
 .jrpt-content :where(img,video,iframe,canvas){max-width:100%}
 .jrpt-content :where(table){max-width:100%}
 .jrpt-content .wp-block-table{overflow-x:auto;-webkit-overflow-scrolling:touch}

 /* Shared modal/dialog ergonomics. */
 :where(.jraf-modal,.jraf-edit-modal,.jrg-modal,.jrfor-modal,.jrc-modal){padding:0!important;align-items:flex-end!important}
 :where(.jraf-modal>section,.jraf-edit-modal>section,.jrg-modal>section,.jrfor-modal>section,.jrc-modal>section){width:100%!important;max-width:none!important;max-height:88dvh!important;overflow:auto!important;overscroll-behavior:contain;border-radius:18px 18px 0 0!important;padding-bottom:calc(14px + env(safe-area-inset-bottom))!important}

 /* Activity Feed: thumb-friendly composer and action rows. */
 .jraf-app{width:100%!important;max-width:none!important}
 .jraf-composer,.jraf-card{border-radius:12px!important}
 .jraf-composer{padding:12px!important}.jraf-compose-modes{display:flex;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}.jraf-compose-modes::-webkit-scrollbar{display:none}
 .jraf-compose-modes button,.jraf-tool,.jraf-actions>button,.jraf-actions>a,.jraf-react-main,.jraf-menu-toggle{min-height:44px!important}
 .jraf-actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px!important}.jraf-actions>button,.jraf-actions>a{justify-content:center!important;min-width:0!important;padding:7px 4px!important}
 .jraf-comment-form{gap:6px!important}.jraf-comment-form input{min-height:44px;font-size:16px!important}.jraf-comment-form button{min-width:52px;min-height:44px}
 .jraf-menu-panel{right:4px!important;max-width:calc(100vw - 24px)}
 .jraf-share-quick{display:grid!important;grid-template-columns:1fr 1fr!important}.jraf-share-quick button{min-height:44px}

 /* Community, profiles, friends. */
 .jrc-members-toolbar{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}.jrc-members-toolbar :where(input,select,button){width:100%!important;min-height:44px!important}
 .jrc-tablist,.jrc-profile-tabs,.jrc-account-nav,.jrf-subtabs{display:flex!important;overflow-x:auto!important;overscroll-behavior-inline:contain;scroll-snap-type:x proximity;scrollbar-width:none}.jrc-tablist::-webkit-scrollbar,.jrc-profile-tabs::-webkit-scrollbar,.jrc-account-nav::-webkit-scrollbar,.jrf-subtabs::-webkit-scrollbar{display:none}
 .jrc-tablist a,.jrc-profile-tabs a,.jrc-account-nav a,.jrf-subtabs a{flex:0 0 auto;min-height:44px;display:flex;align-items:center;scroll-snap-align:start}
 .jrc-button,.jrf-action-button,.jrf-friend-button,.jrf-message-button,.jrf-dropdown-action{min-height:44px!important}
 .jrf-request-card{gap:9px!important}.jrf-request-actions{display:grid!important;grid-template-columns:1fr 1fr;gap:7px}.jrf-request-actions button{min-height:44px}

 /* Groups / Forums: stack toolbars, make menus/buttons touchable, keep horizontal tabs scrollable. */
 .jrg-group-nav,.jrg-member-nav,.jrfor-subtabs{overflow-x:auto!important;overscroll-behavior-inline:contain;scrollbar-width:none;white-space:nowrap}.jrg-group-nav::-webkit-scrollbar,.jrg-member-nav::-webkit-scrollbar,.jrfor-subtabs::-webkit-scrollbar{display:none}
 .jrg-group-nav a,.jrg-member-nav a,.jrfor-subtabs a{min-height:44px;display:inline-flex;align-items:center}
 .jrg-button,.jrg-link-button,.jrg-post-actions button,.jrg-post-menu summary,.jrfor-button,.jrfor-post-menu summary,.jrfor-react-main{min-height:44px!important}
 .jrg-header-actions,.jrg-inline-actions,.jrfor-topic-actions,.jrfor-post-top-actions{flex-wrap:wrap!important;gap:6px!important}
 .jrg-form :where(input,textarea,select),.jrfor-compose :where(input,textarea,select){font-size:16px!important;min-height:44px}
 .jrg-photo-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}

 /* Notifications handled in plugin too; this aligns with theme bottom navigation. */
 .jrn-page{max-width:none!important}.jrn-filter{padding-left:1px;padding-right:1px}

 /* Media library: upload controls stack instead of squeezing. */
 .jrml{width:100%!important;max-width:none!important}.jrml form{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}.jrml form :where(input,select,button){width:100%!important;min-height:44px!important}.jrml-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}.jrml-file{min-width:0!important;overflow-wrap:anywhere}

 /* Sessions / 2FA / privacy / verification / settings. */
 .jrsess article{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}.jrsess article button,.jrsess button{min-height:44px!important;width:100%}
 .jr2fa :where(input,button,select),.jrpv-wrap :where(input,button,select),.jrv-wrap :where(input,button,select){min-height:44px!important;font-size:16px!important}.jr2fa button,.jrv-form button{width:100%}.jr2fa code,.jr2fa pre{white-space:pre-wrap;overflow-wrap:anywhere}
 .jrpv-user{grid-template-columns:1fr!important;gap:8px!important}.jrpv-user button{width:100%}
 .jrsh{grid-template-columns:1fr!important}.jrsh aside{overflow-x:auto!important;overscroll-behavior-inline:contain}.jrsh aside nav{display:flex!important;min-width:max-content}.jrsh aside a{min-height:44px;display:flex!important;align-items:center}

 /* Polls/quizzes/saved: larger answer and action targets. */
 .jrpoll-option,.jrquiz-choices label{min-height:48px!important;display:flex!important;align-items:center!important}.jrquiz-submit,.jrquiz-retake,.jrsi-save{min-height:44px!important}

 /* Moderation/report actions must be discoverable on touch, not hover-only. */
 .jrmod-report-button,[data-jrmod-report]{opacity:1!important;visibility:visible!important;min-height:44px}
}

@media (max-width:430px){
 .jrml-grid{grid-template-columns:1fr!important}
 .jrg-photo-grid{grid-template-columns:1fr!important}
 .jraf-card{border-left:0!important;border-right:0!important;border-radius:0!important;margin-left:-7px!important;margin-right:-7px!important}
 .jraf-composer{margin-left:-2px!important;margin-right:-2px!important}
}

@media (hover:none) and (pointer:coarse){
 /* Touch has no hover: make controls visible and avoid sticky hover states. */
 :where(.jraf-menu-toggle,.jrg-post-menu summary,.jrfor-post-menu summary,.jrchat-header-btn,.jrchat-tool-btn){-webkit-tap-highlight-color:transparent}
 :where(.jraf-card,.jrg-feed-card,.jrfor-post,.jrchat-conv-row,.jrchat-room-row){-webkit-touch-callout:default}
}

@media (prefers-reduced-motion:reduce){
 html{scroll-behavior:auto!important}
 *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
}

@media (max-width:780px){
 /* Reduce initial layout/paint work on long social timelines without changing desktop rendering. */
 .jraf-card,.jrg-feed-card,.jrfor-post{content-visibility:auto;contain-intrinsic-size:auto 560px}
 body.jrpt-chat-app .jrn-bell:not(.jrn-bell--floating) .jrn-panel{max-height:calc(100dvh - var(--jr-header-h,58px) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 14px)}
}
