/* ============================================================
   ANIMATIONS.CSS — Advanced Animation Styles
   Abdulrahman Abdulmannan Al Awar
   ============================================================ */


/* ============================================================
   1. NETWORK NODE ANIMATIONS
   ============================================================ */

/* Floating dots that pulse at different rates */
.network-node {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-gold);
  opacity: 0;
  animation: nodeFloat 8s ease-in-out infinite, nodeFadeIn 1s ease forwards;
}

.network-node:nth-child(odd) {
  animation-duration: 10s;
}

.network-node:nth-child(3n) {
  animation-duration: 12s;
}

@keyframes nodeFloat {
  0%, 100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(15px, -20px);
  }
  50% {
    transform: translate(-10px, -35px);
  }
  75% {
    transform: translate(20px, -15px);
  }
}

@keyframes nodeFadeIn {
  to {
    opacity: 0.4;
  }
}

/* Network pulse rings */
.network-pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--accent-gold);
  opacity: 0;
  animation: pulseRingExpand 4s ease-out infinite;
}

@keyframes pulseRingExpand {
  0% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* Network connection lines (SVG-based) */
.network-line {
  stroke: var(--accent-gold);
  stroke-width: 0.5;
  stroke-dasharray: 100;
  animation: lineConnect 3s ease-in-out infinite;
}

@keyframes lineConnect {
  0% {
    stroke-dashoffset: 100;
    opacity: 0;
  }
  30% {
    opacity: 0.3;
  }
  70% {
    opacity: 0.3;
  }
  100% {
    stroke-dashoffset: -100;
    opacity: 0;
  }
}

/* Floating network decoration (pure CSS) */
.network-decoration {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.network-decoration .dot {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent-gold);
  animation: dotDrift linear infinite;
}

.network-decoration .dot:nth-child(1)  { left: 10%; top: 20%; animation-duration: 18s; opacity: 0.15; }
.network-decoration .dot:nth-child(2)  { left: 25%; top: 55%; animation-duration: 22s; opacity: 0.2; animation-delay: -3s; }
.network-decoration .dot:nth-child(3)  { left: 45%; top: 15%; animation-duration: 20s; opacity: 0.12; animation-delay: -6s; }
.network-decoration .dot:nth-child(4)  { left: 65%; top: 70%; animation-duration: 25s; opacity: 0.18; animation-delay: -1s; }
.network-decoration .dot:nth-child(5)  { left: 80%; top: 30%; animation-duration: 19s; opacity: 0.14; animation-delay: -8s; }
.network-decoration .dot:nth-child(6)  { left: 15%; top: 80%; animation-duration: 23s; opacity: 0.16; animation-delay: -5s; }
.network-decoration .dot:nth-child(7)  { left: 55%; top: 40%; animation-duration: 21s; opacity: 0.13; animation-delay: -10s; }
.network-decoration .dot:nth-child(8)  { left: 90%; top: 60%; animation-duration: 17s; opacity: 0.2; animation-delay: -7s; }
.network-decoration .dot:nth-child(9)  { left: 35%; top: 90%; animation-duration: 24s; opacity: 0.1; animation-delay: -4s; }
.network-decoration .dot:nth-child(10) { left: 70%; top: 10%; animation-duration: 16s; opacity: 0.17; animation-delay: -9s; }
.network-decoration .dot:nth-child(11) { left: 5%;  top: 45%; animation-duration: 26s; opacity: 0.11; animation-delay: -2s; }
.network-decoration .dot:nth-child(12) { left: 50%; top: 75%; animation-duration: 20s; opacity: 0.19; animation-delay: -11s; }

@keyframes dotDrift {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: var(--dot-opacity, 0.15);
  }
  25% {
    transform: translate(30px, -40px) scale(1.4);
    opacity: calc(var(--dot-opacity, 0.15) * 2);
  }
  50% {
    transform: translate(-20px, -70px) scale(0.8);
    opacity: var(--dot-opacity, 0.15);
  }
  75% {
    transform: translate(40px, -30px) scale(1.2);
    opacity: calc(var(--dot-opacity, 0.15) * 1.5);
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: var(--dot-opacity, 0.15);
  }
}


/* ============================================================
   2. SCROLL-TRIGGERED REVEAL ANIMATIONS
   ============================================================ */

