/**
 * HubsMesaclick Theme - Animations
 *
 * @package HubsMesaclick Theme
 */

/* ========================================
   Logo visibility on dark background
   ======================================== */
.hmc-site-header .wp-block-site-logo img {
    filter: brightness(1.8) contrast(1.1);
    transition: filter 0.3s ease;
}

.hmc-site-header .wp-block-site-logo img:hover {
    filter: brightness(2) contrast(1.15);
}

/* ========================================
   Header Background Animation
   ======================================== */
.hmc-site-header {
    background-size: 200% 200% !important;
    animation: headerBgShift 8s ease-in-out infinite;
}

@keyframes headerBgShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 50% 0%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 100%;
    }
}

/* ========================================
   Header Text Animations (Site Title + Nav)
   ======================================== */

/* Site title shimmer */
.hmc-site-header .wp-block-site-title a {
    position: relative;
    background: linear-gradient(
        90deg,
        #ffffff 0%,
        #ffffff 35%,
        #D4A853 50%,
        #ffffff 65%,
        #ffffff 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 4s ease-in-out infinite;
}

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

/* Nav links: fade in on load with stagger */
.hmc-site-header .wp-block-navigation-item {
    animation: navFadeIn 0.6s ease-out both;
}
.hmc-site-header .wp-block-navigation-item:nth-child(1) { animation-delay: 0.1s; }
.hmc-site-header .wp-block-navigation-item:nth-child(2) { animation-delay: 0.2s; }
.hmc-site-header .wp-block-navigation-item:nth-child(3) { animation-delay: 0.3s; }
.hmc-site-header .wp-block-navigation-item:nth-child(4) { animation-delay: 0.4s; }
.hmc-site-header .wp-block-navigation-item:nth-child(5) { animation-delay: 0.5s; }
.hmc-site-header .wp-block-navigation-item:nth-child(6) { animation-delay: 0.6s; }

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

/* ========================================
   Scroll Reveal Animations (Blocks)
   ======================================== */

/* Base state: hidden before animation */
.hmc-animate {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Fade up (default) */
.hmc-animate--fade-up {
    transform: translateY(40px);
}

/* Fade in from left */
.hmc-animate--fade-left {
    transform: translateX(-50px);
}

/* Fade in from right */
.hmc-animate--fade-right {
    transform: translateX(50px);
}

/* Scale up */
.hmc-animate--scale {
    transform: scale(0.9);
}

/* Animated state: visible */
.hmc-animate.hmc-visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays for children (columns, cards) */
.hmc-stagger > .hmc-animate:nth-child(1) { transition-delay: 0s; }
.hmc-stagger > .hmc-animate:nth-child(2) { transition-delay: 0.15s; }
.hmc-stagger > .hmc-animate:nth-child(3) { transition-delay: 0.3s; }
.hmc-stagger > .hmc-animate:nth-child(4) { transition-delay: 0.45s; }
.hmc-stagger > .hmc-animate:nth-child(5) { transition-delay: 0.6s; }
.hmc-stagger > .hmc-animate:nth-child(6) { transition-delay: 0.75s; }

/* ========================================
   Header entrance animation
   ======================================== */
.hmc-site-header {
    animation: headerSlideDown 0.6s ease-out;
}

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

/* Navigation links hover glow */
.hmc-site-header .wp-block-navigation-item__content {
    transition: text-shadow 0.3s ease, color 0.3s ease;
}

.hmc-site-header .wp-block-navigation-item__content:hover {
    text-shadow: 0 0 10px rgba(212, 168, 83, 0.6),
                 0 0 20px rgba(192, 57, 43, 0.3);
}

/* ========================================
   Button pulse animation
   ======================================== */
.wp-block-button__link {
    position: relative;
    overflow: hidden;
}

.wp-block-button__link::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.wp-block-button__link:hover::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   Hero section animations
   ======================================== */
.hmc-hero-section .wp-block-heading {
    animation: heroTextReveal 1s ease-out 0.3s both;
}

.hmc-hero-section p {
    animation: heroTextReveal 1s ease-out 0.5s both;
}

.hmc-hero-section .wp-block-buttons {
    animation: heroTextReveal 1s ease-out 0.7s both;
}

.hmc-hero-product-img {
    animation: heroImageFloat 1s ease-out 0.4s both, heroFloat 4s ease-in-out 1.4s infinite;
}

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

@keyframes heroImageFloat {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* ========================================
   Card hover shine effect
   ======================================== */
.hmc-step-card,
.hmc-post-card,
.hmc-benefit-card {
    position: relative;
    overflow: hidden;
}

.hmc-step-card::after,
.hmc-post-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 60%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.7s ease;
    pointer-events: none;
}

.hmc-step-card:hover::after,
.hmc-post-card:hover::after {
    transform: rotate(45deg) translateX(100%);
}

/* ========================================
   Section divider animation
   ======================================== */
.hmc-section-divider.hmc-visible {
    animation: dividerExpand 0.8s ease-out both;
}

@keyframes dividerExpand {
    from {
        width: 0;
    }
    to {
        width: 60px;
    }
}

/* ========================================
   Counter / number animation
   ======================================== */
.hmc-step-number {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.hmc-step-card:hover .hmc-step-number {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(192, 57, 43, 0.3);
}

/* ========================================
   Footer reveal
   ======================================== */
.hmc-site-footer {
    animation: footerReveal 0.8s ease-out;
}

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

/* ========================================
   Respect reduced motion preference
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .hmc-animate {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hmc-site-header {
        animation: none !important;
    }

    .hmc-site-header .wp-block-site-title a {
        animation: none !important;
        -webkit-text-fill-color: white !important;
        background: none !important;
    }

    .hmc-site-header .wp-block-navigation-item {
        animation: none !important;
    }

    .hmc-hero-product-img,
    .hmc-hero-section .wp-block-heading,
    .hmc-hero-section p,
    .hmc-hero-section .wp-block-buttons {
        animation: none !important;
    }

    .hmc-site-header {
        animation: none !important;
    }
}
