/**
 * Scroll-up reveal for the property address banner on /homes/* pages.
 *
 * position: sticky doesn't work here — body has overflow:hidden auto which
 * breaks sticky containing-block resolution. Instead we use position:fixed
 * combined with a JS-injected placeholder that occupies the bar's natural
 * flow space when the bar is pinned. Layout is preserved; the bar can pin
 * to the viewport top.
 *
 * States (managed by address-bar.js):
 *   - No class (scrollY < natural Y): bar in normal flow at its natural Y.
 *     Placeholder is display:none.
 *   - .--sticky (scrollY ≥ natural Y): bar position:fixed at top:0, visible.
 *     Placeholder takes its 59px flow space so content below doesn't shift.
 *   - .--sticky + .--hidden: bar slides off-screen via transform.
 */

.property-address-banner.property-address-banner--sticky {
    position: fixed !important;
    /* Pin BELOW the fixed site header. address-bar.js sets --rt-addr-top to the
       header's live height (0 fallback before JS runs / if header absent). */
    top: var(--rt-addr-top, 0) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    transform: translateY(0) !important;
    transition: transform 0.3s ease-out !important;
    will-change: transform;
    /* Below the fixed nav (z-index:1000) so the banner slides UNDER it on
       scroll-down instead of over it; still above page content. */
    z-index: 900;
}

/* On scroll-DOWN the bar hides: slide it up by its own full height PLUS the
   header offset (--rt-addr-top) so it clears the viewport entirely above the
   fixed nav, rather than stopping at top:--rt-addr-top and overlapping it. */
.property-address-banner.property-address-banner--sticky.property-address-banner--hidden {
    transform: translateY(calc(-100% - var(--rt-addr-top, 0px))) !important;
}

/* Placeholder injected by JS — sits where the bar's flow space would be
   while the bar is pinned. */
.property-address-banner-placeholder {
    display: none;
    width: 100%;
}
.property-address-banner-placeholder.is-active {
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .property-address-banner.property-address-banner--sticky {
        transition: none !important;
    }
}

/* Never show the address banner while the full-screen takeover (hamburger) menu
   is open. rt-header.js sets html.rt-drawer-lock when the drawer opens. The
   banner's lowered z-index already puts it behind the drawer (z-index:2000), but
   hide it outright so no edge can peek through. */
html.rt-drawer-lock .property-address-banner{ display: none !important; }

/* Touch devices (iPhone/iPad/Android): the JS scroll-reveal is disabled (see
   address-bar.js isCoarsePointer gate). Force the banner to stay in normal flow
   so it can never be pinned/positioned (belt-and-suspenders against the plugin or
   a leftover inline style), which is what caused the iOS-Chrome flash loop. */
@media (pointer: coarse) {
    .property-address-banner,
    .property-address-banner.property-address-banner--sticky {
        position: static !important;
        top: auto !important;
        transform: none !important;
    }
    .property-address-banner-placeholder { display: none !important; }
}
