/* =========================================================
   EMASFI · Visual Effects Layer
   Scroll reveal, parallax, magnetic, marquee, gradients,
   tilt, shimmer, decorative motion
   ========================================================= */

/* ============================================================
   1) REVEAL ON SCROLL — staged entrances (CSS animation-based)
   ============================================================ */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}
@keyframes reveal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes reveal-left {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: none; }
}
@keyframes reveal-right {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: none; }
}
@keyframes reveal-scale {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: none; }
}

[data-reveal]:not(.in) {
  opacity: 0;
}

[data-reveal].in {
  opacity: 1;
  animation: reveal-up 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}
[data-reveal].in.skip-anim {
  animation: none !important;
}
[data-reveal="fade"].in  { animation-name: reveal-fade; }
[data-reveal="left"].in  { animation-name: reveal-left; }
[data-reveal="right"].in { animation-name: reveal-right; }
[data-reveal="scale"].in { animation-name: reveal-scale; }

/* Staggered children — reveal as a cascade */
[data-reveal-stagger]:not(.in) > * {
  opacity: 0;
}
[data-reveal-stagger].in > * {
  opacity: 1;
  animation: reveal-up 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
[data-reveal-stagger].in.skip-anim > * {
  animation: none !important;
}
[data-reveal-stagger].in > *:nth-child(1) { animation-delay: 0ms; }
[data-reveal-stagger].in > *:nth-child(2) { animation-delay: 80ms; }
[data-reveal-stagger].in > *:nth-child(3) { animation-delay: 160ms; }
[data-reveal-stagger].in > *:nth-child(4) { animation-delay: 240ms; }
[data-reveal-stagger].in > *:nth-child(5) { animation-delay: 320ms; }
[data-reveal-stagger].in > *:nth-child(6) { animation-delay: 400ms; }
[data-reveal-stagger].in > *:nth-child(7) { animation-delay: 480ms; }
[data-reveal-stagger].in > *:nth-child(8) { animation-delay: 560ms; }
[data-reveal-stagger].in > *:nth-child(9) { animation-delay: 640ms; }
[data-reveal-stagger].in > *:nth-child(10) { animation-delay: 720ms; }
[data-reveal-stagger].in > *:nth-child(n+11) { animation-delay: 800ms; }

/* Text-line reveal: word-by-word slide-up */
.reveal-words .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}
.reveal-words .word > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-words.in .word > span { transform: none; }
.reveal-words.in.skip-anim .word > span { transition: none !important; transform: none !important; }
.reveal-words.in .word:nth-child(2) > span { transition-delay: 60ms; }
.reveal-words.in .word:nth-child(3) > span { transition-delay: 120ms; }
.reveal-words.in .word:nth-child(4) > span { transition-delay: 180ms; }
.reveal-words.in .word:nth-child(5) > span { transition-delay: 240ms; }
.reveal-words.in .word:nth-child(6) > span { transition-delay: 300ms; }
.reveal-words.in .word:nth-child(7) > span { transition-delay: 360ms; }
.reveal-words.in .word:nth-child(8) > span { transition-delay: 420ms; }
.reveal-words.in .word:nth-child(n+9) > span { transition-delay: 480ms; }

/* ============================================================
   2) PARALLAX — image and decorative depth
   ============================================================ */
.parallax-layer {
  will-change: transform;
  transition: transform 80ms linear;
}
.page-hero { position: relative; overflow: hidden; }
.page-hero .page-hero-bg {
  will-change: transform;
}

/* ============================================================
   3) MAGNETIC BUTTONS — cursor-follow
   ============================================================ */
.btn-magnetic {
  display: inline-flex;
  position: relative;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.btn-magnetic > * { pointer-events: none; }

/* ============================================================
   4) MARQUEE — infinite logo / regions strip
   ============================================================ */
.marquee {
  overflow: hidden;
  position: relative;
  --marquee-speed: 32s;
  mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
}
.marquee-track {
  display: flex;
  gap: 64px;
  width: max-content;
  animation: marquee-scroll var(--marquee-speed) linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }

@keyframes marquee-scroll {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 17px;
  font-weight: 500;
  color: rgba(14,42,74,0.55);
  letter-spacing: -0.005em;
  flex-shrink: 0;
}
.marquee-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-accent, #EF6923);
  flex-shrink: 0;
}
.marquee-section {
  padding: 28px 0;
  background: #FFFFFF;
  border-top: 1px solid rgba(14,42,74,0.08);
  border-bottom: 1px solid rgba(14,42,74,0.08);
}

/* ============================================================
   5) ANIMATED COUNTERS
   ============================================================ */
.counter {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* ============================================================
   6) HOVER LIFT + TILT (cards)
   ============================================================ */