/* Fade up — default reveal */
.anim-fade-up {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.anim-fade-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Fade down */
.anim-fade-down {
  opacity: 0;
  transform: translateY(-50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.anim-fade-down.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Fade left */
.anim-fade-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.anim-fade-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

/* Fade right */
.anim-fade-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.anim-fade-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

/* Scale up */
.anim-scale-up {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.anim-scale-up.in-view {
  opacity: 1;
  transform: scale(1);
}

/* Rotate in */
.anim-rotate-in {
  opacity: 0;
  transform: rotate(-5deg) scale(0.95);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.anim-rotate-in.in-view {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Clip reveal (bottom to top) */
.anim-clip-reveal {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.9s cubic-bezier(0.77, 0, 0.175, 1);
}

.anim-clip-reveal.in-view {
  clip-path: inset(0 0 0 0);
}

/* Blur in */
.anim-blur-in {
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.8s ease, filter 0.8s ease;
}

.anim-blur-in.in-view {
  opacity: 1;
  filter: blur(0);
}

/* Animation delay utility classes */
.anim-delay-1 { transition-delay: 0.1s !important; }
.anim-delay-2 { transition-delay: 0.2s !important; }
.anim-delay-3 { transition-delay: 0.3s !important; }
.anim-delay-4 { transition-delay: 0.4s !important; }
.anim-delay-5 { transition-delay: 0.5s !important; }
.anim-delay-6 { transition-delay: 0.6s !important; }
.anim-delay-7 { transition-delay: 0.7s !important; }
.anim-delay-8 { transition-delay: 0.8s !important; }

/* Animation duration modifiers */
.anim-fast { transition-duration: 0.4s !important; }
.anim-slow { transition-duration: 1.2s !important; }
.anim-very-slow { transition-duration: 1.8s !important; }


/* ============================================================
   3. PAGE TRANSITION EFFECTS
   ============================================================ */

/* Fade wipe */
.page-enter {
  animation: pageEnter 0.5s ease-out forwards;
}

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

.page-exit {
  animation: pageExit 0.35s ease-in forwards;
}

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

/* Curtain wipe transition */
.curtain-wipe {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

.curtain-wipe::before,
.curtain-wipe::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: var(--primary-dark);
  transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.curtain-wipe::before {
  left: 0;
  transform: translateX(-100%);
}

.curtain-wipe::after {
  right: 0;
  transform: translateX(100%);
}

.curtain-wipe.closing::before {
  transform: translateX(0);
}

.curtain-wipe.closing::after {
  transform: translateX(0);
}

/* Circle expand transition */
.circle-transition {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9998;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--primary-dark);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: width 0.7s ease, height 0.7s ease;
}

.circle-transition.expanding {
  width: 300vmax;
  height: 300vmax;
}


/* ============================================================
   4. HOVER EFFECTS FOR CARDS & BUTTONS
   ============================================================ */

/* Gold border sweep on hover */
.hover-border-sweep {
  position: relative;
  overflow: hidden;
}

.hover-border-sweep::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  transition: left 0.6s ease;
}

.hover-border-sweep:hover::before {
  left: 100%;
}

/* Glow on hover */
.hover-glow {
  transition: box-shadow 0.4s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.15), 0 0 60px rgba(201, 168, 76, 0.05);
}

/* Lift on hover */
.hover-lift {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Tilt effect on hover */
.hover-tilt {
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.hover-tilt:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(-2deg);
}

/* Background color shift */
.hover-bg-shift {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.hover-bg-shift::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(201, 168, 76, 0.05);
  transform: translateY(100%);
  transition: transform 0.4s ease;
  z-index: -1;
}

.hover-bg-shift:hover::after {
  transform: translateY(0);
}

/* Button shine sweep */
.btn-shine {
  position: relative;
  overflow: hidden;
}

.btn-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
}

.btn-shine:hover::after {
  left: 125%;
}

/* Icon rotate on card hover */
.card-hover-icon .card-icon {
  transition: transform 0.4s ease;
}

.card-hover-icon:hover .card-icon {
  transform: rotateY(180deg);
}

/* Underline grow on hover */
.hover-underline-grow {
  position: relative;
}

.hover-underline-grow::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  transition: width 0.4s ease;
}

.hover-underline-grow:hover::after {
  width: 100%;
}

/* Image zoom on container hover */
.hover-image-zoom {
  overflow: hidden;
}

.hover-image-zoom img {
  transition: transform 0.6s ease;
}

.hover-image-zoom:hover img {
  transform: scale(1.05);
}


/* ============================================================
   5. TIMELINE ANIMATION
   ============================================================ */

/* Timeline line draw animation */
.timeline-animated::before {
  animation: timelineDraw 2s ease-out forwards;
  transform-origin: top;
}

@keyframes timelineDraw {
  from {
    transform: translateX(-50%) scaleY(0);
  }
  to {
    transform: translateX(-50%) scaleY(1);
  }
}

/* Timeline items staggered entrance */
.timeline-animated .timeline-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-animated .timeline-item.in-view {
  opacity: 1;
  transform: translateY(0);
}

.timeline-animated .timeline-item:nth-child(1) { transition-delay: 0.1s; }
.timeline-animated .timeline-item:nth-child(2) { transition-delay: 0.25s; }
.timeline-animated .timeline-item:nth-child(3) { transition-delay: 0.4s; }
.timeline-animated .timeline-item:nth-child(4) { transition-delay: 0.55s; }
.timeline-animated .timeline-item:nth-child(5) { transition-delay: 0.7s; }
.timeline-animated .timeline-item:nth-child(6) { transition-delay: 0.85s; }
.timeline-animated .timeline-item:nth-child(7) { transition-delay: 1.0s; }
.timeline-animated .timeline-item:nth-child(8) { transition-delay: 1.15s; }

/* Timeline dot pulse */
.timeline-dot {
  animation: timelineDotPulse 3s ease-in-out infinite;
}

@keyframes timelineDotPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.4);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(201, 168, 76, 0);
  }
}


