/* *****************************************************
   Dunamis - scroll & motion layer
   Ports the GSAP + ScrollTrigger reveal feel from the
   Dunamis marketing site into the WHMCS theme.

   This file only sets up the *base / resting states*.
   The actual motion is driven by js/dm-animations.js.
   Loaded after custom.css so it can layer on top.
***************************************************** */

/* ---- No-flash guard -------------------------------------------------
   <html> gets the `dm-anim` class from a tiny inline script in <head>,
   but ONLY when JS is on. Elements that opt into a reveal start hidden
   so they don't flash at full opacity before GSAP takes over. We gate
   it behind `prefers-reduced-motion: no-preference` so reduced-motion
   users (and no-JS users) always see content immediately.            */
@media (prefers-reduced-motion: no-preference) {
    html.dm-anim [data-ns-animate] {
        opacity: 0;
        will-change: transform, opacity, filter;
    }
}

/* Once GSAP has settled an element it carries `is-revealed`; drop the
   will-change hint so we don't keep compositor layers around forever. */
[data-ns-animate].is-revealed {
    will-change: auto;
}

/* If JS is disabled entirely, the `dm-anim` class is never added, so the
   rule above never matches and everything renders normally. As a final
   belt-and-braces guard, force visibility inside <noscript>-equivalent
   reduced-motion contexts handled in JS. */

/* ---- Reduced motion: hard opt-out ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html.dm-anim [data-ns-animate] {
        opacity: 1 !important;
        filter: none !important;
        transform: none !important;
    }
    /* Neutralise the existing pulsing uptime badge for motion-sensitive users */
    .dm-uptime .pulse { animation: none !important; }
}

/* ---- Sticky header: scrolled state ---------------------------------- */
/* The header is already sticky + blurred in custom.css. On scroll we add
   `is-scrolled` (via dm-animations.js) for a subtle lift + denser blur,
   giving the page a sense of depth as content slides underneath.       */
.dm-header {
    transition: box-shadow .3s var(--d-ease, cubic-bezier(.16,1,.3,1)),
                background-color .3s var(--d-ease, cubic-bezier(.16,1,.3,1)),
                border-color .3s var(--d-ease, cubic-bezier(.16,1,.3,1));
}
.dm-header.is-scrolled {
    background: rgba(247, 248, 252, 0.96);
    border-bottom-color: rgba(13, 18, 51, 0.10);
    box-shadow: 0 10px 30px -18px rgba(13, 18, 51, 0.35);
}

/* ---- Lenis smooth scroll plumbing ----------------------------------- */
/* These classes are toggled by Lenis itself when it is active. They are
   no-ops on pages where smooth scroll is not enabled (client area).    */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }
