/**
 * LeapsGo Design System - Premium Animation System
 * High performance hardware-accelerated CSS animations inspired by MetricX motion language.
 */

/* ==========================================================================
   00. Vanta Dots Background Layer
   ========================================================================== */

.lg-vanta-bg,
#leapsgo-vanta-bg,
#lg-vanta-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1.2s ease;
}

/* ==========================================================================
   01. Full-Screen Animated Preloader
   ========================================================================== */

.lg-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--lg-bg-base);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
  will-change: transform;
}

.lg-preloader.dismissed {
  transform: translateY(-100%);
  pointer-events: none;
}

.lg-preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  text-align: center;
}

.lg-preloader-dots {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.lg-preloader-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--lg-primary);
  box-shadow: 0 0 14px var(--lg-primary-glow);
  animation: preloaderDotPulse 1.2s ease-in-out infinite;
}

.lg-preloader-dot:nth-child(1) { animation-delay: 0s; }
.lg-preloader-dot:nth-child(2) { animation-delay: 0.15s; }
.lg-preloader-dot:nth-child(3) { animation-delay: 0.3s; }
.lg-preloader-dot:nth-child(4) { animation-delay: 0.45s; }

@keyframes preloaderDotPulse {
  0%, 100% {
    transform: scale(0.7);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.35);
    opacity: 1;
    box-shadow: 0 0 20px var(--lg-primary);
  }
}

.lg-preloader-text {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.38em;
  color: var(--lg-text-secondary);
  text-transform: uppercase;
  animation: preloaderTextFade 2.2s ease-in-out infinite alternate;
}

@keyframes preloaderTextFade {
  0% {
    opacity: 0.5;
    letter-spacing: 0.35em;
  }
  100% {
    opacity: 1;
    letter-spacing: 0.42em;
    color: #ffffff;
  }
}

/* ==========================================================================
   02. Hero Entrance Sequence & Mask Clipping
   ========================================================================== */

.lg-mask-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
}

.lg-mask-line > span {
  display: inline-block;
  transform: translateY(115%);
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

body.hero-entered .lg-mask-line.line-1 > span {
  transform: translateY(0);
  opacity: 1;
  transition-delay: 0.15s;
}

body.hero-entered .lg-mask-line.line-2 > span {
  transform: translateY(0);
  opacity: 1;
  transition-delay: 0.3s;
}

/* Hero elements staged entry */
.lg-hero-eyebrow {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.05s;
}

body.hero-entered .lg-hero-eyebrow {
  opacity: 1;
  transform: translateY(0);
}

.lg-hero-copy-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.42s;
}

body.hero-entered .lg-hero-copy-reveal {
  opacity: 1;
  transform: translateY(0);
}

.lg-hero-actions-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.54s;
}

body.hero-entered .lg-hero-actions-reveal {
  opacity: 1;
  transform: translateY(0);
}

/* Hero Artwork Frame Mask Reveal */
.lg-hero-artwork-frame {
  position: relative;
  width: 100%;
  border-radius: var(--lg-radius-card);
  overflow: hidden;
  border: 1px solid var(--lg-border-subtle);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9), 0 0 40px -10px var(--lg-primary-glow);
  clip-path: inset(0 0 100% 0 round var(--lg-radius-card));
  transition: clip-path 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.35s;
  will-change: clip-path;
}

body.hero-entered .lg-hero-artwork-frame {
  clip-path: inset(0 0 0% 0 round var(--lg-radius-card));
}

.lg-hero-artwork-frame img {
  width: 100%;
  height: auto;
  object-fit: cover;
  transform: scale(1.1);
  transition: transform 1.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

body.hero-entered .lg-hero-artwork-frame img {
  transform: scale(1);
}

.lg-hero-artwork-frame:hover img {
  transform: scale(1.035);
}

/* Floating card entrance */
.lg-hero .lg-floating-card {
  opacity: 0;
  transform: translateY(28px) scale(0.95);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.7s;
}

body.hero-entered .lg-hero .lg-floating-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Hero Pillars Rail sequential entrance */
.lg-hero-pillar-item {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), border-bottom-color var(--lg-transition-fast), padding-left var(--lg-transition-fast);
}

