/* Host keeps template layout (dividers, negative margins, etc.) */
.ivita-has-bg-media {
  position: relative;
  isolation: isolate;
  overflow: visible;
  /* Template often paints placeholder.png on this element. Slides fade with opacity, so that background shows through unless it is cleared. */
  background-image: none !important;
}

/* Full-bleed covers/popups may clip internally */
.ivita-has-bg-media.header-popup,
.ivita-has-bg-media.mn-cover-screen,
.ivita-has-bg-media.ivita-cover,
.ivita-has-bg-media.mn-photo-frame {
  overflow: hidden;
}

/* Background layer shell — behind all section content/dividers */
.ivita-bg-media-shell {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}

.ivita-bg-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.ivita-bg-slideshow .ivita-bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1);
  filter: blur(0);
  transition: opacity 2.2s ease-in-out;
  backface-visibility: hidden;
}

.ivita-bg-slideshow .ivita-bg-slide.is-active {
  opacity: 1;
  animation: ivita-bg-ken 10s ease-out forwards;
}

@keyframes ivita-bg-ken {
  0% {
    transform: scale(1);
    filter: blur(0.8px);
  }
  14% {
    filter: blur(0);
  }
  100% {
    transform: scale(1.09);
    filter: blur(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ivita-bg-slideshow .ivita-bg-slide,
  .ivita-bg-slideshow .ivita-bg-slide.is-active {
    animation: none;
    transform: none;
    filter: none;
  }
}

.ivita-bg-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Section dividers — keep template positioning, only raise stacking order */
.ivita-has-bg-media > svg[class*="section-divider"],
.ivita-has-bg-media > svg[class*="divider"] {
  z-index: 2;
}

/* Divider blocks (section/img) above background */
.ivita-has-bg-media > [class*="divider"]:not(.ivita-bg-media-shell):not(.ivita-bg-media) {
  z-index: 2;
}

/* Regular content sits above background, below explicit dividers if any */
.ivita-has-bg-media > *:not(.ivita-bg-media-shell):not(.ivita-bg-media):not(svg):not([class*="divider"]) {
  position: relative;
  z-index: 1;
}
