/* ============================================================
   SLIDER SERVIZI — v2.8.0

   LAYOUT (larghezze fisse, coordinate esatte):
   ┌─────────────────────────────┬──────┬──────────────┐
   │                             │  ↑   │  Esperienze  │
   │  [img sfalsata basso-sx]    │  ↓   │   1 / 4      │
   │                             │      │  [thumb 1]   │
   │   [hashtag]                 │      │  [thumb 2]   │
   │   [TITOLO SERIF]            │      │  [thumb 3]   │
   │   [descrizione]             │      │              │
   │   [Scopri →]                │      │    LOGO      │
   │                             │      │              │
   ├─────────────────────────────┼──────┼──────────────┤
   │    ss-content-area          │ nav  │ ss-right-col │
   │    right: NAV+RCOL          │ 60px │    160px     │
   └─────────────────────────────┴──────┴──────────────┘

   Desktop: nav-col = 60px, right-col = 160px
   nav ha right: 300px per tenere distanza extra dal bordo destro
   ============================================================ */

/* ── Reset ───────────────────────────────────────────────── */
.ss-outer *, .ss-outer *::before, .ss-outer *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Root ────────────────────────────────────────────────── */
.ss-outer {
    position: relative;
    /* z-index: non impostato → il widget NON partecipa allo stacking globale.
       Le sezioni sticky di Elementor (z-index: 9999+) restano sopra correttamente.
       I figli interni sono contenuti da overflow:hidden e non escono dai bordi. */
    width: 100%;
    height: 85vh;
    min-height: 520px;
    overflow: hidden;
    font-family: inherit;
}

/* ── Sfondo statico ──────────────────────────────────────── */
.ss-bg {
    position: absolute;
    inset: 0;
    background-image: var(--ss-bg-d, none); /* impostata via PHP inline style */
    background-size: cover;
    background-position: center;
    z-index: 0;
}
.ss-bg-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0,0,0,0.35);
    z-index: 1;
}

/* ============================================================
   AREA CONTENUTO
   right = nav-col(50px) + right-col(160px) = 210px
   ============================================================ */
.ss-content-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 210px;
    bottom: 0;
    z-index: 2;
    overflow: hidden;
}

/* ── Slide ───────────────────────────────────────────────── */
.ss-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.75s ease;
}
.ss-slide.ss-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* ── Immagine grande sfalsata basso-sinistra ─────────────── */
.ss-main-img-wrap {
    position: absolute;
    left: 40px;
    bottom: -8%;
    width: 44%;
    height: 90%;
    box-shadow: 6px 6px 40px rgba(0,0,0,0.45);
    overflow: hidden;
    z-index: 5;
}
.ss-main-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 1.1s ease;
}
.ss-slide:not(.ss-active) .ss-main-img { transform: scale(1.06); }
.ss-slide.ss-active .ss-main-img       { transform: scale(1); }

/* ── Testo ───────────────────────────────────────────────── */
.ss-text-block {
    position: absolute;
    left: calc(44% + 60px);
    right: 210px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 400px;
}

.ss-hashtag {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.65);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}
.ss-title {
    font-size: 52px;
    font-weight: 700;
    line-height: 1.0;
    color: #ffffff;
    font-family: Georgia, 'Times New Roman', serif;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.55s ease 0.35s, transform 0.55s ease 0.35s;
}
.ss-description {
    font-size: 0.86rem;
    line-height: 1.65;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease 0.5s, transform 0.5s ease 0.5s;
}
.ss-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #ffffff;
    text-decoration: none;
    width: fit-content;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease 0.65s, transform 0.5s ease 0.65s;
}
.ss-link:hover { opacity: 0.75; }
.ss-link-arrow { transition: transform 0.25s ease; flex-shrink: 0; }
.ss-link:hover .ss-link-arrow { transform: translateX(5px); }

.ss-slide.ss-active .ss-hashtag,
.ss-slide.ss-active .ss-title,
.ss-slide.ss-active .ss-description,
.ss-slide.ss-active .ss-link {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   COLONNA FRECCE — strip verticale
   right: 160px (subito a sinistra di ss-right-col)
   width: 50px
   ============================================================ */
.ss-nav-col {
    position: absolute;
    top: 0;
    right: 160px;
    bottom: 0;
    width: 50px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ss-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.6);
    background: rgba(0,0,0,0.3);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s;
    outline: none;
    flex-shrink: 0;
}
.ss-nav-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffffff;
}

