/* ============================================
   JURYBERRY - Scroll Animations
   ============================================ */

/* Animation Base States */
.animate-fade-up,
.animate-fade-left,
.animate-fade-right,
.animate-scale-in {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--delay, 0s);
}

.animate-fade-up {
    transform: translateY(30px);
}

.animate-fade-left {
    transform: translateX(-30px);
}

.animate-fade-right {
    transform: translateX(30px);
}

.animate-scale-in {
    transform: scale(0.9);
}

/* Animated States */
.animate-fade-up.animate,
.animate-fade-left.animate,
.animate-fade-right.animate,
.animate-scale-in.animate {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Stagger Animation for Children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-children.animate > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.animate > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.animate > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.animate > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.animate > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.animate > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.animate > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-children.animate > *:nth-child(8) { transition-delay: 0.8s; }

.stagger-children.animate > * {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Animations */
.hero-content {
    animation: hero-fade-in 1s ease forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

@keyframes hero-fade-in {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    animation: hero-title-reveal 0.8s ease forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

@keyframes hero-title-reveal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        letter-spacing: 0.2em;
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        letter-spacing: 0.05em;
    }
}

.hero-subtitle {
    animation: fade-in 0.6s ease forwards;
    animation-delay: 0.8s;
    opacity: 0;
}

.hero-description {
    animation: fade-in 0.6s ease forwards;
    animation-delay: 1s;
    opacity: 0;
}

.hero-cta {
    animation: fade-in 0.6s ease forwards;
    animation-delay: 1.2s;
    opacity: 0;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scroll Indicator Animation */
.scroll-indicator {
    animation: scroll-fade-in 0.6s ease forwards;
    animation-delay: 1.5s;
    opacity: 0;
}

@keyframes scroll-fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 0.7;
        transform: translateX(-50%) translateY(0);
    }
}

/* Service Card Hover Animation */
.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.service-card:hover::before {
    transform: scaleX(1);
}

/* Portfolio Hover Effects */
.portfolio-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, var(--color-accent), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.portfolio-item:hover::before {
    opacity: 0.3;
}

/* Button Hover Effects */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.btn:hover::after {
    transform: translateX(100%);
}

/* Stat Number Animation */
.stat-item {
    position: relative;
    overflow: hidden;
}

.stat-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(233, 69, 96, 0.1), transparent);
    transition: left 0.5s ease;
}

.stat-item:hover::after {
    left: 100%;
}

/* Form Focus Animation */
.form-group input,
.form-group textarea {
    position: relative;
}

.form-group::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.form-group:focus-within::after {
    width: 100%;
}

/* Nav Link Underline Animation */
.nav-link::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::before {
    width: 100%;
}

/* Social Link Pulse */
.social-links a:hover svg {
    animation: pulse 0.4s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Logo Animation */
.logo img {
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: rotate(10deg) scale(1.1);
}

/* Tag Hover Animation */
.tag {
    position: relative;
    overflow: hidden;
}

.tag::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(233, 69, 96, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.tag:hover::before {
    width: 200%;
    height: 200%;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Page Transition */
.page-transition {
    animation: page-enter 0.4s ease;
}

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

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-up,
    .animate-fade-left,
    .animate-fade-right,
    .animate-scale-in,
    .hero-content,
    .hero-title,
    .hero-subtitle,
    .hero-description,
    .hero-cta,
    .scroll-indicator {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .stagger-children > * {
        opacity: 1;
        transform: none;
    }
}
