/* ================================================
   KEYFRAME ANIMATIONS
   ================================================ */

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -30px) scale(1.05); }
    66%       { transform: translate(-20px, 20px) scale(0.97); }
}

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

@keyframes morphBorder {
    0%   { border-radius: 40% 60% 60% 40% / 50% 40% 60% 50%; }
    25%  { border-radius: 55% 45% 45% 55% / 45% 55% 45% 55%; }
    50%  { border-radius: 45% 55% 55% 45% / 60% 40% 60% 40%; }
    75%  { border-radius: 60% 40% 40% 60% / 50% 60% 40% 50%; }
    100% { border-radius: 40% 60% 60% 40% / 50% 40% 60% 50%; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4); }
    50%       { opacity: 0.8; transform: scale(0.95); box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); }
}

@keyframes scrollLine {
    0%   { transform: scaleY(0); transform-origin: top; opacity: 1; }
    50%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
    51%  { transform: scaleY(1); transform-origin: bottom; }
    100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

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

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

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ================================================
   HERO ENTRANCE ANIMATIONS
   (fired once on page load via JS class .loaded)
   ================================================ */

.animate-fade-up {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: var(--delay, 0s);
}

.animate-fade-left {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: var(--delay, 0s);
}

body.loaded .animate-fade-up,
body.loaded .animate-fade-left {
    opacity: 1;
    transform: translate(0, 0);
}

/* ================================================
   SCROLL REVEAL
   (triggered by IntersectionObserver in animations.js)
   ================================================ */

.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Staggered children */
.services-grid .reveal:nth-child(1)  { transition-delay: 0ms; }
.services-grid .reveal:nth-child(2)  { transition-delay: 80ms; }
.services-grid .reveal:nth-child(3)  { transition-delay: 160ms; }
.services-grid .reveal:nth-child(4)  { transition-delay: 240ms; }
.services-grid .reveal:nth-child(5)  { transition-delay: 320ms; }
.services-grid .reveal:nth-child(6)  { transition-delay: 400ms; }

.stack-grid .reveal:nth-child(1)  { transition-delay: 0ms; }
.stack-grid .reveal:nth-child(2)  { transition-delay: 50ms; }
.stack-grid .reveal:nth-child(3)  { transition-delay: 100ms; }
.stack-grid .reveal:nth-child(4)  { transition-delay: 150ms; }
.stack-grid .reveal:nth-child(5)  { transition-delay: 200ms; }
.stack-grid .reveal:nth-child(6)  { transition-delay: 250ms; }
.stack-grid .reveal:nth-child(7)  { transition-delay: 300ms; }
.stack-grid .reveal:nth-child(8)  { transition-delay: 350ms; }

.projects-grid .reveal:nth-child(1) { transition-delay: 0ms; }
.projects-grid .reveal:nth-child(2) { transition-delay: 100ms; }
.projects-grid .reveal:nth-child(3) { transition-delay: 200ms; }
.projects-grid .reveal:nth-child(4) { transition-delay: 300ms; }

.faq-list .reveal:nth-child(1) { transition-delay: 0ms; }
.faq-list .reveal:nth-child(2) { transition-delay: 70ms; }
.faq-list .reveal:nth-child(3) { transition-delay: 140ms; }
.faq-list .reveal:nth-child(4) { transition-delay: 210ms; }
.faq-list .reveal:nth-child(5) { transition-delay: 280ms; }

/* ================================================
   LOADING SCREEN (optional, fires before content)
   ================================================ */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0A0A0A;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.loader-logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #007AFF 0%, #5E5CE6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 1.2s ease-in-out infinite;
}

/* ================================================
   HOVER GLOW EFFECTS
   ================================================ */
.btn-primary:focus-visible,
.btn-glass:focus-visible,
.service-card:focus-visible,
.project-card:focus-visible,
.faq-btn:focus-visible,
.social-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ================================================
   REDUCED MOTION
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-orb,
    .hero-photo-frame,
    .badge-dot,
    .hero-floating-badge,
    .scroll-line,
    .availability-dot {
        animation: none !important;
    }
}