body.hero-entered .lg-hero-pillar-item:nth-child(1) { opacity: 1; transform: translateX(0); transition-delay: 0.65s; }
body.hero-entered .lg-hero-pillar-item:nth-child(2) { opacity: 1; transform: translateX(0); transition-delay: 0.75s; }
body.hero-entered .lg-hero-pillar-item:nth-child(3) { opacity: 1; transform: translateX(0); transition-delay: 0.85s; }
body.hero-entered .lg-hero-pillar-item:nth-child(4) { opacity: 1; transform: translateX(0); transition-delay: 0.95s; }

/* ==========================================================================
   03. Continuous Marquee Keyframes & Velocity
   ========================================================================== */

@keyframes marqueeScroll {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes marqueeScrollReverse {
  0% {
    transform: translate3d(-50%, 0, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

.lg-marquee-track {
  animation: marqueeScroll 28s linear infinite;
  will-change: transform;
}

.lg-marquee-track.reverse {
  animation: marqueeScrollReverse 28s linear infinite;
  will-change: transform;
}

.lg-marquee-section:hover .lg-marquee-track {
  animation-play-state: paused;
}

/* ==========================================================================
   04. Ornaments, Starbursts & Atmosphere
   ========================================================================== */

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.98);
    box-shadow: 0 0 35px -10px var(--lg-primary-glow), inset 0 0 20px rgba(255, 69, 0, 0.2);
  }
  100% {
    transform: scale(1.03);
    box-shadow: 0 0 65px -5px var(--lg-primary-glow), inset 0 0 40px rgba(255, 69, 0, 0.45);
  }
}

@keyframes floatSubtle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.lg-floating-card {
  animation: floatSubtle 6s ease-in-out infinite;
}

/* Rotating Starburst */
.lg-about-starburst {
  animation: spinSlow 32s linear infinite;
  will-change: transform;
}

/* ==========================================================================
   05. Scroll-Based Heading Text Reveals (Muted to Bright)
   ========================================================================== */

.lg-heading-dimmed {
  transition: color 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.lg-reveal-word {
  display: inline-block;
  color: rgba(255, 255, 255, 0.38);
  transition: color 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: color, transform;
}

.lg-reveal-word.revealed {
  color: #ffffff;
}

.lg-reveal-word .lg-accent-serif {
  color: var(--lg-primary) !important;
}

/* ==========================================================================
   06. About Image Vertical Mask Reveal
   ========================================================================== */

.lg-about-frame {
  clip-path: inset(0 0 0% 0 round var(--lg-radius-island));
  opacity: 1;
  transition: clip-path 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s ease;
  will-change: clip-path;
}

.lg-about-frame img {
  transform: scale(1);
  transition: transform 1.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.lg-about-frame:hover img {
  transform: scale(1.03);
}

/* ==========================================================================
   07. Staggered Service Card Entrances
   ========================================================================== */

.lg-services-grid .lg-card {
  opacity: 0;
  transform: translateY(42px) scale(0.97);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              border-color var(--lg-transition-normal),
              background-color var(--lg-transition-normal),
              box-shadow var(--lg-transition-normal);
  will-change: opacity, transform;
}

.lg-services-grid.revealed .lg-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.lg-services-grid.revealed .lg-card:nth-child(1) { transition-delay: 0.05s; }
.lg-services-grid.revealed .lg-card:nth-child(2) { transition-delay: 0.15s; }
.lg-services-grid.revealed .lg-card:nth-child(3) { transition-delay: 0.25s; }
.lg-services-grid.revealed .lg-card:nth-child(4) { transition-delay: 0.35s; }
.lg-services-grid.revealed .lg-card:nth-child(5) { transition-delay: 0.45s; }
.lg-services-grid.revealed .lg-card:nth-child(6) { transition-delay: 0.55s; }

/* ==========================================================================
   08. Large Process Display Typography ("WORK PROCESS")
   ========================================================================== */

.lg-process-display-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  row-gap: 0.25rem;
  column-gap: clamp(0.75rem, 2.5vw, 2.5rem);
  font-size: clamp(2.2rem, 8vw, 7.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin-bottom: clamp(1.25rem, 2.5vw, 2.25rem);
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  text-align: center;
  width: 100%;
}

.lg-outline-word {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.22);
  display: inline-block;
  transform: translateX(-50px);
  clip-path: inset(0 60% 0 0);
  opacity: 0;
  transition: transform 0.95s cubic-bezier(0.16, 1, 0.3, 1),
              clip-path 0.95s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.8s ease;
  will-change: transform, clip-path, opacity;
}

.lg-accent-word {
  color: var(--lg-primary);
  display: inline-block;
  transform: translateX(50px);
  clip-path: inset(0 0 0 60%);
  opacity: 0;
  transition: transform 0.95s cubic-bezier(0.16, 1, 0.3, 1),
              clip-path 0.95s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.8s ease;
  transition-delay: 0.12s;
  will-change: transform, clip-path, opacity;
}

.lg-process-display-title.active .lg-outline-word,
.lg-process-display-title.active .lg-accent-word {
  transform: translateX(0);
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

@media (max-width: 600px) {
  .lg-process-display-title {
    font-size: clamp(2rem, 11vw, 3.25rem);
    column-gap: 0.65rem;
    margin-bottom: 1.25rem;
  }
  .lg-outline-word {
    -webkit-text-stroke: 1.2px rgba(255, 255, 255, 0.25);
    transform: translateX(-20px);
  }
  .lg-accent-word {
    transform: translateX(20px);
  }
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 8px var(--lg-primary);
  }
  50% {
    transform: scale(1.35);
    opacity: 0.75;
    box-shadow: 0 0 16px var(--lg-primary-glow);
  }
}

/* ==========================================================================
   09. Viewport Entrance Reveals
   ========================================================================== */

.lg-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.lg-reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.lg-delay-1 { transition-delay: 0.1s; }
.lg-delay-2 { transition-delay: 0.2s; }
.lg-delay-3 { transition-delay: 0.3s; }
.lg-delay-4 { transition-delay: 0.4s; }

/* ==========================================================================
   10. Desktop Custom Cursor Enhancement
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
  .lg-cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle, rgba(255, 75, 22, 0.12) 0%, rgba(255, 75, 22, 0.05) 45%, rgba(255, 75, 22, 0) 70%);
    transform: translate3d(-50%, -50%, 0);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    mix-blend-mode: screen;
    will-change: transform, opacity;
  }

  .lg-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background-color: var(--lg-primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999999;
    transform: translate3d(-50%, -50%, 0);
    transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
    will-change: transform;
    opacity: 0;
  }

  .lg-cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    border: 1.5px solid rgba(255, 69, 0, 0.45);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999998;
    transform: translate3d(-50%, -50%, 0);
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                height 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.25s ease, 
                background-color 0.25s ease,
                opacity 0.2s ease;
    will-change: transform;
    opacity: 0;
  }

  body.cursor-active .lg-cursor-dot,
  body.cursor-active .lg-cursor-follower {
    opacity: 1;
  }

  .lg-cursor-follower.hovered,
  .lg-cursor-follower.hovering {
    width: 48px;
    height: 48px;
    border-color: var(--lg-primary);
    background-color: rgba(255, 69, 0, 0.08);
  }
}

@media (hover: none) or (pointer: coarse), (prefers-reduced-motion: reduce) {
  .lg-cursor-dot, .lg-cursor-follower, .lg-cursor-glow {
    display: none !important;
  }
}

/* ==========================================================================
   11. Ambient Background Drift
   ========================================================================== */

.lg-bg-ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: paint;
}

.lg-ambient-glow-1 {
  position: absolute;
  top: 15%;
  right: 5%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 69, 0, 0.06) 0%, transparent 70%);
  will-change: transform;
}

.lg-ambient-glow-2 {
  position: absolute;
  top: 60%;
  left: -5%;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 69, 0, 0.04) 0%, transparent 70%);
  will-change: transform;
}

/* ==========================================================================
   12. Accessibility: Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .lg-preloader {
    display: none !important;
  }

  .lg-cursor-dot,
  .lg-cursor-follower {
    display: none !important;
  }

  .lg-marquee-track,
  .lg-about-starburst,
  .lg-footer-orb,
  .lg-footer-orb-inner,
  .lg-floating-card {
    animation: none !important;
  }

  .lg-reveal,
  .lg-mask-line > span,
  .lg-hero-eyebrow,
  .lg-hero-copy-reveal,
  .lg-hero-actions-reveal,
  .lg-hero .lg-floating-card,
  .lg-hero-pillar-item,
  .lg-services-grid .lg-card,
  .lg-about-frame,
  .lg-hero-artwork-frame,
  .lg-outline-word,
  .lg-accent-word,
  .lg-reveal-word {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    color: #ffffff !important;
  }

  .lg-outline-word {
    color: transparent !important;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.5) !important;
  }

  .lg-accent-word,
  .lg-reveal-word .lg-accent-serif {
    color: var(--lg-primary) !important;
  }
}
