/* ==========================================================================
   Advance Tech USA  -  animations.css
   Motion effects only: keyframes, scroll reveals, frosted nav, hero drift,
   shimmer, count-up support, cookie banner, scroll progress bar.
   Brand and theme tokens are defined in style.css.
   Motion character: Subtle. Everything here is disabled under reduced motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. KEYFRAMES
   -------------------------------------------------------------------------- */
@keyframes hero-drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1.06); }
  50%  { transform: translate3d(2%, 1.5%, 0) scale(1.12); }
  100% { transform: translate3d(-2%, -1%, 0) scale(1.06); }
}

@keyframes caret-blink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes sweep {
  0%   { left: -150%; }
  100% { left: 150%; }
}

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

@keyframes pulse-gold {
  0%   { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.45); }
  70%  { box-shadow: 0 0 0 16px rgba(245, 166, 35, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0); }
}

/* --------------------------------------------------------------------------
   2. HERO  -  drifting gradient mesh (28s cycle)
   -------------------------------------------------------------------------- */
.hero::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 50% at 18% 28%, rgba(93, 169, 233, 0.22), transparent 62%),
    radial-gradient(42% 55% at 82% 18%, rgba(212, 135, 10, 0.18), transparent 60%),
    radial-gradient(55% 60% at 62% 92%, rgba(20, 48, 79, 0.75), transparent 72%);
  filter: blur(28px);
  animation: hero-drift 28s ease-in-out infinite;
}

/* Faint structural grid over the hero for a precise, technical texture */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(231, 239, 248, 0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 239, 248, 0.6) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent 85%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent 85%);
}

/* --------------------------------------------------------------------------
   3. TYPING CARET
   -------------------------------------------------------------------------- */
.typed-caret {
  height: 1em;
  animation: caret-blink 1.05s steps(1) infinite;
}

/* --------------------------------------------------------------------------
   4. SCROLL REVEAL  (armed by IntersectionObserver, fires once)
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal--d1 { transition-delay: 0.08s; }
.reveal--d2 { transition-delay: 0.16s; }
.reveal--d3 { transition-delay: 0.24s; }
.reveal--d4 { transition-delay: 0.32s; }

/* --------------------------------------------------------------------------
   5. SERVICE ICON FLOAT  (on card hover)
   -------------------------------------------------------------------------- */
.card:hover .card-icon {
  animation: float-icon 1.8s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   6. GOLD BUTTON SHIMMER SWEEP
   The ::before sweep technique, applied to primary CTAs.
   -------------------------------------------------------------------------- */
.btn--gold {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn--gold::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -150%;
  width: 55%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 1;
}

.btn--gold:hover::before {
  animation: sweep 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   7. CTA PULSE  (gold button in the CTA band)
   -------------------------------------------------------------------------- */
.btn--pulse {
  animation: pulse-gold 2.8s ease-out infinite;
}

.btn--pulse:hover {
  animation-play-state: paused;
}

/* --------------------------------------------------------------------------
   8. FROSTED NAVBAR  (class toggled by JS past 60px scroll)
   -------------------------------------------------------------------------- */
.nav--scrolled {
  background: rgba(11, 30, 56, 0.72);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 28px rgba(3, 8, 15, 0.4);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Without backdrop-filter the translucent bar is unreadable; stay solid. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .nav--scrolled {
    background: #0B1E38;
  }
}

/* --------------------------------------------------------------------------
   9. SCROLL PROGRESS BAR
   -------------------------------------------------------------------------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 9999;
  background: linear-gradient(90deg, #D4870A, #F5A623);
  will-change: width;
}

/* --------------------------------------------------------------------------
   10. COOKIE CONSENT BANNER  (slides up after 1200ms, dark glass)
   -------------------------------------------------------------------------- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
  padding: 1.1rem 1.4rem;
  background: rgba(6, 14, 26, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #E7EFF8;
  font-size: 0.92rem;
  transform: translateY(130%);
  transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.cookie-banner.is-visible {
  transform: translateY(0);
}

.cookie-banner p {
  margin: 0;
  max-width: 60ch;
  color: #9DB2CA;
}

.cookie-banner .btn {
  min-height: 44px;
}

@media (max-width: 600px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .cookie-banner .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   11. REDUCED MOTION
   Disables every animation defined in this file. Reveals resolve to their
   visible state by source order, so no !important is needed.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms;
    animation-iteration-count: 1;
    animation-delay: 0ms;
  }

  .hero::before {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .cookie-banner {
    transition: none;
  }

  .typed-caret {
    animation: none;
    opacity: 1;
  }
}