.lift-card {
  transition: transform 480ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 480ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 480ms ease;
  will-change: transform;
}
.lift-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px -20px rgba(14,42,74,0.20),
              0 12px 24px -8px rgba(14,42,74,0.10);
}

/* Subtle tilt on hover — uses CSS variables set by JS */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --rx: 0deg;
  --ry: 0deg;
  --gloss-x: 50%;
  --gloss-y: 50%;
  position: relative;
}
.tilt-card.tilting {
  transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry));
}
.tilt-card.tilting::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--gloss-x) var(--gloss-y),
              rgba(255,255,255,0.18) 0%,
              rgba(255,255,255,0) 50%);
  border-radius: inherit;
}

/* ============================================================
   7) IMAGE HOVER ZOOM
   ============================================================ */
.img-zoom {
  overflow: hidden;
}
.img-zoom > * {
  transition: transform 1200ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.img-zoom:hover > * {
  transform: scale(1.06);
}

/* ============================================================
   8) GRADIENT MESH — decorative backgrounds
   ============================================================ */
.mesh-bg {
  position: relative;
  isolation: isolate;
}
.mesh-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 20%, rgba(239,105,35,0.10) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(14,42,74,0.06) 0%, transparent 50%),
    radial-gradient(circle at 75% 15%, rgba(239,105,35,0.06) 0%, transparent 40%);
  pointer-events: none;
}

.mesh-bg-dark::before {
  background:
    radial-gradient(circle at 15% 20%, rgba(239,105,35,0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(239,105,35,0.10) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04) 0%, transparent 60%);
}

/* Animated mesh — slow drift */
.mesh-bg-animated::before {
  animation: mesh-drift 24s ease-in-out infinite;
}
@keyframes mesh-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(2%, -2%) scale(1.05); }
  66%      { transform: translate(-2%, 2%) scale(0.98); }
}

/* ============================================================
   9) NOISE TEXTURE — adds editorial grit on dark sections
   ============================================================ */
.noise-overlay {
  position: relative;
  isolation: isolate;
}
.noise-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ============================================================
   10) DECORATIVE FLOATING ELEMENTS
   ============================================================ */
.float-shape {
  position: absolute;
  pointer-events: none;
  opacity: 0.50;
  animation: float-drift 12s ease-in-out infinite;
}
@keyframes float-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(0, -20px) rotate(8deg); }
}
.float-shape.delay-1 { animation-delay: -3s; }
.float-shape.delay-2 { animation-delay: -6s; }

/* ============================================================
   11) ANIMATED ARROW LINK
   ============================================================ */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: gap 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.link-arrow:hover { gap: 14px; }
.link-arrow svg {
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.link-arrow:hover svg { transform: translateX(2px); }

/* ============================================================
   12) BUTTON SHIMMER
   ============================================================ */
.btn-orange, .btn-primary, .btn-shimmer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-orange::before, .btn-primary::before, .btn-shimmer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 0%,
    transparent 35%,
    rgba(255,255,255,0.30) 50%,
    transparent 65%,
    transparent 100%);
  transform: translateX(-100%);
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
  pointer-events: none;
}
.btn-orange:hover::before, .btn-primary:hover::before, .btn-shimmer:hover::before {
  transform: translateX(100%);
}
.btn-orange > *, .btn-primary > *, .btn-shimmer > * {
  position: relative;
  z-index: 2;
}

/* ============================================================
   13) SECTION DIVIDER — animated line
   ============================================================ */
.divider-grow {
  height: 1px;
  background: rgba(14,42,74,0.10);
  position: relative;
  overflow: hidden;
}
.divider-grow::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 0;
  background: var(--brand-accent, #EF6923);
  transition: width 1200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.divider-grow.in::after { width: 100%; }

/* ============================================================
   14) CARD LINE GROW — accent border on top reveals on enter
   ============================================================ */
.card-line-top {
  position: relative;
}
.card-line-top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--brand-accent, #EF6923);
  transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.card-line-top:hover::before,
.card-line-top.in::before { width: 100%; }

/* ============================================================
   15) SCROLL PROGRESS BAR (top of page)
   ============================================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-accent, #EF6923), #f7945a);
  z-index: 200;
  width: var(--progress, 0%);
  transition: width 60ms linear;
  pointer-events: none;
}

/* ============================================================
   16) NUMBER BIG ANIMATED — for stats
   ============================================================ */
.stat-num-anim {
  display: inline-block;
  position: relative;
}
.stat-num-anim::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--brand-accent, #EF6923);
  transition: width 800ms cubic-bezier(0.22, 1, 0.36, 1) 200ms;
}
.stat-num-anim.in::after { width: 40px; }

/* ============================================================
   17) REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal], [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
