/* ==========================================================
   N5TG V1.0.59 — Unified scroll layer (loads after every other sheet)
   ----------------------------------------------------------
   Before: frontend.css alone contained 20+ competing scroll-snap rules
   ("proximity" vs "mandatory", "smooth" vs "auto", stop "normal" vs
   "always"), and in iPad-portrait ticker mode the .rn-reels-shell became
   a second scroll container 122px shorter than the feed inside it, so a
   swipe scrolled the shell instead of the news.
   After: exactly one scroll container (#rn-feed-wrapper) with mandatory
   snapping and one card per swipe on every device.
   ========================================================== */

/* The shell frames the feed; it must never scroll itself. */
html body:not(#rn-x) .rn-reels-shell {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    scroll-snap-type: none !important;
}

/* The feed is the only scroller. */
html body .rn-reels-shell > #rn-feed-wrapper,
html body #rn-feed-wrapper {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scroll-snap-type: y mandatory !important;
    scroll-behavior: auto !important;          /* JS animates wheel steps; touch stays native */
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overflow-anchor: none !important;          /* AJAX pages / ad removal never shift the card */
    scrollbar-width: none !important;
}
html body #rn-feed-wrapper::-webkit-scrollbar { display: none !important; }

html body #rn-feed-wrapper > .rn-feed-card {
    scroll-snap-align: start !important;
    scroll-snap-stop: always !important;
    transform: none !important;                /* reels-engine transforms are retired */
}

html body #rn-feed-wrapper > .rn-feed-loader,
html body #rn-feed-wrapper > .rn-feed-end,
html body #rn-feed-wrapper > .rn-load-more {
    scroll-snap-align: none !important;
}
html body #rn-feed-wrapper > .rn-feed-end-card {
    scroll-snap-align: start !important;
}

/* Retire the transform-based reels engine styles if a cached script adds them. */
html body #rn-feed-wrapper.rn-reels-engine-active { transform: none !important; }
html body #rn-feed-wrapper.rn-reels-engine-active > .rn-feed-card {
    position: relative !important;
    inset: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* iPad / tablet portrait with tickers: the feed must fill the shell, not the
   whole viewport, otherwise the bottom of every card hides behind the tickers. */
@media (min-width: 700px) and (max-width: 1180px) and (min-height: 850px) and (orientation: portrait) {
    html body.rn-show-feed-tickers .rn-reels-shell > #rn-feed-wrapper {
        padding-bottom: 0 !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        width: 100% !important;
    }
    html body.rn-show-feed-tickers .rn-reels-shell > #rn-feed-wrapper > .rn-feed-card {
        height: 100% !important;
        min-height: 100% !important;
        max-height: 100% !important;
    }
}

/* V1.0.61: cards (especially ads) had overscroll-behavior:contain on an
   overflow:hidden box, which swallowed the swipe — readers got stuck on ads,
   including the first card of a shared ad link. Let the swipe reach the feed. */
html body #rn-feed-wrapper > .rn-feed-card,
html body #rn-feed-wrapper > .rn-feed-card .rn-ad-media-wrap,
html body #rn-feed-wrapper > .rn-feed-card .rn-ad-content-panel,
html body #rn-feed-wrapper > .rn-feed-card .rn-feed-image,
html body #rn-feed-wrapper > .rn-feed-card .rn-news-body-area,
html body #rn-feed-wrapper > .rn-feed-card .rn-news-content-panel {
    overscroll-behavior: auto !important;
}
