/* ===================================
   The Magnano Pizza Co - Animations
   =================================== */

/* ===================================
   Fade In Animation
   =================================== */

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

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

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

/* ===================================
   Scroll Animation Classes
   =================================== */

.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* ===================================
   Gallery Item Stagger Animation
   =================================== */

.gallery-item:nth-child(1) {
    animation-delay: 0s;
}

.gallery-item:nth-child(2) {
    animation-delay: 0.1s;
}

.gallery-item:nth-child(3) {
    animation-delay: 0.2s;
}

.gallery-item:nth-child(4) {
    animation-delay: 0.3s;
}

.gallery-item:nth-child(5) {
    animation-delay: 0.4s;
}

.gallery-item:nth-child(6) {
    animation-delay: 0.5s;
}

.gallery-item.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* ===================================
   Button Hover Animations
   =================================== */

.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ===================================
   Image Hover Effects
   =================================== */

.gallery-item {
    position: relative;
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(45, 95, 63, 0.3) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.gallery-item:hover::after {
    opacity: 1;
}

/* ===================================
   Loading Animation
   =================================== */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ===================================
   Slide In Animations
   =================================== */

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   Scale Animations
   =================================== */

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

@keyframes scaleUp {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}

/* ===================================
   Bounce Animation (for scroll indicator)
   =================================== */

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* ===================================
   Shimmer Effect (for loading states)
   =================================== */

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

.shimmer {
    background: linear-gradient(
        to right,
        #f6f7f8 0%,
        #edeef1 20%,
        #f6f7f8 40%,
        #f6f7f8 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* ===================================
   Rotate Animation
   =================================== */

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

.rotate {
    animation: rotate 2s linear infinite;
}

/* ===================================
   Shake Animation (for errors)
   =================================== */

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ===================================
   Glow Effect
   =================================== */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(45, 95, 63, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(45, 95, 63, 0.8);
    }
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* ===================================
   Typewriter Effect (optional)
   =================================== */

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s forwards;
}

/* ===================================
   Underline Grow Animation
   =================================== */

@keyframes underlineGrow {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.underline-grow::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    height: 2px;
    background-color: var(--primary-green);
    animation: underlineGrow 0.3s ease-out forwards;
}

/* ===================================
   Floating Animation
   =================================== */

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

.float {
    animation: float 3s ease-in-out infinite;
}

/* ===================================
   Page Load Animations
   =================================== */

.page-load-fade {
    animation: fadeIn 1s ease-out;
}

.page-load-slide {
    animation: slideInFromBottom 0.8s ease-out;
}

/* ===================================
   Hover Lift Effect
   =================================== */

.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* ===================================
   Smooth Transitions
   =================================== */

.smooth-transition {
    transition: all var(--transition-normal);
}

.smooth-transition-slow {
    transition: all var(--transition-slow);
}

.smooth-transition-fast {
    transition: all var(--transition-fast);
}

/* ===================================
   Entrance Animations for Sections
   =================================== */

.section-entrance {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-entrance.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================
   Mobile Menu Animations
   =================================== */

@keyframes slideInMenu {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.nav-menu.active {
    animation: slideInMenu 0.3s ease-out;
}

/* ===================================
   Overlay Fade In
   =================================== */

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

.overlay-fade {
    animation: overlayFadeIn 0.3s ease-out;
}

/* ===================================
   Accessibility - Respect User Preferences
   =================================== */

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