/* ================================================================
   ANSAR MAHMOOD — Animations & Transitions
   ================================================================ */

/* ── Preloader ────────────────────────────────────────────────── */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity .5s ease .2s, visibility .5s ease .2s;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader__logo {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 3rem;
  color: var(--white);
  letter-spacing: -.02em;
  margin-bottom: 8px;
  line-height: 1;
}

.preloader__logo span { color: var(--gold); }

.preloader__tagline {
  font-size: .78rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 40px;
}

.preloader__bar {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  overflow: hidden;
}

.preloader__bar::after {
  content: '';
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: 2px;
  animation: preloader-fill 1.8s cubic-bezier(.4,0,.2,1) forwards;
}

@keyframes preloader-fill {
  0%   { width: 0; }
  60%  { width: 80%; }
  100% { width: 100%; }
}

/* ── Scroll Reveal ────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.4,0,.2,1);
}

.reveal--up    { transform: translateY(40px); }
.reveal--left  { transform: translateX(-40px); }
.reveal--right { transform: translateX(40px); }
.reveal--scale { transform: scale(.95) translateY(20px); }
.reveal--fade  { transform: none; }

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

/* Stagger delays for grid children */
.reveal:nth-child(1) { transition-delay: 0s; }
.reveal:nth-child(2) { transition-delay: .08s; }
.reveal:nth-child(3) { transition-delay: .16s; }
.reveal:nth-child(4) { transition-delay: .24s; }
.reveal:nth-child(5) { transition-delay: .32s; }
.reveal:nth-child(6) { transition-delay: .40s; }
.reveal:nth-child(7) { transition-delay: .48s; }
.reveal:nth-child(8) { transition-delay: .56s; }

/* ── Counter Animation ────────────────────────────────────────── */
.counter-animated {
  transition: none;
}

/* ── Hero Text Animation ──────────────────────────────────────── */
.hero__headline .line {
  overflow: hidden;
  display: block;
}

.hero__headline .line-inner {
  display: block;
  animation: slide-up .8s cubic-bezier(.4,0,.2,1) forwards;
  opacity: 0;
  transform: translateY(100%);
}

.hero__headline .line:nth-child(1) .line-inner { animation-delay: .1s; }
.hero__headline .line:nth-child(2) .line-inner { animation-delay: .25s; }
.hero__headline .line:nth-child(3) .line-inner { animation-delay: .4s; }

@keyframes slide-up {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Float Animation ──────────────────────────────────────────── */
.float-animation {
  animation: float 6s ease-in-out infinite;
}

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

/* ── Shimmer Effect (skeleton loading) ───────────────────────── */
@keyframes shimmer {
  0% { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

.shimmer {
  background: linear-gradient(to right, var(--gray-100) 8%, var(--gray-200) 18%, var(--gray-100) 33%);
  background-size: 936px 100%;
  animation: shimmer 1.5s linear infinite;
}

/* ── Number counting animation trigger ───────────────────────── */
@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.stat-number.counting {
  animation: count-up .3s ease forwards;
}

/* ── Card hover ripple ────────────────────────────────────────── */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(30,111,217,.15);
  transform: scale(0);
  animation: ripple-out .6s linear;
  pointer-events: none;
}

@keyframes ripple-out {
  to { transform: scale(4); opacity: 0; }
}

/* ── Page transition ──────────────────────────────────────────── */
.page-transition {
  animation: page-in .4s ease;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ── Gradient text animation ──────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--blue), var(--gold), var(--blue));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── Typing cursor ────────────────────────────────────────────── */
.typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--gold);
}

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

/* ── Service card icon bounce ─────────────────────────────────── */
.service-card:hover .service-card__icon {
  animation: icon-bounce .4s cubic-bezier(.34,1.56,.64,1);
}

@keyframes icon-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ── Pulse ring ───────────────────────────────────────────────── */
.pulse-ring {
  position: relative;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  animation: ring-pulse 2s cubic-bezier(.215,.61,.355,1) infinite;
}

@keyframes ring-pulse {
  0%   { transform: scale(.95); opacity: 1; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(.95); opacity: 0; }
}

/* ── Entrance animations for sections ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--up,
  .reveal--left,
  .reveal--right,
  .reveal--scale,
  .reveal--fade,
  .preloader__bar::after,
  .hero__headline .line-inner,
  .float-animation,
  .gradient-text {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
