/* Shared phone accessibility and visual-viewport support. */
html { -webkit-text-size-adjust:100%; scroll-padding-top:24px; }
body { overflow-wrap:break-word; }
:focus-visible { outline:3px solid #987537; outline-offset:3px; }
input,select,textarea { max-width:100%; min-width:0; font-size: max(16px,1em); scroll-margin-block:24px; }
textarea { resize:vertical; }
button,.btn,summary { touch-action:manipulation; }
.btw-mobile-notice { position:fixed; bottom:max(12px,env(safe-area-inset-bottom)); left:12px; right:12px; z-index:10000; margin:auto; max-width:620px; padding:14px 18px; border:1px solid #bca16a; border-radius:10px; background:#fff8e8; color:#172e43; box-shadow:0 4px 24px #0003; font:500 16px/1.5 system-ui,sans-serif; }
.btw-mobile-notice[hidden] { display:none; }
.btw-frame-status { font-size:16px; line-height:1.6; padding:12px; background:#f5f1e8; color:#233b50; }
.btw-frame-status a { text-decoration:underline; display:inline-block; padding:10px 0; }
dialog[open] { max-height:calc(var(--btw-viewport-height,100dvh) - 24px)!important; overflow-y:auto!important; scroll-padding-block:20px; }
dialog.member-login-dialog .member-login-popup { max-height:none; overflow:visible; }
@media (max-width:760px), (pointer:coarse) {
 button,.btn,summary,.text-link,.social-links a,.member-account-panel a,.drop-panel a,.drive-readonly-link { min-height:44px; }
 button,.social-links a { min-width:44px; }
 input:not([type=checkbox]):not([type=radio]),select { min-height:48px; }
 input,select,textarea { font-size:16px!important; }
 .btn { white-space:normal; text-align:center; line-height:1.4; }
 .social-links a { width:44px; height:44px; }
}
@media(max-width:760px) {
 .container { width:calc(100% - 32px); }
 .container>* , .member-view, .auth-card, .member-pilot-panel { min-width:0; }
 .section p,.feature-card p,.history-tile p,.member-view p { font-size:16px; }
 .main-nav.is-open { max-height:calc(var(--btw-viewport-height,100dvh) - 100px); overflow-y:auto; overscroll-behavior:contain; }
 .member-account-panel { max-width:calc(100vw - 24px); max-height:calc(var(--btw-viewport-height,100dvh) - 80px); overflow:auto; }
 .member-account-panel a,.member-account-panel button { display:flex; align-items:center; font-size:16px; }
 .member-portal-action-links,.portal-section-head,.member-calendar-primary-actions { flex-wrap:wrap; }
 .member-portal-action-links a,.drive-readonly-link { white-space:normal; overflow-wrap:anywhere; }
 iframe { max-width:100%; }
 .btw-apply-header { position:relative; }
 .btw-apply-footer { position:static; }
 .btw-apply-grid,.proposal-field-grid { grid-template-columns:minmax(0,1fr); }
 .btw-apply-field,.proposal-field { min-width:0; }
 .btw-apply-close,.member-popup-close,.btw-donation-close { flex-shrink:0; }
}
@media (max-height:500px) and (orientation:landscape) {
 dialog[open] { margin:8px auto!important; max-height:calc(var(--btw-viewport-height,100dvh) - 16px)!important; }
 .btw-apply-header { position:relative; }
 .section { padding-block:32px; }
}
@media(prefers-reduced-motion:reduce) { html {scroll-behavior:auto;} *,*::before,*::after {animation-duration:.01ms!important;transition-duration:.01ms!important;} }

@media(max-width:760px),(pointer:coarse) { dialog[open] { top:calc(var(--btw-viewport-top,0px) + 12px)!important; bottom:auto!important; margin:0 auto!important; } }

/* BTW member login modal viewport-position fix 2026-11-17 */
dialog#memberLoginDialog.member-login-dialog[open] {
  box-sizing: border-box;
  max-height: calc(var(--btw-viewport-height, 100dvh) - 24px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scroll-padding-top: 12px;
}
@media (max-width: 760px), (max-height: 650px) {
  dialog#memberLoginDialog.member-login-dialog[open] {
    position: fixed !important;
    top: calc(var(--btw-viewport-top, 0px) + 12px) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    width: min(440px, calc(100vw - 24px)) !important;
    max-height: calc(var(--btw-viewport-height, 100dvh) - 24px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  dialog#memberLoginDialog.member-login-dialog .member-login-popup {
    max-height: none !important;
    overflow: visible !important;
  }
}
@media (min-width: 761px) and (min-height: 651px) and (pointer: coarse) {
  dialog#memberLoginDialog.member-login-dialog[open] {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    max-height: calc(var(--btw-viewport-height, 100dvh) - 24px) !important;
    overflow-y: auto !important;
  }
  dialog#memberLoginDialog.member-login-dialog .member-login-popup {
    max-height: none !important;
    overflow: visible !important;
  }
}

/* BTW member smart-scroll mobile navigation 2026-11-17 */
@media(max-width:900px){
body.member-view-resources #memberGate .resources-page-layout,#memberGate .portal-page-layout{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:14px!important;min-width:0}
body.member-view-resources #memberGate .resources-page-layout>.resources-page-content,#memberGate .portal-page-layout>.resources-page-content{display:block;grid-column:auto;grid-row:auto;width:100%;max-width:100%;min-width:0;flex:1 1 auto}
body.member-view-resources #memberGate .resources-page-layout>nav.resources-side,#memberGate .portal-page-layout>nav.resources-side{display:block;position:sticky!important;top:0!important;align-self:stretch!important;grid-column:auto;grid-row:auto;flex:none;z-index:80!important;width:100%!important;max-width:100%!important;max-height:none!important;margin:0!important;padding:6px!important;border:1px solid #d8c8a9;border-radius:11px;background:rgba(255,253,247,.97);box-shadow:0 5px 18px rgba(9,32,55,.12);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);overflow-x:auto!important;overflow-y:hidden!important;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y;scrollbar-width:thin;transform:translateY(0);opacity:1;transition:transform .18s ease,opacity .18s ease,padding .18s ease,box-shadow .18s ease}
#memberGate .resources-page-layout>nav.resources-side .resources-side-inner{display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;align-items:center;width:max-content!important;min-width:100%!important;gap:5px}
#memberGate .resources-page-layout>nav.resources-side .resources-side-label,#memberGate .resources-page-layout>nav.resources-side .resources-social-footer,#memberGate .resources-page-layout>nav.resources-side .resources-side-footer{display:none!important}
#memberGate .resources-page-layout>nav.resources-side .resources-side-link,#memberGate .resources-page-layout>nav.resources-side .portal-side-page-link,#memberGate .resources-page-layout>nav.resources-side .member-google-meet-button{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;width:auto;min-height:44px;padding:9px 12px;margin:0 2px;border-radius:8px;font-size:13px;line-height:1.25;white-space:nowrap;text-decoration:none;box-sizing:border-box}
#memberGate .resources-page-layout>nav.resources-side .resources-side-link.is-active{background:#efe1c3;color:#60451a}
#memberGate .resources-page-layout>nav.resources-side.btw-member-nav-compact{padding-top:3px!important;padding-bottom:3px!important;box-shadow:0 3px 13px rgba(9,32,55,.10)}
#memberGate .resources-page-layout>nav.resources-side.btw-member-nav-hidden:not(:focus-within){transform:translateY(calc(-100% - 12px));opacity:0;pointer-events:none}
#memberGate .resources-page-layout [id^="portal-"],#memberGate .resources-page-layout [id^="resources-"]{scroll-margin-top:84px!important}
}
@media(max-width:520px){#memberGate .resources-page-layout>nav.resources-side .resources-side-link,#memberGate .resources-page-layout>nav.resources-side .portal-side-page-link,#memberGate .resources-page-layout>nav.resources-side .member-google-meet-button{font-size:12px;padding:9px 10px}}
@media(prefers-reduced-motion:reduce){#memberGate .resources-page-layout>nav.resources-side{transition:none!important}}

/* BTW fixed floating member navigation correction */
@media(max-width:900px){
#memberGate .resources-page-layout>nav.resources-side.btw-member-nav-floating,body.member-view-resources #memberGate .resources-page-layout>nav.resources-side.btw-member-nav-floating{position:fixed!important;top:max(8px,env(safe-area-inset-top))!important;left:var(--btw-member-nav-left,8px)!important;width:var(--btw-member-nav-width,calc(100vw - 16px))!important;max-width:calc(100vw - 16px)!important;z-index:900!important;align-self:auto!important;transform:none!important;opacity:1!important;pointer-events:auto!important;box-shadow:0 7px 24px rgba(7,25,42,.24)!important}
#memberGate .resources-page-layout>.btw-member-nav-placeholder{display:none;width:100%;height:0;flex:0 0 auto}
#memberGate .resources-page-layout>nav.resources-side.btw-member-nav-floating.btw-member-nav-compact{padding-top:4px!important;padding-bottom:4px!important}
}

/* Compact, accessible fallback below an embedded Google Calendar */
.btw-frame-status.btw-frame-status-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 5px 2px;
  margin: 3px 0 7px;
  background: transparent;
  border: 0;
  color: #536373;
  font: 500 12px/1.4 system-ui, sans-serif;
}
.btw-frame-status.btw-frame-status-compact a {
  display: inline-block;
  padding: 2px 3px;
  color: #22547c;
  font: 750 12px/1.4 system-ui, sans-serif;
  text-decoration: underline;
}
