/* ============================================================
   WS Agency — Mobile Animations
   Touch feedback, entrance stagger, floating CTA, swipe hints
   Only meaningful at mobile widths or on touch devices
   ============================================================ */

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes ws-slide-up {
  from { opacity: 0; transform: translate3d(0, 28px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0);   }
}

@keyframes ws-slide-in-right {
  from { opacity: 0; transform: translate3d(32px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0);   }
}

@keyframes ws-slide-in-left {
  from { opacity: 0; transform: translate3d(-32px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0);    }
}

@keyframes ws-pop-in {
  0%   { opacity: 0; transform: scale(0.88) translate3d(0, 16px, 0); }
  70%  { opacity: 1; transform: scale(1.03) translate3d(0, -2px, 0); }
  100% { opacity: 1; transform: scale(1)    translate3d(0, 0, 0);    }
}

@keyframes ws-fab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
  50%       { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0);  }
}

@keyframes ws-fab-bounce {
  0%, 100% { transform: translateY(0);   }
  40%       { transform: translateY(-6px); }
  70%       { transform: translateY(-2px); }
}

@keyframes ws-swipe-hint {
  0%   { transform: translate3d(0, 0, 0);    opacity: 0.7; }
  30%  { transform: translate3d(-8px, 0, 0); opacity: 1;   }
  60%  { transform: translate3d(4px, 0, 0);  opacity: 0.9; }
  100% { transform: translate3d(0, 0, 0);    opacity: 0.7; }
}

@keyframes ws-shimmer {
  from { background-position: -200% center; }
  to   { background-position:  200% center; }
}

/* ── Stagger entrance classes ───────────────────────────────── */
/* Applied by JS to new page sections after AJAX swap           */
.ws-enter-1  { animation: ws-slide-up 0.38s cubic-bezier(0.22,1,0.36,1) both; animation-delay: 0.04s; }
.ws-enter-2  { animation: ws-slide-up 0.38s cubic-bezier(0.22,1,0.36,1) both; animation-delay: 0.10s; }
.ws-enter-3  { animation: ws-slide-up 0.38s cubic-bezier(0.22,1,0.36,1) both; animation-delay: 0.16s; }
.ws-enter-4  { animation: ws-slide-up 0.38s cubic-bezier(0.22,1,0.36,1) both; animation-delay: 0.22s; }
.ws-enter-5  { animation: ws-slide-up 0.38s cubic-bezier(0.22,1,0.36,1) both; animation-delay: 0.28s; }
.ws-enter-pop { animation: ws-pop-in  0.45s cubic-bezier(0.22,1,0.36,1) both; animation-delay: 0.06s; }

/* ── Touch press feedback ────────────────────────────────────── */
/* Only on real touch devices (hover:none + coarse pointer)      */
@media (hover: none) and (pointer: coarse) {
  .card,
  .explore-card,
  .benefit-card,
  .capability-card,
  .infra-card,
  .client-cred-card,
  .error-link-chip,
  .partner-section,
  .article-card,
  .related-card,
  .training-card {
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease !important;
    will-change: transform;
  }

  .card:active,
  .explore-card:active,
  .benefit-card:active,
  .capability-card:active,
  .infra-card:active,
  .client-cred-card:active,
  .error-link-chip:active,
  .article-card:active,
  .related-card:active,
  .training-card:active {
    transform: scale(0.97) translateZ(0) !important;
    box-shadow: 0 2px 8px rgba(10, 15, 30, 0.08) !important;
  }

  .btn:active,
  .nav-cta:active,
  .nav-signin:active {
    transform: scale(0.94) translateZ(0) !important;
    opacity: 0.85;
  }

  .wwb-card:active {
    transform: scale(0.97) translateZ(0) !important;
    box-shadow: 0 2px 8px rgba(10, 15, 30, 0.08) !important;
  }

  .wwb-tab:active,
  .wwb-arrow:active {
    transform: scale(0.95) translateZ(0);
    opacity: 0.8;
  }

  .filter-tab:active {
    transform: scale(0.95) translateZ(0);
  }

  /* Remove hover-only effects that don't work on touch */
  .nav-links a:hover        { color: inherit; }
  .card:hover               { transform: none; }
  .explore-card:hover       { transform: none; }
}

