/* ============================================
   MOONCAKE STUDIO — Animations
   ============================================ */

/* --- REVEAL ANIMATIONS --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Staggered children */
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4) { transition-delay: 0.3s; }
.reveal:nth-child(5) { transition-delay: 0.4s; }
.reveal:nth-child(6) { transition-delay: 0.5s; }
.reveal:nth-child(7) { transition-delay: 0.6s; }
.reveal:nth-child(8) { transition-delay: 0.7s; }

/* --- HERO ANIMATIONS --- */
.hero-content .reveal:nth-child(1) { transition-delay: 0.3s; }
.hero-content .reveal:nth-child(2) { transition-delay: 0.5s; }
.hero-content .reveal:nth-child(3) { transition-delay: 0.7s; }
.hero-content .reveal:nth-child(4) { transition-delay: 0.9s; }

/* --- PROJECT CARD HOVER --- */
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent, var(--accent), transparent);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 1;
}

.project-card:hover::before {
  opacity: 1;
}

/* --- SERVICE CARD GLOW --- */
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.service-card {
  position: relative;
  overflow: hidden;
}

.service-card:hover::before {
  opacity: 1;
}

/* --- GRAIN OVERLAY --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9000;
  opacity: 0.5;
}

/* --- MAGNETIC BUTTON EFFECT --- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:hover::after {
  opacity: 1;
}

/* --- PARALLAX --- */
[data-parallax] {
  will-change: transform;
}

/* --- SMOOTH SECTION TRANSITIONS --- */
.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.about::before,
.clients::before {
  background: none;
}

/* --- NUMBER COUNTER ANIMATION --- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- FLOATING ANIMATION --- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.about-img-placeholder {
  animation: float 6s ease-in-out infinite;
}

/* --- PAGE TRANSITION --- */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 10001;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

.page-transition.active {
  transform: scaleX(1);
}
