/* Lumifig — fixes for phones, tablets and short windows.
   Loaded after the other styles; every rule is scoped to small or touch screens unless noted. */

/* Dialogs never grow past the screen: they scroll instead (all sizes). */
.us-modal-back .us-modal, .us-modal-back > div[role="dialog"] { max-height: calc(100dvh - 20px); max-width: calc(100vw - 16px); overflow-y: auto; overscroll-behavior: contain; }

/* Phones and narrow windows */
@media (max-width: 760px) {
    /* Side panels take the space next to the rail instead of running off screen */
    html .drawer-panel, html #library-drawer, html #left-drawer, html #right-drawer { width: calc(100vw - var(--rail-w, 58px)) !important; min-width: 0 !important; max-width: none !important; padding: 12px !important; }
    html .drawer-resizer { display: none !important; }
    html .lib-card-grid, html #library-drawer .lib-grid-2col { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    html #library-drawer .us-card { min-width: 0; }
    /* Bigger touch targets in the rail and zoom controls */
    html .zoom-cluster button { width: 36px; height: 34px; }
    /* Dialog content stacks */
    html .us-help-body { grid-template-columns: 1fr !important; }
}

/* iOS Safari and Android Chrome: 100vh includes the hidden toolbar area, which pushed the page tabs,
   zoom controls and the bottom of panels under the browser bar. Use the visible height instead. */
@supports (height: 100dvh) { html body { height: 100dvh; } }
/* Keep bottom controls clear of the iPhone home indicator */
html #zoom-dock { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
html #us-tabbar { margin-bottom: env(safe-area-inset-bottom, 0px); }
/* Prevent iOS from zooming the page when a text field gets focus (it zooms below 16px) */
@media (pointer: coarse) { html input[type="text"], html input:not([type]), html input[type="search"], html textarea, html select { font-size: 16px; } }
/* Tell the user where Properties went on phones */
@keyframes usPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(10,132,255,0); } 50% { box-shadow: 0 0 0 6px rgba(10,132,255,.35); } }
html .rail-btn.us-pulse { animation: usPulse 1s ease-in-out 2; }