/* ============================================================
   6. COUNTER / NUMBER ANIMATIONS
   ============================================================ */

/* Counter entrance */
.counter-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.counter-animate.counted {
  opacity: 1;
  transform: translateY(0);
}

/* Number ticker effect */
@keyframes numberTick {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.number-tick {
  display: inline-block;
  overflow: hidden;
}

.number-tick span {
  display: inline-block;
  animation: numberTick 0.6s ease-out forwards;
  opacity: 0;
}

.number-tick span:nth-child(1) { animation-delay: 0.1s; }
.number-tick span:nth-child(2) { animation-delay: 0.15s; }
.number-tick span:nth-child(3) { animation-delay: 0.2s; }
.number-tick span:nth-child(4) { animation-delay: 0.25s; }
.number-tick span:nth-child(5) { animation-delay: 0.3s; }
.number-tick span:nth-child(6) { animation-delay: 0.35s; }

/* Stat card animated entrance */
.stat-card.animated {
  animation: statEntrance 0.6s ease-out forwards;
}

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


/* ============================================================
   7. PARALLAX-LIKE DEPTH EFFECTS
   ============================================================ */

/* Parallax container (controlled via JS, CSS provides base) */
.parallax-layer {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Slow-moving background layer */
.parallax-bg {
  position: absolute;
  inset: -20%;
  will-change: transform;
}

/* Floating elements at different depths */
.float-depth-1 {
  animation: floatDepth1 6s ease-in-out infinite;
}

.float-depth-2 {
  animation: floatDepth2 8s ease-in-out infinite;
}

.float-depth-3 {
  animation: floatDepth3 10s ease-in-out infinite;
}

@keyframes floatDepth1 {
  0%, 100% { transform: translateY(0) translateX(0); }
  33% { transform: translateY(-12px) translateX(5px); }
  66% { transform: translateY(8px) translateX(-3px); }
}

@keyframes floatDepth2 {
  0%, 100% { transform: translateY(0) translateX(0); }
  33% { transform: translateY(-8px) translateX(-6px); }
  66% { transform: translateY(12px) translateX(4px); }
}

@keyframes floatDepth3 {
  0%, 100% { transform: translateY(0) translateX(0); }
  33% { transform: translateY(-5px) translateX(3px); }
  66% { transform: translateY(5px) translateX(-2px); }
}

/* Depth-based opacity shift (gives layered feel) */
.depth-fade-near {
  opacity: 1;
}

.depth-fade-mid {
  opacity: 0.6;
}

.depth-fade-far {
  opacity: 0.3;
}

/* Mouse-follow parallax decoration */
.mouse-parallax {
  will-change: transform;
  transition: transform 0.3s ease-out;
}


/* ============================================================
   8. LOADING / TRANSITION SCREEN ANIMATION
   ============================================================ */

/* Full-screen loader */
.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

/* Orbital loader */
.loader-orbital {
  width: 60px;
  height: 60px;
  position: relative;
}

.loader-orbital .orbit {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 50%;
}

.loader-orbital .orbit-1 {
  border-top-color: var(--accent-gold);
  animation: spin 1.2s linear infinite;
}

.loader-orbital .orbit-2 {
  inset: 6px;
  border-right-color: var(--accent-gold-light);
  animation: spin 1.8s linear infinite reverse;
}

.loader-orbital .orbit-3 {
  inset: 12px;
  border-bottom-color: rgba(201, 168, 76, 0.4);
  animation: spin 2.4s linear infinite;
}

.loader-orbital .core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
  animation: corePulse 1.5s ease-in-out infinite;
}

@keyframes corePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* Dot loader */
.loader-dots {
  display: flex;
  gap: 8px;
}

.loader-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gold);
  animation: dotBounce 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Progress bar loader */