/* ============================================================
   COLONNA DESTRA — thumbnail + etichetta + logo
   right: 0, width: 160px
   ============================================================ */
.ss-right-col {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 160px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 0;
    background-color: rgba(0,0,0,0.45);
    border-left: 1px solid rgba(255,255,255,0.15);
    overflow: hidden;
}

/* ── Etichetta + counter ─────────────────────────────────── */
.ss-right-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-bottom: 16px;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.ss-section-lbl {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.65);
    line-height: 1;
}
.ss-counter {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    gap: 1px;
}
.ss-cur {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    display: inline-block;
    transition: all 0.3s ease;
}
.ss-sep { opacity: 0.45; }

/* ── Viewport thumbnail ─────────────────────────────────── */
.ss-thumb-viewport {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 80%, transparent 100%);
}

/* ── Track scorre verso l'ALTO ───────────────────────────── */
.ss-thumb-track {
    display: flex;
    flex-direction: column;
    width: 100%;
    will-change: transform;
    transition: transform 0.65s cubic-bezier(0.77, 0, 0.175, 1);
}

/* ── Item thumbnail ──────────────────────────────────────── */
.ss-thumb-item {
    width: 100%;
    padding: 7px 12px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}
.ss-thumb-img {
    width: 100%;
    height: 65px;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
    transform: scale(0.9);
    flex-shrink: 0;
}
.ss-thumb-item.ss-active .ss-thumb-img {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 3px 16px rgba(0,0,0,0.5);
}
.ss-thumb-item:hover:not(.ss-active) .ss-thumb-img {
    opacity: 0.6;
    transform: scale(0.95);
}

/* ── Logo watermark ──────────────────────────────────────── */
.ss-logo {
    position: absolute;
    bottom: -18%;
    left: 0;
    right: 0;
    font-size: 2.2rem;
    font-weight: 900;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.08);
    line-height: 0.88;
    text-align: center;
    pointer-events: none;
    padding: 0 6px;
    word-break: break-word;
    z-index: 1;
}

/* ============================================================
   RESPONSIVE — LAPTOP  ≤ 1280px
   ============================================================ */
@media (max-width: 1280px) {
    .ss-content-area  { right: 198px; }
    .ss-nav-col       { right: 150px; width: 48px; }
    .ss-right-col     { width: 150px; }
    .ss-title         { font-size: 46px; }
    .ss-text-block    { left: calc(44% + 52px); right: 0; max-width: 320px; }
}

/* ============================================================
   RESPONSIVE — TABLET LANDSCAPE  ≤ 1024px
   ============================================================ */
@media (max-width: 1024px) {
    .ss-content-area  { right: 176px; }
    .ss-nav-col       { right: 130px; width: 46px; gap: 10px; }
    .ss-nav-btn       { width: 32px; height: 32px; }
    .ss-right-col     { width: 130px; }
    .ss-main-img-wrap { width: 40%; left: 20px; }
    .ss-text-block    { left: calc(40% + 40px); right: 0; max-width: 280px; gap: 12px; }
    .ss-title         { font-size: 38px; }
    .ss-thumb-img     { height: 55px; }
    .ss-logo          { font-size: 1.8rem; }
}

/* ============================================================
   RESPONSIVE — TABLET + MOBILE  ≤ 768px
   Layout: thumbnail orizzontale in cima
            immagine con testo sovrapposto
            frecce sotto
   ============================================================ */
