.spi-v17-wrapper { background: #000; padding: 80px 0; overflow: hidden; position: relative; }

/* 1. AUTO-HIDE CONTROLS SU INFINITE SCROLL */
.spi-v17-wrapper.mode-autoscroll .spi-footer { display: none !important; }

.embla__viewport { cursor: grab; user-select: none; }
.embla__viewport.is-dragging { cursor: grabbing; }

.embla__slide { flex: 0 0 var(--sp-w); min-width: 0; padding: 20px; position: relative; }
@media (min-width: 1024px) { .embla__slide { flex: 0 0 var(--dt-w); } }
.embla__container { display: flex; will-change: transform; }

.spi-card-v17 {
    display: block; height: var(--h-sp); border-radius: var(--spi-r);
    position: relative; overflow: hidden; background: #0a0a0a;
    text-decoration: none; transform-origin: center center;
    transition: height 0.4s ease; will-change: transform;
}

@media (min-width: 768px) { .spi-card-v17 { height: var(--h-tb); } }
@media (min-width: 1024px) { .spi-card-v17 { height: var(--h-dt); } }
@media (min-width: 1600px) { .spi-card-v17 { height: var(--h-uw); } }

.spi-img-wrap { position: absolute; inset: 0; overflow: hidden; }
.spi-parallax-img {
    position: absolute; top: 0; left: -20%; width: 140%; height: 100%;
    object-fit: cover; object-position: center; max-width: none !important; will-change: transform;
}

.spi-dimmer { position: absolute; inset: 0; background: #000; z-index: 1; will-change: opacity; }

.spi-overlay {
    position: absolute; inset: 0; padding: 50px; display: flex; align-items: flex-end; z-index: 2;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent 60%);
    opacity: 0; transition: opacity 0.4s ease;
}
.spi-card-v17:hover .spi-overlay { opacity: 1; }

.spi-text-mask { overflow: hidden; }
.spi-title {
    color: #fff; font-size: 30px; font-weight: 300; margin: 0; letter-spacing: -0.5px;
    transform: translateY(110%); opacity: 0;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
}
.is-selected .spi-title, .spi-card-v17:hover .spi-title { transform: translateY(0); opacity: 1; }

/* 2. FOOTER MODULARE E INDIPENDENTE */
.spi-footer {
    position: relative;
    height: 54px; /* Altezza fissa dettata dalle frecce */
    margin-top: 35px;
}

.spi-control-layer {
    position: absolute; inset: 0;
    display: flex; align-items: center; gap: 15px;
    padding: 0 5%;
    pointer-events: none; /* Rende il contenitore "trasparente" ai click */
}
.spi-control-layer > * { pointer-events: auto; /* Rende cliccabili solo frecce e dots */ }

/* Allineamenti Indipendenti */
.pos-left { justify-content: flex-start; }
.pos-center { justify-content: center; }
.pos-right { justify-content: flex-end; }
.pos-sides { justify-content: space-between; }

/* Frecce */
.spi-nav-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.25);
    width: 54px; height: 54px; border-radius: 50%; color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    filter: invert(1); transition: all 0.3s ease;
}
.spi-nav-btn:hover { border-color: #fff; background: rgba(255,255,255,0.1); }
.spi-nav-btn svg { width: 22px; height: 22px; }

/* Dots */
.embla__dots { display: flex; gap: 10px; align-items: center; }
.embla__dot {
    background: rgba(255,255,255,0.3); width: 8px; height: 8px; border-radius: 4px; border: none;
    padding: 0; cursor: pointer; transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
}
.embla__dot--selected { width: 45px; background: #fff; }

.embla__progress { height: 2px; background: rgba(255,255,255,0.15); width: 200px; margin: 40px auto; overflow: hidden; border-radius: 2px; }
.embla__progress__bar { background: #fff; width: 100%; height: 100%; transform: translateX(-100%); }

/* ── 17.2 ─────────────────────────────────────────────────────────────────
   Salient forza height/width:auto sulle immagini: su mobile la foto non riempiva la scheda (fascia nera sotto). */
.spi-v17-wrapper .spi-img-wrap .spi-parallax-img {
    position: absolute !important; top: 0 !important; left: -20% !important;
    width: 140% !important; height: 100% !important; max-width: none !important; margin: 0 !important;
    object-fit: cover; object-position: center;
}

/* Marchio + titolo + invito: entrano in sequenza sulla scheda attiva (o al passaggio del mouse) */
.spi-v17-wrapper .spi-text-mask { display: flex; flex-direction: column; align-items: flex-start; }
.spi-v17-wrapper .spi-kicker {
    display: flex; align-items: center; min-height: 30px; margin: 0 0 14px;
    color: #fff; font: 600 11px/1 Manrope, system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase;
    transform: translateY(110%); opacity: 0;
    transition: transform .6s cubic-bezier(0.16, 1, 0.3, 1), opacity .6s ease;
}
.spi-v17-wrapper .spi-kicker .spi-v17-logo {
    display: block; width: calc(22px * var(--lw, 1)) !important; height: auto !important;
    max-width: 150px !important; max-height: 34px !important; margin: 0 !important; object-fit: contain;
}
.spi-v17-wrapper .spi-kicker .logo--svg { filter: brightness(0) invert(1); }
.spi-v17-wrapper .spi-cta {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
    color: rgba(255,255,255,.85); font: 500 14px/1 Manrope, system-ui, sans-serif; letter-spacing: .01em;
    transform: translateY(110%); opacity: 0;
    transition: transform .6s cubic-bezier(0.16, 1, 0.3, 1) .12s, opacity .6s ease .12s;
}
.spi-v17-wrapper .spi-cta svg { width: 16px; height: 16px; transition: transform .25s cubic-bezier(0.23, 1, 0.32, 1); }
.spi-v17-wrapper .spi-title { transition-delay: .06s; }
.spi-v17-wrapper .is-selected .spi-kicker, .spi-v17-wrapper .spi-card-v17:hover .spi-kicker,
.spi-v17-wrapper .is-selected .spi-cta, .spi-v17-wrapper .spi-card-v17:hover .spi-cta { transform: translateY(0); opacity: 1; }
@media (hover: hover) and (pointer: fine) { .spi-v17-wrapper .spi-card-v17:hover .spi-cta svg { transform: translateX(4px); } }

/* Telefono e touch: niente hover, quindi le informazioni della scheda attiva restano sempre visibili */
@media (hover: none), (max-width: 1023px) {
    .spi-v17-wrapper .is-selected .spi-overlay { opacity: 1; }
    .spi-v17-wrapper .spi-overlay { padding: 26px 24px; background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.35) 45%, transparent 70%); }
    .spi-v17-wrapper .spi-title { font-size: 24px; font-weight: 400; line-height: 1.18; letter-spacing: -.3px; }
    .spi-v17-wrapper .embla__slide { padding: 12px 8px; flex: 0 0 80% !important; }
    /* proporzione fissa invece dell'altezza in svh: Safari iOS la misurava diversa dal layout e la scheda copriva i pallini */
    .spi-v17-wrapper .spi-card-v17 { height: auto !important; aspect-ratio: 4 / 5; }
    /* a tutta larghezza: le schede vicine si intravedono ai bordi e si capisce che si scorre */
    .spi-v17-wrapper { width: 100vw; margin-left: calc(50% - 50vw) !important; margin-right: calc(50% - 50vw) !important; padding-bottom: 8px !important; }
    /* col dito si scorre: niente frecce né pallini (Safari iOS non disegnava la fascia sotto la scheda);
       la posizione la dice il contatore dentro la scheda */
    .spi-v17-wrapper .spi-footer { display: none !important; }
    .spi-v17-wrapper .spi-card-v17 .spi-count { display: block; }
}
@media (prefers-reduced-motion: reduce) {
    .spi-v17-wrapper .spi-kicker, .spi-v17-wrapper .spi-title, .spi-v17-wrapper .spi-cta { transition: opacity .2s ease !important; transform: none !important; }
}

/* Contatore "01/08" in alto a destra nella scheda (solo telefono e touch) */
.spi-v17-wrapper .spi-count {
    display: none; position: absolute; top: 18px; right: 20px; z-index: 3;
    color: #fff; font: 600 13px/1 Manrope, system-ui, sans-serif; letter-spacing: .08em;
    text-shadow: 0 1px 8px rgba(0,0,0,.45); opacity: 0; transition: opacity .4s ease;
}
.spi-v17-wrapper .spi-count span { opacity: .55; margin-left: 2px; }
.spi-v17-wrapper .is-selected .spi-count { opacity: 1; }

/* Frecce ai lati (arrow_pos="overlay"): stesso disegno di quelle sui loghi di Projects by region */
.spi-v17-wrapper .embla { position: relative; }
.spi-v17-wrapper .spi-side-btn {
    position: absolute; top: 50%; z-index: 3; display: grid; place-items: center;
    width: 46px; height: 46px; margin: -23px 0 0; padding: 0;
    border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: rgba(20,20,20,.92); color: #fff; cursor: pointer;
    transition: border-color .2s ease, transform .2s cubic-bezier(0.23, 1, 0.32, 1);
}
.spi-v17-wrapper .spi-side-btn::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.spi-v17-wrapper .spi-side-btn svg { display: block; width: 20px; height: 20px; }
.spi-v17-wrapper .spi-side-prev { left: 24px; }
.spi-v17-wrapper .spi-side-next { right: 24px; }
.spi-v17-wrapper .spi-side-btn:active { transform: scale(.94); }
.spi-v17-wrapper .spi-side-btn:focus-visible { outline: 2px solid #4ba49a; outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .spi-v17-wrapper .spi-side-btn:hover { border-color: #fff; } }
@media (hover: none), (max-width: 1023px) {
    .spi-v17-wrapper .spi-side-btn { width: 34px; height: 34px; margin-top: -17px; }
    .spi-v17-wrapper .spi-side-btn svg { width: 16px; height: 16px; }
    .spi-v17-wrapper .spi-side-prev { left: 8px; }
    .spi-v17-wrapper .spi-side-next { right: 8px; }
}
@media (prefers-reduced-motion: reduce) { .spi-v17-wrapper .spi-side-btn { transition: border-color .2s ease; transform: none !important; } }
