/* Also loaded on Elementor pages, which do not load app.css. */
:root {
    --ir-bottom-safe: env(safe-area-inset-bottom, 0px);
    /* Keep the initial zero typed as a length, even after CSS minification. */
    --ir-bottom-bars-height: calc(0 * 1px);
    --ir-bottom-launcher-gap: 16px;
    /* The comment plugin's floating filter pill rides higher than the launchers. */
    --ir-bottom-filters-gap: 24px;
    --ir-bottom-launcher-size: 40px;
    --ir-bottom-launcher-bottom: calc(var(--ir-bottom-safe) + var(--ir-bottom-bars-height) + var(--ir-bottom-launcher-gap));
    --ir-mobile-bar-height: 75px;
}

/* Only measured, viewport-fixed participants are positioned by the stack. */
[data-ir-bottom-stacked] {
    bottom: calc(var(--ir-bottom-safe) + var(--ir-bottom-offset)) !important;
    z-index: var(--z-index-sticky, 30) !important;
}

/* The vendor's bottom transition would briefly move this bar through its neighbours. */
#irb-sticky-banner-1[data-ir-bottom-stacked] {
    transition-property: opacity, transform, visibility;
}

@media (max-width: 767px) {
    /* Keep AdPulse's native -12px close-button offset. Its own stacking
       context must paint over the next row so the overhang stays clickable. */
    .apx-u[data-apx-slot="floating-notice-1"][data-ir-bottom-stacked] {
        z-index: calc(var(--z-index-sticky, 30) + 2) !important;
    }

    /* Give the legacy banner's native close button the same clearance when
       it overhangs the notice. This changes paint order, not row geometry. */
    #irb-sticky-banner-1[data-ir-bottom-stacked] {
        z-index: calc(var(--z-index-sticky, 30) + 3) !important;
    }
}

#ir-bottom-stack-spacer {
    display: block;
    height: var(--ir-bottom-bars-height);
}

.ir-bottom-launcher,
.iranrebate-toc--sidebar .toc-fab {
    box-sizing: border-box;
    width: var(--ir-bottom-launcher-size);
    height: var(--ir-bottom-launcher-size);
    bottom: var(--ir-bottom-launcher-bottom, 16px) !important;
    z-index: var(--z-index-floating, 55);
}

[data-ir-bottom-launcher="toc"],
.iranrebate-toc--sidebar .toc-fab {
    left: 16px;
}

/* The advanced-comment-plugin's filter pill (`.filters.fixed`, toggled on
   scroll at ≤760px) is a floater like the launchers: it reserves no space and
   keeps its own centred position between the two icons, so only its lift is
   coordinated — 24px above the topmost visible bar instead of the plugin's
   fixed 32px from the viewport edge. `!important` beats the plugin's rule. */
.c-c-p .comments-area .filters-area .filters.fixed {
    bottom: calc(var(--ir-bottom-safe) + var(--ir-bottom-bars-height) + var(--ir-bottom-filters-gap)) !important;
}

/* Beat the widget and the legacy Customizer rule without sizing the iframe. */
body #goftino_w {
    z-index: var(--z-index-floating, 55) !important;
}

/* Keep 10px of room inside the iframe for the native icon's shadow/badge.
   The iframe stylesheet anchors the actual 40px button to that inset. */
body #goftino_w[data-ir-goftino-collapsed] {
    --ir-goftino-inset: 10px;
    --ir-goftino-right: 16px;
    --ir-goftino-bottom: var(--ir-bottom-launcher-bottom);
    right: calc(var(--ir-goftino-right) - var(--ir-goftino-inset)) !important;
    left: auto !important;
    bottom: calc(var(--ir-goftino-bottom) - var(--ir-goftino-inset)) !important;
}

@media (width >= 64rem) {
    body #goftino_w[data-ir-goftino-collapsed] {
        --ir-goftino-right: 32px;
    }

    :root:not([data-ir-bottom-bars-visible]) #goftino_w[data-ir-goftino-collapsed] {
        --ir-goftino-bottom: 32px;
    }
}