@media (max-width: 768px) {

    /* Outer: colonna verticale */
    .ss-outer {
        height: auto !important;
        min-height: 0 !important;
        overflow: hidden;
        display: flex !important;
        flex-direction: column !important;
    }
    .ss-bg         { position: absolute; inset: 0; height: 100%; width: 100%; background-image: var(--ss-bg-t); }
    .ss-bg-overlay { position: absolute; inset: 0; height: 100%; width: 100%; }

    /* ── 1. Thumbnail strip orizzontale IN CIMA ── */
    .ss-right-col {
        order: -1 !important;
        position: relative !important;
        top: auto !important; right: auto !important; bottom: auto !important;
        width: 100% !important;
        height: 74px !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0 !important;
        background-color: rgba(0,0,0,0.55) !important;
        border-left: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.15) !important;
        overflow: hidden !important;
        display: flex !important;
        z-index: 5;
    }
    .ss-right-top { display: none !important; }
    .ss-logo      { display: none !important; }

    .ss-thumb-viewport {
        width: 100% !important;
        height: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%) !important;
        mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%) !important;
    }
    .ss-thumb-track {
        flex-direction: row !important;
        height: 100% !important;
        width: max-content !important;
        align-items: center !important;
        transition: none !important; /* scroll gestito da JS via scrollLeft */
    }
    .ss-thumb-item {
        width: 72px !important;
        height: 58px !important;
        padding: 6px 5px !important;
        flex-shrink: 0 !important;
    }
    .ss-thumb-img { width: 100% !important; height: 100% !important; }

    /* ── 2. Content area: sotto le thumbnail ── */
    .ss-content-area {
        order: 0 !important;
        position: relative !important;
        top: auto !important; left: auto !important;
        right: auto !important; bottom: auto !important;
        width: 100% !important;
        overflow: hidden;
        z-index: 2;
    }

    .ss-slide {
        position: relative !important;
        inset: auto !important;
        display: none;
        opacity: 1 !important;
        pointer-events: none;
    }
    .ss-slide.ss-active { display: block; pointer-events: auto; }

    /* Immagine: full width, altezza fissa */
    .ss-main-img-wrap {
        position: relative !important;
        left: auto !important; bottom: auto !important;
        width: 100% !important;
        height: 58vw !important;
        min-height: 240px !important;
        margin: 0 !important;
        display: block !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
        overflow: hidden;
    }
    .ss-main-img { width: 100% !important; height: 100% !important; display: block !important; }

    /* Testo: SOVRAPPOSTO sull'immagine in basso, con gradiente */
    .ss-text-block {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        padding: 50px 20px 18px !important;
        max-width: none !important;
        gap: 8px !important;
        background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0) 100%);
        z-index: 5;
    }

    /* Disabilita animazioni ingresso (testo già visibile) */
    .ss-slide.ss-active .ss-hashtag,
    .ss-slide.ss-active .ss-title,
    .ss-slide.ss-active .ss-description,
    .ss-slide.ss-active .ss-link {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .ss-title       { font-size: 28px; line-height: 1.15; }
    .ss-description { font-size: 0.82rem; }

    /* ── 3. Frecce: sotto l'immagine, orizzontali ── */
    .ss-nav-col {
        order: 1 !important;
        position: relative !important;
        top: auto !important; right: auto !important; bottom: auto !important;
        left: auto !important;
        width: 100% !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 20px !important;
        padding: 14px 0 18px !important;
        z-index: 10;
        display: flex !important;
        background: rgba(0,0,0,0.45);
    }
    .ss-nav-btn {
        width: 38px !important;
        height: 38px !important;
        color: #5D6D4D !important;
        border-color: rgba(93,109,77,0.7) !important;
        background: rgba(255,255,255,0.88) !important;
    }
    .ss-nav-btn:hover {
        background: #ffffff !important;
        border-color: #5D6D4D !important;
    }
}

/* ============================================================
   RESPONSIVE — MOBILE  ≤ 480px
   Aggiustamenti su base ≤768px: thumbnail più piccola,
   immagine più alta, titolo più piccolo
   ============================================================ */
@media (max-width: 480px) {

    .ss-bg { background-image: var(--ss-bg-m); }

    /* Thumbnail strip: leggermente più bassa */
    .ss-right-col  { height: 64px !important; }
    .ss-thumb-item { width: 62px !important; height: 50px !important; }

    /* Immagine: più alta su schermi stretti */
    .ss-main-img-wrap { height: 64vw !important; min-height: 220px !important; }

    /* Testo: padding ridotto */
    .ss-text-block { padding: 40px 16px 16px !important; }

    .ss-title { font-size: 24px; line-height: 1.15; }

    /* Frecce */
    .ss-nav-btn { width: 36px !important; height: 36px !important; }
}
