/**
 * p.amline.ir (?direct=1) scroll fix
 *
 * Direct mode mounts a fixed .direct-mobile-runtime with overflow:hidden and
 * body { overflow:hidden }. Screens that are NOT wrapped in .mobile-scroll
 * (OTP login / auth loading) become unscrollable when content or the soft
 * keyboard overflows the viewport.
 */

/* Login / auth loading: allow vertical scroll inside the fixed runtime */
.direct-mobile-runtime .auth-gate.amline-screen,
.direct-mobile-runtime [data-testid='otp-login-screen'],
.direct-mobile-runtime [data-testid='auth-loading'] {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  /* Prefer start alignment so tall forms can scroll instead of being clipped */
  place-items: start center;
  align-content: start;
  padding-block: max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-bottom, 0px));
}

.direct-mobile-runtime .auth-gate__card {
  margin-inline: auto;
  width: min(100%, 380px);
}

/* Native touch scrolling in direct mode; keep rubber-band contained */
.direct-mobile-runtime .mobile-scroll {
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Nested horizontal rails must opt into pan-x (ancestor pan-y can steal gestures) */
.direct-mobile-runtime .home-quick-scroll,
.direct-mobile-runtime .app-filter-chips,
.direct-mobile-runtime .mobile-carousel {
  touch-action: pan-x;
  overscroll-behavior-x: contain;
}

/* Let scroll content grow with children instead of locking to one viewport row */
.direct-mobile-runtime .mobile-scroll-content {
  height: auto;
  align-content: start;
  grid-template-rows: auto;
}

.direct-mobile-runtime .mobile-scroll-content > .home-dashboard,
.direct-mobile-runtime .mobile-scroll-content > .contract-app,
.direct-mobile-runtime .mobile-scroll-content > .app-page {
  height: auto;
}
