/**
 * XpertNote Motion System (motion.css)
 * Premium, restrained animation layer inspired by humaan.com.
 * Scoped strictly to data attributes and .xn-motion-* classes.
 * Hardware accelerated: transforms and opacity only.
 */

:root {
  --xn-motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --xn-motion-dur: 600ms;
  --xn-motion-stagger: 70ms;
}

/* -------------------------------------------------------------
   PROGRESSIVE ENHANCEMENT & GATING
   ------------------------------------------------------------- */
/* By default (or if JS is disabled), all elements are fully visible and statically positioned. */
[data-reveal],
[data-reveal="up"],
[data-reveal="lines"],
[data-reveal="stagger"] > * {
  opacity: 1;
  transform: none;
}

/* Initial hidden state active ONLY when JS is verified running */
html.js-enabled:not(.motion-fallback-active) [data-reveal="up"] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--xn-motion-dur) var(--xn-motion-ease),
              transform var(--xn-motion-dur) var(--xn-motion-ease);
  will-change: opacity, transform;
}

html.js-enabled:not(.motion-fallback-active) [data-reveal="up"].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger container */
html.js-enabled:not(.motion-fallback-active) [data-reveal="stagger"] > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--xn-motion-dur) var(--xn-motion-ease),
              transform var(--xn-motion-dur) var(--xn-motion-ease);
  transition-delay: calc(var(--stagger-index, 0) * var(--xn-motion-stagger));
  will-change: opacity, transform;
}

html.js-enabled:not(.motion-fallback-active) [data-reveal="stagger"].is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* Masked line wrapper */
.xn-line-mask {
  overflow: hidden;
  display: block;
}

html.js-enabled:not(.motion-fallback-active) .xn-line-mask > .xn-line-inner {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  transition: opacity 550ms var(--xn-motion-ease),
              transform 600ms var(--xn-motion-ease);
  will-change: transform, opacity;
}

