/* =========================================================
   Services Scroll Widget - Figma-style
   - 7 visible rows (3 above, 1 active center, 3 below)
   - Outer rows fade + blur progressively
   - Center active row sits behind a glass pill with green arrow
   - No scrollbar; mouse wheel + touch + drag drive the scroll
   ========================================================= */

.ssw-wrapper {
    --ssw-item-h: 50px;       /* row height (overridable from Elementor) */
    --ssw-visible: 7;          /* MUST stay odd (3 above + 1 active + 3 below) */
    --ssw-arrow-size: 16px;
    --ssw-arrow-gap: 14px;
    position: relative;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
    color: #fff;
    font-family: inherit;
}

.ssw-viewport {
    position: relative;
    height: calc(var(--ssw-item-h) * var(--ssw-visible));
    overflow: hidden;
    /* Soft top/bottom fade so distant rows melt into the background */
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,0.35) 8%,
        #000 38%,
        #000 62%,
        rgba(0,0,0,0.35) 92%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,0,0,0.35) 8%,
        #000 38%,
        #000 62%,
        rgba(0,0,0,0.35) 92%,
        transparent 100%
    );
}

/* --- Glass active pill (the "Sober Driver Dubai" box in Figma) --- */
.ssw-active-pill {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 40px);
    height: calc(var(--ssw-item-h) - 4px);
    background-color: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    box-shadow:
        0 6px 24px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.20),
        inset 0 -1px 0 rgba(0, 0, 0, 0.10);
    pointer-events: none;
    z-index: 2;
}

/* Green arrow indicator on the left side of the active pill */
.ssw-arrow {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: var(--ssw-arrow-size);
    height: var(--ssw-arrow-size);
    color: #16C47A;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(22, 196, 122, 0.45));
}
.ssw-arrow svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Track that holds all items --- */
.ssw-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%; /* the active slot sits at the vertical center */
    margin: 0;
    padding: 0;
    list-style: none;
    will-change: transform;
    z-index: 1;
}

/* --- Individual rows --- */
.ssw-item {
    position: absolute;
    left: 0;
    right: 0;
    height: var(--ssw-item-h);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 24px;
    box-sizing: border-box;
    cursor: default;
    transition:
        opacity 0.35s ease,
        filter 0.35s ease,
        transform 0.35s ease;
    pointer-events: none; /* only the active row is clickable */
}

.ssw-item .ssw-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.2px;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Distance-based fade & blur.
   Offset is set inline by JS via the --d custom property (|0,1,2,3|).
   d = 0  → active (clear, full opacity)
   d = 1  → near (no blur, slight fade)
   d = 2  → mid (light blur, more fade)
   d = 3  → far (heavy blur, almost gone)
*/
.ssw-item[data-d="0"] {
    opacity: 1;
    filter: blur(0);
}
.ssw-item[data-d="1"] {
    opacity: 0.85;
    filter: blur(0);
}
.ssw-item[data-d="2"] {
    opacity: 0.55;
    filter: blur(1.2px);
}
.ssw-item[data-d="3"] {
    opacity: 0.28;
    filter: blur(2.6px);
}
.ssw-item[data-d="4"],
.ssw-item[data-d="5"] {
    opacity: 0;
    filter: blur(4px);
}

/* The active row is clickable + slightly bolder */
.ssw-item.ssw-active {
    pointer-events: auto;
    cursor: pointer;
}
.ssw-item.ssw-active .ssw-title {
    color: #FFFFFF;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Click feedback on active row */
.ssw-item.ssw-active:active .ssw-title {
    transform: scale(0.98);
}

/* Hide native scrollbars completely (we're not using them anyway, but just in case) */
.ssw-viewport::-webkit-scrollbar,
.ssw-track::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
.ssw-viewport,
.ssw-track {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .ssw-wrapper {
        --ssw-item-h: 46px;
        max-width: 320px;
    }
    .ssw-item .ssw-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .ssw-wrapper {
        --ssw-item-h: 42px;
        max-width: 280px;
    }
    .ssw-item .ssw-title {
        font-size: 15px;
    }
}

/* Accessibility */
.ssw-wrapper:focus-visible {
    outline: 2px solid #16C47A;
    outline-offset: 4px;
    border-radius: 12px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ssw-track,
    .ssw-item {
        transition: none !important;
    }
}
