.hs-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.hs-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.hs-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: var(--hs-bg-pos, center);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 0;
}

.hs-slide.hs-active {
    opacity: 1;
    z-index: 1;
}

.hs-slider[data-animation="slide"] .hs-track {
    display: flex;
    transition: transform 0.6s ease;
}

.hs-slider[data-animation="slide"] .hs-slide {
    position: relative;
    flex: 0 0 100%;
    opacity: 1;
}

.hs-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hs-content {
    position: relative;
    z-index: 2;
    text-align: center;
    /* Largo abbastanza da tenere i titoli su una riga quando c'è spazio,
       ma mai oltre il 90% della finestra (margini laterali su schermi medi). */
    max-width: min(1200px, 90vw);
    padding: 2rem;
}

.hs-content-image {
    max-width: var(--hs-img-w, 280px);
    height: auto;
    margin-bottom: 1.5rem;
}

.hs-separator {
    display: block;
    border: 0;
}

.hs-badge {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 1.2rem;
}

.hs-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 0.8rem;
}

.hs-subtitle {
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 300;
    line-height: 1.3;
    margin: 0 0 0.6rem;
    opacity: 0.9;
}

/* Interlinea di titolo e sottotitolo con specificità e !important alti,
   per battere le regole di line-height del tema (es. Avada su h2/p) che
   altrimenti fanno accavallare il titolo o allargano troppo il sottotitolo. */
.hs-slider .hs-content .hs-title {
    line-height: 1.2 !important;
}

.hs-slider .hs-content .hs-subtitle {
    line-height: 1.3 !important;
}

.hs-body {
    font-size: 1rem;
    margin: 0 0 1.5rem;
    opacity: 0.8;
    line-height: 1.6;
}

.hs-slider .hs-content .hs-cta,
.hs-slider .hs-content .hs-cta:link,
.hs-slider .hs-content .hs-cta:visited,
.hs-slider .hs-content .hs-cta:focus,
.hs-slider .hs-content a.hs-cta,
.fusion-builder-row .hs-slider .hs-cta {
    display: inline-block !important;
    padding: 0.8rem 2.5rem !important;
    border: 2px solid !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    transition: all 0.3s ease !important;
    margin-top: 1rem !important;
    box-shadow: none !important;
    outline: none !important;
    line-height: 1.5 !important;
}

.hs-slider .hs-content .hs-cta:hover,
.hs-slider .hs-content a.hs-cta:hover,
.fusion-builder-row .hs-slider .hs-cta:hover {
    transform: translateY(-2px);
    text-decoration: none !important;
}

.hs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.8rem;
    border-radius: 50%;
    transition: background 0.3s;
    line-height: 0;
}

.hs-arrow:hover {
    background: rgba(0, 0, 0, 0.6);
}

.hs-arrow-prev {
    left: 1.5rem;
}

.hs-arrow-next {
    right: 1.5rem;
}

.hs-dots {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 0.6rem;
}

.hs-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s;
}

.hs-dot.hs-dot-active,
.hs-dot:hover {
    background: #fff;
    border-color: #fff;
}

/* Entrance animations */
.hs-animate {
    opacity: 0;
}

.hs-active .hs-animate.hs-anim-running {
    animation-duration: 0.8s;
    animation-fill-mode: both;
    animation-timing-function: ease-out;
}

@keyframes hsFadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes hsFadeInUp {
    from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); }
}
@keyframes hsFadeInDown {
    from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: translateY(0); }
}
@keyframes hsFadeInLeft {
    from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); }
}
@keyframes hsFadeInRight {
    from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); }
}
@keyframes hsZoomIn {
    from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); }
}

/* Punto focale dell'immagine di sfondo su schermi non-desktop (tablet + mobile,
   fino a 1024px): usa la posizione "mobile" se impostata, altrimenti quella desktop.
   Soglia più ampia del resto (768px) perché i tablet in verticale ritagliano
   l'immagine come i telefoni. */
@media (max-width: 1024px) {
    .hs-slide {
        background-position: var(--hs-bg-pos-mobile, var(--hs-bg-pos, center));
    }
}

/* Mobile landscape (es. cellulare in orizzontale): il viewport è molto basso,
   comprime i contenuti così tutto entra senza tagliare il bottone */
@media (max-height: 500px) and (orientation: landscape) {
    .hs-content {
        padding: 0.8rem 1.2rem;
    }

    .hs-content-image {
        max-width: 110px;
        margin-bottom: 0.5rem;
    }

    .hs-badge {
        font-size: 0.65rem;
        margin-bottom: 0.4rem;
    }

    .hs-title {
        font-size: clamp(1.2rem, 4vw, 2rem);
        margin-bottom: 0.4rem;
    }

    .hs-subtitle {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    .hs-body {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
    }

    .hs-cta {
        padding: 0.5rem 1.5rem;
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }

    .hs-dots {
        bottom: 0.5rem;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    /* Su mobile l'altezza si adatta al contenuto (niente testi tagliati).
       L'altezza minima resta quella impostata inline nello slider e viene
       ereditata dalle slide, così riempiono sempre il contenitore senza vuoti. */
    .hs-slider {
        height: auto !important;
    }

    .hs-track {
        min-height: inherit;
    }

    .hs-slider .hs-slide {
        height: auto;
        min-height: inherit;
    }

    /* La slide attiva è "in flusso" e definisce l'altezza del contenitore,
       così cresce con il contenuto invece di restare bloccata e tagliare i testi. */
    .hs-slider .hs-slide.hs-active {
        position: relative;
    }

    .hs-content {
        /* Padding extra in basso: lascia spazio ai pallini di navigazione
           così la CTA non li copre */
        padding: 1.8rem 1.2rem 4rem;
        max-width: 100%;
    }

    /* Su mobile l'immagine contenuto usa la larghezza mobile dedicata se impostata,
       altrimenti quella desktop; min(...,100%) garantisce che non sbordi mai. */
    .hs-content-image {
        max-width: var(--hs-img-w-mobile, var(--hs-img-w, 100%));
        height: auto;
        margin-bottom: 1rem;
    }

    .hs-badge {
        font-size: 0.7rem;
        letter-spacing: 2px;
        margin-bottom: 0.8rem;
    }

    .hs-body {
        font-size: 0.9rem;
    }

    .hs-cta {
        padding: 0.6rem 1.8rem;
        font-size: 0.85rem;
    }

    .hs-arrow {
        padding: 0.5rem;
    }

    .hs-arrow svg {
        width: 28px;
        height: 28px;
    }

    .hs-arrow-prev {
        left: 0.5rem;
    }

    .hs-arrow-next {
        right: 0.5rem;
    }

    .hs-dots {
        bottom: 1rem;
    }

    .hs-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .hs-cta {
        padding: 0.5rem 1.4rem;
        font-size: 0.8rem;
    }

    .hs-arrow {
        padding: 0.4rem;
    }

    .hs-arrow svg {
        width: 22px;
        height: 22px;
    }
}
