/* ═══════════════════════════════════════════════════════
   SOURCECORE LOGISTICS PORTAL — Animations
   animations.css
   ═══════════════════════════════════════════════════════ */

/* ─── KEYFRAMES ─────────────────────────────────────── */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeLeft {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeRight {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Gradient shift — hero heading "living" feel */
@keyframes gradientShift {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

/* CTA button pulse glow */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(232, 123, 44, 0.35),
                0 0 0 0 rgba(232, 123, 44, 0);
  }
  50% {
    box-shadow: 0 4px 28px rgba(232, 123, 44, 0.6),
                0 0 0 10px rgba(232, 123, 44, 0);
  }
}

/* Blinking dot (status indicators) */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* Chart bar pulse */
@keyframes chartPulse {
  0%, 100% { opacity: 0.6; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(1.08); }
}

/* Animated flow connector line */
@keyframes flowLine {
  0%   { left: -100%; }
  100% { left: 100%; }
}

/* Draw SVG route */
@keyframes drawRoute {
  to { stroke-dashoffset: 0; }
}

/* Floating / levitate — hero visual */
@keyframes float {
  0%, 100% { transform: translateY(-50%); }
  50%       { transform: translateY(calc(-50% - 12px)); }
}

/* Spin — loading or decorative rings */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Rotating card text swap */
@keyframes textSwap {
  0%   { opacity: 1; transform: translateY(0); }
  20%  { opacity: 0; transform: translateY(-10px); }
  80%  { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Shimmer — skeleton/loading states */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* Border trace — decorative accent */
@keyframes borderTrace {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* Scroll progress pulse */
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ─── ANIMATION UTILITY CLASSES ─────────────────────── */

/* Default state — elements to be animated */
[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition-property: opacity, transform;
  transition-duration: 0.7s;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Triggered by IntersectionObserver */
[data-animate].animate-in {
  opacity: 1;
  transform: none;
}

/* Animation variants */
[data-animate="fade-left"] {
  transform: translateX(40px);
}

[data-animate="fade-right"] {
  transform: translateX(-40px);
}

[data-animate="fade-in"] {
  transform: none;
}

[data-animate="scale-in"] {
  transform: scale(0.88);
}

[data-animate="fade-left"].animate-in,
[data-animate="fade-right"].animate-in,
[data-animate="fade-in"].animate-in,
[data-animate="scale-in"].animate-in {
  transform: none;
}

/* Stagger delays via data-delay attribute (set via CSS variable) */
[data-delay="0"]   { transition-delay: 0ms; }
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }
[data-delay="700"] { transition-delay: 700ms; }
[data-delay="800"] { transition-delay: 800ms; }

/* ─── HOVER LIFT ─────────────────────────────────────── */

.hover-lift {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(232, 123, 44, 0.2);
}

/* ─── PAGE TRANSITION ────────────────────────────────── */

.page-fade-in {
  animation: fadeIn 0.4s ease-in-out forwards;
}

/* ─── HERO CANVAS / PARTICLE STYLES ─────────────────── */

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ─── SECTION REVEAL SEQUENCES ──────────────────────── */

/* Stagger children in containers */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
}

.stagger-children.animate-in > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.stagger-children.animate-in > *:nth-child(1)  { transition-delay: 0ms; }
.stagger-children.animate-in > *:nth-child(2)  { transition-delay: 100ms; }
.stagger-children.animate-in > *:nth-child(3)  { transition-delay: 200ms; }
.stagger-children.animate-in > *:nth-child(4)  { transition-delay: 300ms; }
.stagger-children.animate-in > *:nth-child(5)  { transition-delay: 400ms; }
.stagger-children.animate-in > *:nth-child(6)  { transition-delay: 500ms; }
.stagger-children.animate-in > *:nth-child(7)  { transition-delay: 600ms; }
.stagger-children.animate-in > *:nth-child(8)  { transition-delay: 700ms; }

/* ─── COUNTER ANIMATION ──────────────────────────────── */

.counter-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: all 0.1s ease-out;
}

/* ─── DECORATIVE ─────────────────────────────────────── */

/* Floating ring decoration */
.deco-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(232, 123, 44, 0.12);
  pointer-events: none;
  animation: spin 20s linear infinite;
}

.deco-ring-2 {
  animation-direction: reverse;
  animation-duration: 30s;
}

/* Glow orb */
.deco-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.15;
}

.deco-orb-primary {
  background: var(--color-accent);
}

.deco-orb-blue {
  background: #1565C0;
}

/* ─── PIPELINE DRAW ANIMATION ────────────────────────── */

.pipeline-draw .pipeline-connector {
  background: #E2E8F0;
  position: relative;
  overflow: hidden;
}

.pipeline-draw.animate-in .pipeline-connector {
  animation: none;
}

.pipeline-draw.animate-in .pipeline-connector.done {
  background: linear-gradient(90deg, #E87B2C, #F5C842);
}

/* ─── WORLD MAP ANIMATION ────────────────────────────── */

.world-map-container {
  position: relative;
}

.route-pulse {
  animation: blink 1.5s ease-in-out infinite;
}

/* ─── ABOUT PAGE — WORKFLOW ──────────────────────────── */

.timeline::before {
  animation: fadeIn 1s ease-out forwards;
}

/* ─── MOBILE MENU STAGGER ────────────────────────────── */

.mobile-menu.open .mobile-menu-link:nth-child(1) { transition-delay: 50ms; }
.mobile-menu.open .mobile-menu-link:nth-child(2) { transition-delay: 120ms; }
.mobile-menu.open .mobile-menu-link:nth-child(3) { transition-delay: 190ms; }
.mobile-menu.open .mobile-menu-link:nth-child(4) { transition-delay: 260ms; }
.mobile-menu.open .mobile-menu-link:nth-child(5) { transition-delay: 330ms; }
.mobile-menu.open .mobile-menu-link:nth-child(6) { transition-delay: 400ms; }

/* ─── 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-animate] {
    opacity: 1 !important;
    transform: none !important;
  }

  .hero-canvas { display: none; }
}
