/* Hero Carousel */
.mrc-hero-carousel {
    width: 100vw;
    height: 100dvh;
    min-height: 400px;
    max-height: 100dvh;
    position: relative;
    top: -80px;
    overflow: hidden;
    z-index: 1;
    --slide-duration: 8s; /* Durata configurabile per l'animazione */
}

.mrc-hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    opacity: 0;
    z-index: 1;
    transition: opacity 1.5s ease-in-out;
    pointer-events: none;
    will-change: transform; /* Ottimizzazione performance */
}

/* Pseudo-elemento per l'immagine di sfondo con zoom */
.mrc-hero-slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    transform: var(--slide-transform, scale(1.2)); /* Inizia al 120% */
    animation: var(--slide-animation, none);
    z-index: -1; /* Dietro al contenuto */
}

.mrc-hero-slide.active::after {
    animation: zoomOut var(--slide-duration) ease-out forwards; /* Zoom out sincronizzato */
}

.mrc-hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(37, 29, 7, 0.0) 0%,
            rgba(37, 29, 7, 0.1) 50%,
            rgba(37, 29, 7, 0.2) 100%);
    /* background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.4) 100%); */
    z-index: 2;
}

.mrc-hero-slide.active {
    opacity: 1;
    z-index: 3;
    pointer-events: auto;
}

/* Forza la dimensione finale per tutte le slide con animazione completa */
.mrc-hero-slide.animation-complete::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
}

/* Mantieni la dimensione finale anche durante la transizione fade */
.mrc-hero-slide:not(.active).animation-complete::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
}

/* Imposta le variabili CSS per le slide con animazione completa */
.mrc-hero-slide.animation-complete {
    --slide-transform: scale(1) !important;
    --slide-animation: none !important;
}

/* Mantieni la dimensione finale anche durante la transizione fade */
.mrc-hero-carousel .mrc-hero-slide:not(.active).animation-complete::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
}

/* Regola più specifica per forzare la dimensione finale */
.mrc-hero-carousel .mrc-hero-slide.animation-complete::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
}

/* Forza la dimensione finale anche per slide non attive con animazione completa */
.mrc-hero-carousel .mrc-hero-slide.animation-complete:not(.active)::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
}

/* Mantieni la dimensione finale durante la transizione opacity */
.mrc-hero-carousel .mrc-hero-slide.animation-complete {
    --slide-transform: scale(1) !important;
}

.mrc-hero-carousel .mrc-hero-slide.animation-complete::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
}

/* Forza la dimensione finale anche quando la slide non è più attiva */
.mrc-hero-carousel .mrc-hero-slide.animation-complete:not(.active) {
    --slide-transform: scale(1) !important;
}

.mrc-hero-carousel .mrc-hero-slide.animation-complete:not(.active)::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
}

/* Hero Video Styles */
.mrc-hero-video-slide {
    background: none !important;
    transform: none !important; /* Disabilita zoom per i video */
}

.mrc-hero-video-slide.active {
    animation: none !important; /* Disabilita animazione per i video */
}

.mrc-hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.mrc-hero-video-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(37, 29, 7, 0.0) 0%,
            rgba(37, 29, 7, 0.1) 50%,
            rgba(37, 29, 7, 0.2) 100%);
    z-index: 2;
}

/* Hero Content */
.mrc-hero-content {
    position: absolute;
    top: 33dvh;
    left: 50%;
    transform: translateX(-50%);
    max-width: 1440px;
    text-align: left;
    color: white;
    z-index: 4;
    width: calc(100vw - 100px);
    opacity: 0;
    transition: opacity 1s ease-in-out 0.5s;
}

.mrc-hero-slide.active .mrc-hero-content {
    opacity: 1;
}

.mrc-hero-title {
    margin-bottom: 5vh;
}

.mrc-hero-title img {
    margin-bottom: 1rem;
    line-height: 1.2;
    border: 2px solid rgba(255, 255, 255, 1);
    padding: 10px 30px;
    background-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    max-width: calc(100vw - 100px);
}

.mrc-hero-subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
    max-width: 500px;
}

/* Hero Navigation */
.mrc-hero-nav {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    gap: 1rem;
}

.mrc-hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mrc-hero-dot.active {
    background: var(--secondary-color);
    transform: scale(1.2);
}

.mrc-hero-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Video Controls for Mobile */
@media (max-width: 767px) {
    .mrc-hero-video {
        object-position: center;
    }
    
    .mrc-hero-content {
        top: 25dvh;
        width: calc(100vw - 40px);
    }
    
    .mrc-hero-title img {
        padding: 8px 20px;
        max-width: calc(100vw - 40px);
    }
    
    .mrc-hero-subtitle {
        font-size: 1.2rem;
        max-width: 100%;
    }
    
    /* Riduci l'effetto zoom su mobile per performance */
    .mrc-hero-slide::after {
        transform: var(--slide-transform, scale(1.1)); /* Zoom più leggero su mobile */
    }
    
    @keyframes zoomOut {
        0% {
            transform: scale(1.1);
        }
        100% {
            transform: scale(1);
        }
    }
}

@media (min-width: 768px) {
    .mrc-hero-carousel {
        position: relative;
        top: -90px;
    }

    .mrc-hero-carousel,
    .mrc-hero-slide {
        height: 100dvh;
        min-height: 500px;
    }

    .mrc-hero-subtitle {
        font-size: 1.8rem;
    }

    .mrc-hero-nav {
        bottom: 3rem;
    }
}

@media (min-width: 1024px) {
    .mrc-hero-subtitle {
        font-size: 2rem;
    }
    
    .mrc-hero-video {
        object-position: center;
    }
}

/* Video Loading States */
.mrc-hero-video-slide.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 3;
}

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

/* Animazione Zoom Out */
@keyframes zoomOut {
    0% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Disabilita animazioni per utenti che preferiscono meno movimento */
@media (prefers-reduced-motion: reduce) {
    .mrc-hero-slide::after {
        transform: scale(1) !important;
        animation: none !important;
    }
    
    .mrc-hero-slide.active::after {
        animation: none !important;
    }
}

/* Forza la dimensione finale anche durante il fadeout */
.mrc-hero-slide.zoomed-final::after {
    transform: scale(1) !important;
    animation: none !important;
    transition: none !important;
}