/* ─── Keyframes ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

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

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

@keyframes pulseAccent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.15); }
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

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

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

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

@keyframes dotsDrift {
  from { background-position: 0 0; }
  to   { background-position: 16px 16px; }
}

@keyframes scan {
  from { top: -5%; }
  to   { top: 105%; }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12),
                0 16px 48px rgba(0,0,0,0.35),
                0 0 18px rgba(56, 189, 248, 0.06);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.32),
                0 16px 48px rgba(0,0,0,0.35),
                0 0 30px rgba(56, 189, 248, 0.16);
  }
}

/* ─── Scroll-reveal base ─────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1),
              transform 0.7s cubic-bezier(0.16,1,0.3,1);
}

[data-reveal="fade"] {
  transform: none;
}

[data-reveal="left"] {
  transform: translateX(-24px);
}

[data-reveal="right"] {
  transform: translateX(24px);
}

[data-reveal="scale"] {
  transform: scale(0.93);
  transform-origin: center bottom;
}

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

/* Stagger delays for child groups */
[data-stagger] > *:nth-child(1) { transition-delay: 0s; }
[data-stagger] > *:nth-child(2) { transition-delay: 0.08s; }
[data-stagger] > *:nth-child(3) { transition-delay: 0.16s; }
[data-stagger] > *:nth-child(4) { transition-delay: 0.24s; }
[data-stagger] > *:nth-child(5) { transition-delay: 0.32s; }
[data-stagger] > *:nth-child(6) { transition-delay: 0.40s; }
[data-stagger] > *:nth-child(7) { transition-delay: 0.48s; }
[data-stagger] > *:nth-child(8) { transition-delay: 0.56s; }

[data-stagger] > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s cubic-bezier(0.16,1,0.3,1),
              transform 0.65s cubic-bezier(0.16,1,0.3,1);
}

[data-stagger].is-visible > * {
  opacity: 1;
  transform: none;
}

/* ─── Hero entrance animation ────────────────────────────── */
.hero-animate {
  animation: fadeUp 0.9s cubic-bezier(0.16,1,0.3,1) both;
}

.hero-animate--delay-1 { animation-delay: 0.1s; }
.hero-animate--delay-2 { animation-delay: 0.22s; }
.hero-animate--delay-3 { animation-delay: 0.34s; }
.hero-animate--delay-4 { animation-delay: 0.46s; }

/* ─── Hero word stagger ──────────────────────────────────── */
.word-reveal {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px);
  animation: wordSlideUp 0.65s cubic-bezier(0.16,1,0.3,1) both;
}

/* ─── Floating "Taking on new projects" badge ────────────── */
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-pill);
  padding: 0.45rem 1rem;
  font-family: 'DM Mono', monospace;
  font-size: var(--fs-xs);
  color: var(--accent);
  letter-spacing: 0.04em;
  animation: floatBadge 3.2s ease-in-out infinite, fadeUp 0.9s 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

.hero__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulseAccent 2s ease-in-out infinite;
}

/* ─── Hero dots background ───────────────────────────────── */
.hero__dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(56, 189, 248, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  animation: dotsDrift 10s ease-in-out infinite alternate;
}

/* ─── Accent glow pulse (for CTA buttons) ────────────────── */
.pulse-accent {
  animation: pulseAccent 2.4s ease-in-out infinite;
}

/* ─── Marquee (scrolling ticker) ─────────────────────────── */
.marquee-wrapper {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-track {
  display: inline-flex;
  animation: marquee 26s linear infinite;
  will-change: transform;
}

.marquee-track:hover { animation-play-state: paused; }

/* ─── Line underline reveal ──────────────────────────────── */
.underline-reveal {
  position: relative;
  display: inline-block;
}

.underline-reveal::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.16,1,0.3,1);
}

.underline-reveal:hover::after,
.underline-reveal.active::after {
  transform: scaleX(1);
}

/* ─── Counter number animation ───────────────────────────── */
.counter-animate {
  display: inline-block;
  transition: transform 0.4s, opacity 0.4s;
}

/* ─── Page transition ────────────────────────────────────── */
.page-enter {
  animation: fadeUp 0.55s cubic-bezier(0.16,1,0.3,1) both;
}

/* ─── Process connector line draw animation ──────────────── */
.process__connector {
  opacity: 1;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.2s cubic-bezier(0.16,1,0.3,1) 0.5s !important;
}

[data-stagger].is-visible .process__connector {
  opacity: 1 !important;
  transform: scaleX(1);
}

/* ─── Service card icon hover animation ──────────────────── */
.service-card__icon {
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}

.service-card:hover .service-card__icon {
  transform: scale(1.12) rotate(-5deg);
}

/* ─── Portfolio scanning line for "Currently Building" ───── */
.proj-card__building {
  position: relative;
  overflow: hidden;
}

.proj-card__building::after {
  content: '';
  position: absolute;
  top: -5%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.25), transparent);
  animation: scan 3s ease-in-out infinite;
}

/* ─── Pricing featured card animated glow border ─────────── */
.pricing-card--featured {
  animation: glowPulse 3s ease-in-out infinite;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-stagger] > *,
  .hero-animate,
  .marquee-track,
  .word-reveal,
  .hero__badge,
  .hero__dots,
  .proj-card__building::after,
  .pricing-card--featured {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