html.js-enabled:not(.motion-fallback-active) .xn-line-mask.is-revealed > .xn-line-inner {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------------------------------------------------
   HERO HEADLINE: CSS-ONLY IMMEDIATE REVEAL (Load-triggered)
   Rule: Starts immediately on load, no JS/IO wait, finishes < 700ms,
   zero layout shift, zero LCP penalty.
   ------------------------------------------------------------- */
@keyframes xnHeroLineEnter {
  0% {
    opacity: 0;
    transform: translateY(22px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

html.js-enabled:not(.motion-fallback-active) .xn-homepage .xn-hero-line {
  display: inline-block;
  opacity: 0;
  animation: xnHeroLineEnter 600ms var(--xn-motion-ease) forwards;
  will-change: transform, opacity;
}

html.js-enabled:not(.motion-fallback-active) .xn-homepage .xn-hero-line:first-child {
  display: block;
  animation-delay: 0ms;
}

html.js-enabled:not(.motion-fallback-active) .xn-homepage .xn-hero-line:nth-child(2) {
  display: inline-block;
  animation-delay: 80ms;
}

html.js-enabled:not(.motion-fallback-active) .xn-homepage .xn-hero-line:last-child {
  display: inline-block;
  animation-delay: 160ms;
}

/* About Page Hero Headline: CSS-only immediate reveal */
html.js-enabled:not(.motion-fallback-active) body.xn-about-page .about-hero h1 {
  opacity: 0;
  animation: xnHeroLineEnter 600ms var(--xn-motion-ease) forwards;
  will-change: transform, opacity;
}

html.js-enabled:not(.motion-fallback-active) body.xn-about-page .about-hero h1 span {
  opacity: 0;
  animation: xnHeroLineEnter 600ms var(--xn-motion-ease) forwards;
  animation-delay: 90ms;
  will-change: transform, opacity;
}

/* Inner Pages Hero Heading: CSS-only immediate reveal */
html.js-enabled:not(.motion-fallback-active) .xn-page-heading,
html.js-enabled:not(.motion-fallback-active) body.xn-products-page .inner-banner-modern h1,
html.js-enabled:not(.motion-fallback-active) body.xn-career-page .inner-banner-modern h1,
html.js-enabled:not(.motion-fallback-active) body.xn-blog-page .blog-hero h1 {
  opacity: 0;
  animation: xnHeroLineEnter 600ms var(--xn-motion-ease) forwards;
  will-change: transform, opacity;
}

/* Inner Pages Hero Heading: CSS-only immediate reveal */
html.js-enabled:not(.motion-fallback-active) .xn-page-heading,
html.js-enabled:not(.motion-fallback-active) body.xn-products-page .inner-banner-modern h1,
html.js-enabled:not(.motion-fallback-active) body.xn-career-page .inner-banner-modern h1,
html.js-enabled:not(.motion-fallback-active) body.xn-blog-page .blog-hero h1 {
  opacity: 0;
  animation: xnHeroLineEnter 600ms var(--xn-motion-ease) forwards;
  will-change: transform, opacity;
}

/* -------------------------------------------------------------
   3D CARD TILT & HOVER LIFT (Desktop only, max 4 deg)
   ------------------------------------------------------------- */
@media (hover: hover) and (min-width: 992px) {
  [data-tilt] {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 220ms var(--xn-motion-ease), box-shadow 250ms ease;
    will-change: transform;
  }
}

/* -------------------------------------------------------------
   INTERACTIVE GLASS CARD CURSOR GLOW
   ------------------------------------------------------------- */
[data-glow] {
  position: relative;
  overflow: hidden;
}

[data-glow]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
  background: radial-gradient(
    320px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(31, 160, 216, 0.16),
    rgba(30, 58, 159, 0.04) 40%,
    transparent 70%
  );
  z-index: 1;
}

@media (hover: hover) {
  [data-glow]:hover::before {
    opacity: 1;
  }
}

/* -------------------------------------------------------------
   CLOSING CTA ACTION WORD TICKER
   ------------------------------------------------------------- */
.xn-ticker-wrap {
  display: inline-block;
  position: relative;
  vertical-align: bottom;
  overflow: hidden;
  height: 1.18em;
  min-width: 250px;
  text-align: left;
}

.xn-ticker-word {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(100%);
  transition: transform 500ms var(--xn-motion-ease), opacity 500ms var(--xn-motion-ease);
  font-weight: inherit;
}

.xn-ticker-word.is-active {
  opacity: 1;
  transform: translateY(0);
}

.xn-ticker-word.is-exit {
  opacity: 0;
  transform: translateY(-100%);
}

.xn-ticker-word.is-enter {
  opacity: 0;
  transform: translateY(100%);
  transition: none;
}

@media (max-width: 576px) {
  .xn-ticker-wrap {
    min-width: 180px;
  }
}

/* -------------------------------------------------------------
   EFFECT A: SECTION BACKGROUND SHIFT (Statement Section)
   WCAG AA Compliant: deep brand blue background with white text,
   or light background with dark navy text.
   ------------------------------------------------------------- */
[data-bg-shift] {
  transition: background-color 600ms ease, color 600ms ease;
  position: relative;
}

[data-bg-shift].is-shifted {
  background-color: #14214F !important;
  color: #F8FAFC !important;
}

[data-bg-shift].is-shifted .xn-section-heading,
[data-bg-shift].is-shifted h2,
[data-bg-shift].is-shifted h3,
[data-bg-shift].is-shifted h4,
[data-bg-shift].is-shifted h5 {
  color: #FFFFFF !important;
}

[data-bg-shift].is-shifted p,
[data-bg-shift].is-shifted li {
  color: #E2E8F0 !important;
}

[data-bg-shift].is-shifted .xn-badge {
  background: rgba(31, 160, 216, 0.18) !important;
  color: #67E8F9 !important;
  border-color: rgba(31, 160, 216, 0.4) !important;
}

body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor-boxarea,
body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor2-boxarea {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(10px);
}

body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor-boxarea .content-area h5,
body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor2-boxarea .content-area h5,
body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor-boxarea .content-area a,
body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor2-boxarea .content-area a {
  color: #FFFFFF !important;
}

body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor-boxarea .content-area p,
body:not(.xn-homepage) [data-bg-shift].is-shifted .service2-auhtor2-boxarea .content-area p {
  color: #E2E8F0 !important;
}

.xn-homepage [data-bg-shift].is-shifted .service2-auhtor-boxarea .content-area p,
.xn-homepage [data-bg-shift].is-shifted .service2-auhtor2-boxarea .content-area p {
  color: #475569 !important;
}

/* About Page Statement Section Shift */
body.xn-about-page [data-bg-shift].is-shifted {
  background-color: #14214F !important;
  color: #F8FAFC !important;
}

body.xn-about-page [data-bg-shift].is-shifted .about-section-label {
  color: #67E8F9 !important;
}

body.xn-about-page [data-bg-shift].is-shifted .about-section-heading {
  color: #FFFFFF !important;
}

body.xn-about-page [data-bg-shift].is-shifted .about-promise {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22) !important;
}

body.xn-about-page [data-bg-shift].is-shifted .about-promise-number {
  color: #67E8F9 !important;
}

body.xn-about-page [data-bg-shift].is-shifted .about-promise h3 {
  color: #FFFFFF !important;
}

body.xn-about-page [data-bg-shift].is-shifted .about-promise p {
  color: #CBD5E1 !important;
}

/* Services Page Why Choose Shift */
.why-choose-modern[data-bg-shift].is-shifted {
  background-color: #14214F !important;
  color: #F8FAFC !important;
}

.why-choose-modern[data-bg-shift].is-shifted .xn-section-heading {
  color: #FFFFFF !important;
}

.why-choose-modern[data-bg-shift].is-shifted p {
  color: #E2E8F0 !important;
}

/* -------------------------------------------------------------
   EFFECT B: SCROLL-SCRUBBED TEXT REVEAL
   Words progressively brighten from 30% to 100% opacity.
   ------------------------------------------------------------- */
.xn-scrub-text {
  position: relative;
}

.xn-scrub-word {
  display: inline-block;
  opacity: 0.32;
  transition: opacity 120ms ease;
}

.xn-scrub-word.is-revealed {
  opacity: 1;
}

/* If no JS or reduced motion, show full strength */
html:not(.js-enabled) .xn-scrub-word,
html.motion-fallback-active .xn-scrub-word {
  opacity: 1 !important;
}

/* -------------------------------------------------------------
   EFFECT C: MEDIA FRAMES (Desktop only, 24-32px rounded)
   Aspect ratio reserved to eliminate layout shift (CLS = 0).
   ------------------------------------------------------------- */
[data-media-frame] {
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

@media (hover: hover) and (min-width: 992px) {
  [data-media-frame] img {
    transform: scale(calc(1.08 - var(--frame-p, 0) * 0.08)) translateY(calc(var(--frame-p, 0) * 3% - 1.5%));
    transition: transform 100ms linear;
    will-change: transform;
  }
}

/* -------------------------------------------------------------
   EFFECT E: ACTIVE NAV PILL
   Subtle dark pill indicator for current active page.
   ------------------------------------------------------------- */
.main-menu ul > li > a.xn-nav-pill-active {
  background: rgba(20, 33, 79, 0.08);
  color: #14214F !important;
  border-radius: 20px;
  padding: 6px 14px;
}

/* -------------------------------------------------------------
   MOBILE ADJUSTMENTS & TOUCH SAFEGUARDS
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --xn-motion-stagger: 35ms; /* Halve stagger delay on mobile */
  }

  [data-tilt] {
    transform: none !important;
  }

  [data-media-frame] img {
    transform: none !important;
  }
}

/* -------------------------------------------------------------
   ACCESSIBILITY: PREFERS-REDUCED-MOTION
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html.js-enabled [data-reveal],
  html.js-enabled [data-reveal="up"],
  html.js-enabled [data-reveal="stagger"] > *,
  html.js-enabled .xn-line-inner,
  html.js-enabled .xn-hero-line {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .xn-scrub-word {
    opacity: 1 !important;
  }

  [data-tilt] {
    transform: none !important;
  }

  [data-media-frame] img {
    transform: none !important;
  }
}

/* -------------------------------------------------------------
   SAFETY TIMEOUT FALLBACK OVERRIDE
   ------------------------------------------------------------- */
html.motion-fallback-active [data-reveal],
html.motion-fallback-active [data-reveal="up"],
html.motion-fallback-active [data-reveal="stagger"] > *,
html.motion-fallback-active .xn-line-inner,
html.motion-fallback-active .xn-hero-line {
  opacity: 1 !important;
  transform: none !important;
}
