/*
 * RT Tools: Sticky Scroll Cards (CONTENT-only)
 *
 * Behavior:
 * - Cards act like normal content except while a "sequence" is active.
 * - While active:
 *   - All cards participate in stacking via z-index.
 *   - All but the last card become sticky at top.
 *   - Sticky cards fade via a ::after overlay as the next card approaches.
 * - The last card never sticks and never fades.
 *
 * Tuning (set per card via Avada custom CSS):
 *   --rt-sticky-top: 0px;        (offset from top; useful for sticky site header)
 *   --rt-fade-color: #000;       (overlay color)
 *   --rt-fade-distance: 200px;   (distance used for fade 0→1 as next card approaches)
 */

.rt-sticky-scroll-cards-content {
  position: relative;
  overflow: hidden;

  /* Keep stacking predictable inside each card */
  isolation: isolate;
}

/*
 * IMPORTANT:
 * We only apply z-index ordering while the sequence is active.
 * This prevents unrelated page content from scrolling "under" old sticky layers.
 */
.rt-sticky-scroll-cards-content.is-rt-sticky-seq {
  z-index: var(--rt-z, 1);
}

/* Only cards explicitly marked sticky by JS become sticky. */
.rt-sticky-scroll-cards-content.is-rt-sticky {
  position: sticky;
  top: var(--rt-sticky-top, 0px);
}

/* Overlay above all internal content (text + BG images in inner wrappers) */
.rt-sticky-scroll-cards-content::after {
  content: "";
  position: absolute;
  inset: 0;

  background: var(--rt-fade-color, #000);
  opacity: var(--rt-fade, 0);

  pointer-events: none;
  transition: opacity 0s linear;
  will-change: opacity;

  z-index: 999; /* top of this card's isolated stacking context */
}

/* Last card never fades and never sticks */
.rt-sticky-scroll-cards-content.is-rt-sticky-last::after {
  opacity: 0 !important;
}

/* Optional: keep overlay aligned with rounded corners */
.rt-sticky-scroll-cards-content,
.rt-sticky-scroll-cards-content::after {
  border-radius: inherit;
}