.loader-progress {
  width: 200px;
  height: 3px;
  background: rgba(201, 168, 76, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.loader-progress-fill {
  height: 100%;
  background: var(--accent-gold);
  border-radius: 2px;
  animation: progressFill 2s ease-in-out infinite;
}

@keyframes progressFill {
  0% { width: 0; transform: translateX(0); }
  50% { width: 80%; }
  100% { width: 0; transform: translateX(200px); }
}

/* Loader text */
.loader-text {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  animation: loaderTextPulse 2s ease-in-out infinite;
}

@keyframes loaderTextPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}


/* ============================================================
   9. PIPELINE / ARROW ANIMATIONS
   ============================================================ */

@keyframes bounceArrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.pipeline-arrow {
  animation: bounceArrow 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
  .pipeline-arrow {
    animation: bounceArrowDown 1.5s ease-in-out infinite;
  }

  @keyframes bounceArrowDown {
    0%, 100% { transform: rotate(90deg) translateX(0); }
    50% { transform: rotate(90deg) translateX(6px); }
  }
}

/* Progress bar fill on scroll */
.progress-bar-fill.animate-fill {
  animation: fillBar 1.5s ease forwards;
}

@keyframes fillBar {
  from { width: 0; }
  /* target width set via inline style */
}


/* ============================================================
   10. TEXT ANIMATIONS
   ============================================================ */

/* Typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-gold);
  white-space: nowrap;
  animation: typewrite 3s steps(40, end), blinkCaret 0.75s step-end infinite;
}

@keyframes typewrite {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blinkCaret {
  50% { border-color: transparent; }
}

/* Word fade-in one by one */
.word-fade span {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
  animation: wordAppear 0.5s ease forwards;
}

@keyframes wordAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Letter spacing expand */
.anim-letter-expand {
  letter-spacing: 0;
  transition: letter-spacing 0.8s ease;
}

.anim-letter-expand.in-view {
  letter-spacing: 0.15em;
}


/* ============================================================
   11. DECORATIVE SHAPE ANIMATIONS
   ============================================================ */

/* Rotating gold ring */
.deco-ring {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: 50%;
  animation: decoRingSpin 30s linear infinite;
  pointer-events: none;
}

.deco-ring-2 {
  width: 280px;
  height: 280px;
  animation-direction: reverse;
  animation-duration: 40s;
}

@keyframes decoRingSpin {
  to { transform: rotate(360deg); }
}

/* Floating diamond */
.deco-diamond {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent-gold);
  transform: rotate(45deg);
  opacity: 0.08;
  animation: diamondFloat 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes diamondFloat {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50% { transform: rotate(45deg) translate(20px, -30px); }
}

/* Gradient orb */
.deco-orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.06) 0%, transparent 70%);
  pointer-events: none;
  animation: orbPulse 6s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0.7; }
}


/* ============================================================
   12. REDUCED MOTION SUPPORT
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .anim-fade-up,
  .anim-fade-down,
  .anim-fade-left,
  .anim-fade-right,
  .anim-scale-up,
  .anim-rotate-in,
  .anim-blur-in {
    opacity: 1;
    transform: none;
    filter: none;
    clip-path: none;
  }

  .anim-clip-reveal {
    clip-path: inset(0 0 0 0);
  }
}
