/**
 * Advanced Animations & Transitions
 * Refined, subtle effects for precision and care
 */

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

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

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

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

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

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

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

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

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

@keyframes subtlePulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes zoomOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* ========== PAGE LOADER ========== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--black-primary);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

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

.loader-content {
    text-align: center;
}

.loader-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    animation: float 4s ease-in-out infinite;
    opacity: 0.9;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.loader-logo.zoom-out {
    animation: zoomOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(218, 165, 32, 0.15);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loader-text {
    margin-top: 20px;
    color: var(--gold-primary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 3px;
    animation: fadeInUp 0.8s ease-out;
    opacity: 0.8;
}

/* ========== ANIMATED BACKGROUND ========== */

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--gold-primary);
    border-radius: 50%;
    opacity: 0.15;
    animation: float 20s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 18s; }
.particle:nth-child(2) { left: 25%; animation-delay: 3s; animation-duration: 22s; }
.particle:nth-child(3) { left: 40%; animation-delay: 6s; animation-duration: 20s; }
.particle:nth-child(4) { left: 55%; animation-delay: 2s; animation-duration: 19s; }
.particle:nth-child(5) { left: 70%; animation-delay: 5s; animation-duration: 21s; }
.particle:nth-child(6) { left: 85%; animation-delay: 4s; animation-duration: 17s; }

/* ========== SCROLL-TRIGGERED ANIMATIONS ========== */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* ========== ENTRANCE ANIMATIONS ========== */

.top-bar {
    animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(10, 10, 10, 0.85);
    border-bottom: 1px solid rgba(218, 165, 32, 0.08);
}

.navbar {
    animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.hero-background {
    animation: scaleIn 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(218, 165, 32, 0.05) 0%, 
        transparent 50%, 
        rgba(218, 165, 32, 0.05) 100%);
    background-size: 200% 200%;
    animation: gradientShift 12s ease infinite;
    z-index: 1;
}

.hero-title {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
    letter-spacing: -1.5px;
}

.hero-content-box {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ========== FEATURE CARDS ========== */

.feature-large-card {
    animation: scaleIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
    position: relative;
    overflow: hidden;
}

.feature-large-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(218, 165, 32, 0.06) 50%, 
        transparent 70%);
    animation: shimmer 4s infinite;
    pointer-events: none;
}

.stat-card {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.06), 
        transparent);
    transition: left 0.6s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.stat-number {
    background: linear-gradient(135deg, var(--white) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== SERVICE CARDS ========== */

.service-card {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(218, 165, 32, 0.03) 0%, 
        transparent 50%, 
        rgba(218, 165, 32, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

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

.service-card:hover {
    transform: translateY(-8px);
    border-color: rgba(218, 165, 32, 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.service-icon {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(3deg);
}

/* ========== WORK GALLERY ========== */

.work-item {
    animation: scaleIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-item:hover {
    transform: scale(1.03) translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ========== TESTIMONIALS ========== */

.testimonial-card {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.testimonial-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.testimonial-avatar {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.testimonial-card:hover .testimonial-avatar {
    transform: scale(1.08);
}

/* ========== CTA SECTION ========== */

.cta-section {
    animation: scaleIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, 
        rgba(218, 165, 32, 0.08) 0%, 
        transparent 70%);
    animation: gradientShift 15s linear infinite;
    pointer-events: none;
}

.cta-button-large {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cta-button-large::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.cta-button-large:hover::before {
    width: 300px;
    height: 300px;
}

.cta-button-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* ========== FOOTER ========== */

.footer-container {
    animation: fadeInUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.footer-social-icon {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.footer-social-icon:hover {
    transform: translateY(-4px) scale(1.08);
}

/* ========== STAGGER ANIMATION DELAYS ========== */

.service-card:nth-child(1) { animation-delay: 0.1s; }
.service-card:nth-child(2) { animation-delay: 0.15s; }
.service-card:nth-child(3) { animation-delay: 0.2s; }
.service-card:nth-child(4) { animation-delay: 0.25s; }
.service-card:nth-child(5) { animation-delay: 0.3s; }
.service-card:nth-child(6) { animation-delay: 0.35s; }

.work-item:nth-child(1) { animation-delay: 0.1s; }
.work-item:nth-child(2) { animation-delay: 0.15s; }
.work-item:nth-child(3) { animation-delay: 0.2s; }
.work-item:nth-child(4) { animation-delay: 0.25s; }
.work-item:nth-child(5) { animation-delay: 0.3s; }

.testimonial-card:nth-child(1) { animation-delay: 0.1s; }
.testimonial-card:nth-child(2) { animation-delay: 0.15s; }
.testimonial-card:nth-child(3) { animation-delay: 0.2s; }
.testimonial-card:nth-child(4) { animation-delay: 0.25s; }

.stat-card:nth-child(1) { animation-delay: 0.8s; }
.stat-card:nth-child(2) { animation-delay: 0.85s; }

/* ========== TEXT REVEAL ANIMATION ========== */

.section-title span,
.hero-title span,
.feature-title span,
.cta-title span {
    opacity: 0;
    transform: translateY(15px);
    display: inline-block;
}

/* ========== GLASSMORPHISM ========== */

.hero-content-box,
.stat-card,
.service-card,
.testimonial-card {
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

/* ========== ENHANCED HOVER EFFECTS ========== */

.navbar a,
.footer a {
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar a::after,
.footer a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--gold-primary);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar a:hover::after,
.footer a:hover::after {
    width: 100%;
}

/* ========== SMOOTH SCROLLBAR ========== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--black-dark);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold-primary), var(--gold-dark));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--gold-light), var(--gold-primary));
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */

.service-card,
.work-item,
.testimonial-card,
.stat-card {
    will-change: transform;
}

/* ========== SUBTLE BORDER EFFECTS ========== */

.service-card,
.stat-card,
.testimonial-card {
    position: relative;
}

.service-card::after,
.stat-card::after,
.testimonial-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, 
        rgba(218, 165, 32, 0.2), 
        transparent, 
        rgba(218, 165, 32, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s;
}

        .service-card:hover::after,
        .stat-card:hover::after,
        .testimonial-card:hover::after {
            opacity: 0.6;
        }

/* ========== BUTTON ENHANCEMENTS ========== */

.btn-primary,
.cta-button-large,
.stat-button,
.btn-view-all {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover,
.cta-button-large:hover,
.stat-button:hover,
.btn-view-all:hover {
    transform: translateY(-2px);
}

.btn-primary:active,
.cta-button-large:active,
.stat-button:active,
.btn-view-all:active {
    transform: translateY(0);
}