/* ── .is-pressed helper class (applied by JS) ──────────────── */
.is-pressed {
  transform: scale(0.96) translateZ(0) !important;
  transition: transform 0.1s ease !important;
}

/* ── Floating CTA (mobile only) ─────────────────────────────── */
#ws-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 800;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #0A0F1E;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  border-radius: 50px;
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.45), 0 2px 8px rgba(10,15,30,0.15);
  text-decoration: none;
  letter-spacing: -0.2px;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
  animation: ws-fab-bounce 3.2s ease-in-out 1.5s infinite;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.28s ease;
}

#ws-fab.fab-pulse {
  animation: ws-fab-pulse 2.2s ease-in-out infinite, ws-fab-bounce 3.2s ease-in-out 1.5s infinite;
}

#ws-fab:active {
  transform: scale(0.93) !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3) !important;
  animation: none !important;
}

#ws-fab.fab-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.9);
}

/* Show FAB only on mobile */
@media (max-width: 768px) {
  #ws-fab { display: flex; }
}

/* Hide FAB on contact page (user is already on the contact form) */
body.page-contact #ws-fab,
body.page-signin  #ws-fab,
body.page-signup  #ws-fab {
  display: none !important;
}

/* ── Swipe hint indicator ─────────────────────────────────── */
.ws-swipe-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-top: 16px;
  letter-spacing: 0.04em;
  animation: ws-swipe-hint 2.4s ease-in-out 1s 3;
}

.ws-swipe-hint svg { flex-shrink: 0; }

/* ── Page loading skeleton ──────────────────────────────────── */
.ws-skeleton {
  background: linear-gradient(
    90deg,
    rgba(10,15,30,0.04) 0%,
    rgba(10,15,30,0.08) 50%,
    rgba(10,15,30,0.04) 100%
  );
  background-size: 200% auto;
  animation: ws-shimmer 1.4s linear infinite;
  border-radius: 8px;
}

/* ── Mobile scroll progress bar ──────────────────────────────── */
#ws-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, #F59E0B, #D97706);
  z-index: 9998;
  transform-origin: left center;
  transition: width 0.08s linear;
  pointer-events: none;
  display: none;
}

@media (max-width: 768px) {
  #ws-scroll-progress { display: block; }
}

/* ── Bottom nav tab bar (mobile) ────────────────────────────── */
#ws-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 700;
  display: none;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(10,15,30,0.08);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(10,15,30,0.07);
}

#ws-bottom-nav .ws-bnav-items {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
}

#ws-bottom-nav .ws-bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #8892A4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.15s, background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  min-width: 56px;
  text-align: center;
}

#ws-bottom-nav .ws-bnav-item svg {
  transition: transform 0.15s cubic-bezier(0.34,1.56,0.64,1);
}

#ws-bottom-nav .ws-bnav-item.active {
  color: #D97706;
  background: rgba(245,158,11,0.08);
}

#ws-bottom-nav .ws-bnav-item.active svg {
  transform: scale(1.15) translateY(-1px);
}

#ws-bottom-nav .ws-bnav-item:active {
  transform: scale(0.92);
}

@media (max-width: 768px) {
  #ws-bottom-nav { display: block; }

  /* Push page content up so bottom nav doesn't overlap */
  body { padding-bottom: 72px; }

  /* Hide the FAB when bottom nav is showing — avoid overlap */
  #ws-fab { bottom: 88px; }
}

/* ── Reduce motion override ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ws-enter-1, .ws-enter-2, .ws-enter-3,
  .ws-enter-4, .ws-enter-5, .ws-enter-pop {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  #ws-fab              { animation: none !important; }
  #ws-scroll-progress  { transition: none !important; }
}
