/* Advanced Animations and Interactions */

/* Intersection Observer Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transition: all 0.8s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
}

/* Slide In Animations */
.slide-in-left {
    transform: translateX(-100px);
}

.slide-in-left.animated {
    transform: translateX(0);
}

.slide-in-right {
    transform: translateX(100px);
}

.slide-in-right.animated {
    transform: translateX(0);
}

.slide-in-up {
    transform: translateY(100px);
}

.slide-in-up.animated {
    transform: translateY(0);
}

.slide-in-down {
    transform: translateY(-100px);
}

.slide-in-down.animated {
    transform: translateY(0);
}

/* Scale Animations */
.scale-in {
    transform: scale(0.8);
}

.scale-in.animated {
    transform: scale(1);
}

.scale-in-bounce {
    transform: scale(0.3);
}

.scale-in-bounce.animated {
    transform: scale(1);
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Rotation Animations */
.rotate-in {
    transform: rotate(-180deg) scale(0.5);
}

.rotate-in.animated {
    transform: rotate(0deg) scale(1);
}

/* Flip Animations */
.flip-in-x {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0;
}

.flip-in-x.animated {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
}

/* Stagger Animation Delays */
.animate-stagger-1 { animation-delay: 0.1s; }
.animate-stagger-2 { animation-delay: 0.2s; }
.animate-stagger-3 { animation-delay: 0.3s; }
.animate-stagger-4 { animation-delay: 0.4s; }
.animate-stagger-5 { animation-delay: 0.5s; }
.animate-stagger-6 { animation-delay: 0.6s; }

/* Header Scroll Animation */
.header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
}

.header.scrolled .nav-brand h1 {
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

/* Hero Text Animation */
.hero-title .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(50px);
    animation: wordSlideUp 0.8s ease forwards;
}

.hero-title .word:nth-child(1) { animation-delay: 0.2s; }
.hero-title .word:nth-child(2) { animation-delay: 0.4s; }
.hero-title .word:nth-child(3) { animation-delay: 0.6s; }

@keyframes wordSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-color); }
}

/* Floating Animation */
.float-animation {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Pulse Animation */
.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Glow Effect */
.glow-effect {
    transition: all 0.3s ease;
}

.glow-effect:hover {
    box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--primary-color);
    transform: translateY(-5px);
}

/* Shimmer Loading Effect */
.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Parallax Scrolling Elements */
.parallax-element {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* Image Hover Effects */
.image-zoom-effect {
    overflow: hidden;
    border-radius: 15px;
}

.image-zoom-effect img {
    transition: transform 0.5s ease;
}

.image-zoom-effect:hover img {
    transform: scale(1.1);
}

/* Card Hover Animations */
.card-hover-lift {
    transition: all 0.3s ease;
    transform-origin: center;
}

.card-hover-lift:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Progress Bar Animation */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--light-gray);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    transform: translateX(-100%);
    animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
    to {
        transform: translateX(0);
    }
}

/* Text Highlight Animation */
.highlight-text {
    background: linear-gradient(120deg, transparent 0%, transparent 50%, var(--accent-color) 50%);
    background-size: 240% 100%;
    background-repeat: no-repeat;
    transition: background-position 0.8s ease;
}

.highlight-text.animated {
    background-position: 100% 0;
}

/* Counter Animation */
.counter {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* Reveal Animation for Text */
.reveal-text {
    position: relative;
    overflow: hidden;
}

.reveal-text::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    animation: revealText 1.5s ease-in-out forwards;
}

@keyframes revealText {
    0% {
        width: 100%;
    }
    50% {
        width: 100%;
    }
    100% {
        width: 0;
    }
}

/* Morphing Shapes */
.morph-shape {
    animation: morphing 8s ease-in-out infinite;
}

@keyframes morphing {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* Gallery Filter Animation */
.gallery-item.filter-hide {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.gallery-item.filter-show {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: rgba(212, 32, 42, 0.2);
    z-index: 1001;
}

.scroll-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.1s ease;
}

/* Magnetic Button Effect */
.magnetic-button {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.magnetic-button .btn-text {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
}

/* Social Media Icon Animations */
.social-link {
    position: relative;
}

.social-link.facebook:hover {
    background-color: #1877f2;
}

.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.social-link.twitter:hover {
    background-color: #1da1f2;
}

.social-link.yelp:hover {
    background-color: #d32323;
}

/* Viewport Fade In Animation */
.viewport-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.viewport-fade-in.in-viewport {
    opacity: 1;
    transform: translateY(0);
}

/* Performance Optimizations */
.animate-gpu {
    transform: translateZ(0);
    will-change: transform;
}

/* Reduce animations on mobile for performance */
@media screen and (max-width: 768px) {
    .parallax-element,
    .float-animation,
    .morph-shape {
        animation: none;
        transform: none;
    }
    
    .image-zoom-effect:hover img {
        transform: none;
    }
    
    .card-hover-lift:hover {
        transform: translateY(-5px);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .shimmer,
    .glow-effect:hover {
        box-shadow: none;
    }
    
    .highlight-text {
        background: none;
        text-decoration: underline;
    }
}

/* Animation for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll,
    .slide-in-left,
    .slide-in-right,
    .slide-in-up,
    .slide-in-down,
    .scale-in,
    .scale-in-bounce,
    .rotate-in,
    .flip-in-x,
    .float-animation,
    .pulse-animation,
    .typewriter,
    .morph-shape,
    .loading-dots span {
        animation: none;
        transition: none;
    }
    
    .animate-on-scroll,
    .slide-in-left,
    .slide-in-right,
    .slide-in-up,
    .slide-in-down,
    .scale-in,
    .scale-in-bounce,
    .rotate-in,
    .flip-in-x {
        opacity: 1;
        transform: none;
    }
}
