/* ==========================================================================
   Direct Freight Solutions — Animations
   Scroll-triggered reveals, hero effects, and micro-interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Keyframe Definitions
   -------------------------------------------------------------------------- */

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

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

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

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

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

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

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes gradientFlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

@keyframes routeLine {
  from { stroke-dashoffset: 500; }
  to   { stroke-dashoffset: 0; }
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(1.4); opacity: 1; }
}

/* --------------------------------------------------------------------------
   2. Scroll-Triggered Animation Classes
   -------------------------------------------------------------------------- */

/* Elements start hidden and animate in when observed */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays for card grids */
.stagger-1 { transition-delay: 0.05s; }
.stagger-2 { transition-delay: 0.12s; }
.stagger-3 { transition-delay: 0.19s; }
.stagger-4 { transition-delay: 0.26s; }
.stagger-5 { transition-delay: 0.33s; }
.stagger-6 { transition-delay: 0.40s; }

/* --------------------------------------------------------------------------
   3. Hero Entrance Animations
   -------------------------------------------------------------------------- */

.hero-anim-heading {
  animation: fadeInUp 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.hero-anim-subtitle {
  animation: fadeInUp 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.45s both;
}

.hero-anim-buttons {
  animation: fadeInUp 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.65s both;
}

.hero-anim-breadcrumb {
  animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

/* --------------------------------------------------------------------------
   4. Floating Decorative Elements
   -------------------------------------------------------------------------- */

.float-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.06;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}

.float-shape-1 {
  width: 200px;
  height: 200px;
  background: var(--blue);
  top: 15%;
  right: -5%;
  animation-delay: 0s;
}

.float-shape-2 {
  width: 150px;
  height: 150px;
  background: var(--blue-bright);
  bottom: 10%;
  left: -3%;
  animation-delay: 2s;
}

.float-shape-3 {
  width: 100px;
  height: 100px;
  background: var(--blue);
  top: 40%;
  left: 10%;
  animation-delay: 4s;
}

/* --------------------------------------------------------------------------
   5. Button Micro-Interactions
   -------------------------------------------------------------------------- */

.btn-gradient {
  position: relative;
  overflow: hidden;
}

.btn-gradient::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-gradient:hover::after {
  width: 300px;
  height: 300px;
}

/* Animated gradient border for CTA sections */
.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--blue), var(--blue-bright), var(--blue), var(--blue-bright));
  background-size: 400% 400%;
  border-radius: inherit;
  z-index: -1;
  animation: gradientFlow 6s ease infinite;
}

/* --------------------------------------------------------------------------
   6. Nav Underline Animation
   -------------------------------------------------------------------------- */

.nav-link-animated {
  position: relative;
}

.nav-link-animated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-blue);
  transition: width 0.3s ease, left 0.3s ease;
  border-radius: 2px;
}

.nav-link-animated:hover::after,
.nav-link-animated.active::after {
  width: 100%;
  left: 0;
}

/* --------------------------------------------------------------------------
   7. Card Hover Enhancements
   -------------------------------------------------------------------------- */

.card-hover-lift {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Blue border glow on hover */
.card-glow-hover {
  transition: box-shadow 0.35s ease;
}

.card-glow-hover:hover {
  box-shadow: 0 0 0 1px rgba(40,120,232,0.2),
              0 8px 25px rgba(40,120,232,0.08);
}

/* --------------------------------------------------------------------------
   8. Route Line SVG Animation
   -------------------------------------------------------------------------- */

.route-line-svg {
  overflow: visible;
}

.route-line-svg .route-path {
  stroke: var(--blue);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  stroke-linecap: round;
  opacity: 0.3;
}

.route-line-svg.animated .route-path {
  animation: routeLine 2s ease-out forwards;
}

.route-line-svg .route-dot {
  fill: var(--blue);
  opacity: 0;
}

.route-line-svg.animated .route-dot {
  opacity: 1;
  animation: dotPulse 2s ease-in-out infinite;
}

.route-line-svg.animated .route-dot:nth-child(2) { animation-delay: 0.3s; }
.route-line-svg.animated .route-dot:nth-child(3) { animation-delay: 0.6s; }

/* --------------------------------------------------------------------------
   9. Form Field Animations
   -------------------------------------------------------------------------- */

.form-control,
.form-select {
  transition: border-color 0.25s ease,
              background-color 0.25s ease,
              box-shadow 0.25s ease;
}

.form-group-animated {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 0.5s ease-out forwards;
}

.form-group-animated:nth-child(1)  { animation-delay: 0.05s; }
.form-group-animated:nth-child(2)  { animation-delay: 0.1s; }
.form-group-animated:nth-child(3)  { animation-delay: 0.15s; }
.form-group-animated:nth-child(4)  { animation-delay: 0.2s; }
.form-group-animated:nth-child(5)  { animation-delay: 0.25s; }
.form-group-animated:nth-child(6)  { animation-delay: 0.3s; }

/* --------------------------------------------------------------------------
   10. Loading Spinner
   -------------------------------------------------------------------------- */

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

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --------------------------------------------------------------------------
   11. Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }
  
  .hero-anim-heading,
  .hero-anim-subtitle,
  .hero-anim-buttons,
  .hero-anim-breadcrumb {
    animation: none;
  }
  
  .float-shape {
    animation: none;
  }
  
  .hero-bg img {
    animation: none;
    transform: none;
  }
  
  .route-line-svg .route-path,
  .route-line-svg .route-dot {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 0.3;
  }
  
  .form-group-animated {
    opacity: 1;
    transform: none;
    animation: none;
  }
  
  .destination-card {
    animation: none;
  }
}
