/* ==========================================================================
   Bello preloader — enqueued by the Bello Preloader plugin.
   Edit via the filters in bello-preloader.php, not by hand (updates overwrite).
   ========================================================================== */

:root {
  --bp-bg: #7664FF;     /* PHP overrides these inline; kept as fallbacks */
  --bp-dur: 3000ms;
  --bp-slide: 900ms;
  --bp-ease: cubic-bezier(0.76, 0, 0.24, 1);
  --bp-shift: 100vh;    /* JS replaces this with the measured viewport height */
}

/* Returning visitor: the head script sets this before first paint, so the
   overlay never flashes. Scroll lock + the html-level ground live in the
   inline boot style printed by PHP, so they apply on the very first frame. */
html[data-bp="done"] #bello-preloader { display: none; }

#bello-preloader {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  background: var(--bp-bg);
  transform: translateY(0);
}

/* Elementor sticky headers, popups and the admin bar all stack high — sit
   above them, and stop theme rules reaching into the artwork. */
#bello-preloader svg { display: block; max-width: none; height: auto; }
body.admin-bar #bello-preloader { top: 0; }

/* The injected artwork. Fades in so the ground and the wordmark read as one
   deliberate moment rather than a pop-in. */
#bello-preloader .bp-art {
  width: min(86vw, 560px);
  height: auto;
  opacity: 0;
  transition: opacity 180ms ease;
}
#bello-preloader.bp-ready .bp-art { opacity: 1; }

/* Hold every frame paused until we explicitly start, so the timeline can't
   drift while the SVG is still being fetched.
   NOTE: target DIRECT children of the frame wrapper only — matching the
   wrapper itself would knock out the whole artwork. */
#bello-preloader #bp-Preloader-Frame > g { animation-play-state: paused; }
#bello-preloader.bp-play #bp-Preloader-Frame > g { animation-play-state: running; }

/* ==========================================================================
   Exit: the push
   The panel and the page travel up together over the same distance, at the
   same time, on the same curve — so they read as one surface rather than two
   things that happen to be animating.
   JS tags the page's top-level blocks with .bp-page-slide, sets the exact
   pixel distance in --bp-shift, then flips .bp-push -> .bp-push-go.
   ========================================================================== */

/* Step 1: seat the page one viewport below, with no transition. Invisible to
   the visitor — the panel is still covering everything at this point. */
html.bp-push .bp-page-slide {
  transform: translateY(var(--bp-shift));
}

html.bp-push #bello-preloader,
html.bp-push .bp-page-slide {
  will-change: transform;
}

/* Step 2: both surfaces travel up one viewport. */
html.bp-push-go #bello-preloader {
  transform: translateY(-100%);
  transition: transform var(--bp-slide) var(--bp-ease);
  pointer-events: none;
}

html.bp-push-go .bp-page-slide {
  transform: translateY(0);
  transition: transform var(--bp-slide) var(--bp-ease);
}

/* Both classes are removed when the transition ends, which drops `transform`
   entirely rather than leaving translateY(0) behind. That matters: any
   transform on an ancestor — even a zero one — makes descendant
   `position: fixed` resolve against that ancestor instead of the viewport,
   which would quietly break Elementor sticky headers after the intro. */

/* --------------------------------------------------------------------------
   Reduced motion: no travel. Skip the flipbook, hold the final wordmark,
   and cross-fade out instead of sliding.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #bello-preloader #bp-Preloader-Frame > g {
    animation: none !important;
    opacity: 0 !important;
  }
  /* Extra id needed to outrank the rule above at equal importance. */
  #bello-preloader #bp-Preloader-Frame > g#bp-Logo { opacity: 1 !important; }

  html.bp-push .bp-page-slide,
  html.bp-push-go .bp-page-slide {
    transform: none !important;
    transition: none !important;
  }
  html.bp-push-go #bello-preloader {
    transform: none !important;
    opacity: 0;
    transition: opacity 200ms ease !important;
  }
}
