/* NNB GIDA V481 — iPhone Safari Scroll Stability Final
   Loaded after the visual layers. No redesign: only scrolling/compositing stabilization. */
@media (max-width:820px) and (pointer:coarse){
  html{
    overflow-x:hidden!important;
    overscroll-behavior-x:none!important;
    scroll-behavior:auto!important;
  }
  body{
    overflow-x:clip!important;
    overscroll-behavior-x:none!important;
    -webkit-overflow-scrolling:auto;
  }

  /* Sticky glass + translateZ is one of Safari's most expensive live layers.
     Keep the same near-white material without rebuilding a blur texture each frame. */
  body .apple-topbar{
    -webkit-backdrop-filter:none!important;
    backdrop-filter:none!important;
    background:rgba(248,248,249,.985)!important;
    transform:none!important;
    will-change:auto!important;
    contain:layout style!important;
  }
  body .apple-tools,
  body .signature-footer{
    -webkit-backdrop-filter:none!important;
    backdrop-filter:none!important;
    will-change:auto!important;
  }

  /* Avoid speculative GPU layers on every catalog card. */
  body #grid>.card,
  body #grid .card-visual,
  body #grid .card-visual img{
    will-change:auto!important;
    backface-visibility:visible!important;
  }
  body #grid>.card{
    content-visibility:auto!important;
    contain:layout paint style!important;
    /* auto lets WebKit remember the measured card size after first reveal,
       preventing repeated reserve-size corrections on long catalogs. */
    contain-intrinsic-size:auto 330px!important;
  }

  /* During momentum scrolling, freeze decorative work only. Layout stays identical. */
  body.nnb-scrolling .apple-topbar,
  body.nnb-scrolling .apple-tools,
  body.nnb-scrolling #grid>.card,
  body.nnb-scrolling #grid .card-visual,
  body.nnb-scrolling #grid .card-visual img,
  body.nnb-scrolling .signature-footer{
    transition:none!important;
    animation:none!important;
    filter:none!important;
  }
  body.nnb-scrolling #grid>.card{
    box-shadow:0 8px 20px rgba(15,17,20,.045)!important;
  }
  body.nnb-scrolling #grid .card-visual img{
    transform:none!important;
  }

  /* Never let inactive fixed sheets participate in Safari compositing. */
  body #nnbqPanel:not(.show),
  body #nnbqRecipient:not(.show),
  body #detailModal:not(.show),
  body #modalBack:not(.show){
    pointer-events:none!important;
  }
}

@supports (-webkit-touch-callout:none){
  @media (max-width:820px){
    body .apple-topbar,
    body .apple-tools,
    body .signature-footer{
      -webkit-backdrop-filter:none!important;
      backdrop-filter:none!important;
    }
    /* Safari rubber-band should not reveal a differently painted root canvas. */
    html,body{background:#f5f5f7!important}
  }
}
