/**
 * Services Section Frontend Styles
 */

/* Force full width - override WPBakery container padding */
.wpb_column:has(.ssw-services-section),
.vc_column-inner:has(.ssw-services-section),
.wpb_wrapper:has(.ssw-services-section) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.vc_row:has(.ssw-services-section),
.wpb_row:has(.ssw-services-section) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
}

/* Container */
.ssw-services-section {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: var(--ssw-height, 600px);
    position: relative;
    overflow: hidden;
}

/* Service Item */
.ssw-service-item {
    position: relative;
    flex: 1;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    transition: flex var(--ssw-animation-duration, 500ms) cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: flex;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    isolation: isolate;
}

/* Invisible hit area for better hover detection */
.ssw-service-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: transparent;
}

/* Background Image */
.ssw-service-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform var(--ssw-animation-duration, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Overlay */
.ssw-service-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--ssw-overlay-color, rgba(0, 0, 0, 0.5));
    transition: background-color var(--ssw-animation-duration, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab Title (sideways, shown when collapsed) */
.ssw-tab-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    white-space: nowrap;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    transition: opacity calc(var(--ssw-animation-duration, 500ms) * 0.6) cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 10;
    pointer-events: none;
    will-change: opacity;
}

/* Default Content (small title at bottom) */
.ssw-default-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px;
    z-index: 5;
    transition: opacity var(--ssw-animation-duration, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.ssw-small-title {
    color: var(--ssw-title-color, #ffffff);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Expanded Content */
.ssw-expanded-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    text-align: center;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease-out, visibility 0s linear 200ms;
    will-change: opacity, visibility;
    pointer-events: none;
}

.ssw-main-title {
    color: var(--ssw-title-color, #ffffff);
    font-size: 42px;
    font-weight: 700;
    margin: 0 auto 20px auto;
    line-height: 1.2;
    transform: translateY(20px);
    transition: transform var(--ssw-animation-duration, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center !important;
}

.ssw-subtitle {
    color: var(--ssw-subtitle-color, #ffffff);
    font-size: 18px;
    line-height: 1.6;
    margin: 0 auto 30px auto;
    transform: translateY(20px);
    transition: transform var(--ssw-animation-duration, 500ms) cubic-bezier(0.4, 0, 0.2, 1) 0.05s;
    text-align: center !important;
    max-width: 100%;
}

.ssw-cta-button {
    display: inline-block;
    padding: 15px 40px;
    background-color: var(--ssw-cta-bg, #ffffff);
    color: var(--ssw-cta-color, #000000);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    transform: translateY(20px);
    transition: transform var(--ssw-animation-duration, 500ms) cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
                background-color 0.3s ease,
                color 0.3s ease;
}

.ssw-cta-button:hover {
    background-color: var(--ssw-cta-color, #000000);
    color: var(--ssw-cta-bg, #ffffff);
}

/* ========================================
   HOVER STATE - When one item is hovered
   ======================================== */

/* Container has a hovered item */
.ssw-services-section.ssw-has-hover .ssw-service-item {
    flex: 0 0 var(--ssw-tab-width, 60px);
}

/* The hovered item expands */
.ssw-services-section.ssw-has-hover .ssw-service-item.ssw-active {
    flex: 1 1 auto;
}

/* Active item - hide the hit area overlay so content is clickable */
.ssw-services-section.ssw-has-hover .ssw-service-item.ssw-active::before {
    z-index: -1;
}

/* Collapsed items (tabs) - ensure they are fully interactive */
.ssw-services-section.ssw-has-hover .ssw-service-item:not(.ssw-active) {
    cursor: pointer;
}

/* Collapsed tabs hit area - highest z-index */
.ssw-services-section.ssw-has-hover .ssw-service-item:not(.ssw-active)::before {
    z-index: 9999;
}

/* Collapsed items show tab title */
.ssw-services-section.ssw-has-hover .ssw-service-item:not(.ssw-active) .ssw-tab-title {
    opacity: 1;
}

/* Collapsed items hide default content */
.ssw-services-section.ssw-has-hover .ssw-service-item:not(.ssw-active) .ssw-default-content {
    opacity: 0;
}

/* Hide expanded content elements in collapsed tabs to prevent blocking */
.ssw-services-section.ssw-has-hover .ssw-service-item:not(.ssw-active) .ssw-expanded-content {
    pointer-events: none;
    visibility: hidden;
}

/* Active item - show expanded content */
.ssw-service-item.ssw-active .ssw-expanded-content {
    opacity: 1;
    visibility: visible;
    transition: opacity 200ms ease-out 150ms, visibility 0s linear 0s;
    pointer-events: auto;
}

.ssw-service-item.ssw-active .ssw-main-title,
.ssw-service-item.ssw-active .ssw-subtitle,
.ssw-service-item.ssw-active .ssw-cta-button {
    transform: translateY(0);
}

/* Active item - hide default content */
.ssw-service-item.ssw-active .ssw-default-content {
    opacity: 0;
}

/* Active item - darker overlay */
.ssw-service-item.ssw-active .ssw-service-overlay {
    background-color: var(--ssw-expanded-overlay-color, rgba(0, 0, 0, 0.6));
}

/* Active item - slight zoom on background */
.ssw-service-item.ssw-active .ssw-service-bg {
    transform: scale(1.05);
}

/* ========================================
   RESPONSIVE - Mobile (stacked vertically)
   ======================================== */

@media (max-width: 991px) {
    .ssw-services-section {
        flex-direction: column;
        height: auto;
    }

    .ssw-service-item {
        flex: none !important;
        height: var(--ssw-mobile-height, 300px);
        width: 100%;
    }

    /* On mobile, always show default content, hide tab title */
    .ssw-tab-title {
        display: none;
    }

    .ssw-default-content {
        opacity: 1 !important;
    }

    /* Expanded content on mobile - on tap */
    .ssw-service-item.ssw-mobile-active {
        height: auto;
        min-height: var(--ssw-mobile-height, 300px);
        padding-bottom: 60px;
    }

    .ssw-service-item.ssw-mobile-active .ssw-expanded-content {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        opacity: 1;
        visibility: visible;
        padding: 40px 20px;
        width: 100%;
        max-width: 100%;
    }

    .ssw-service-item.ssw-mobile-active .ssw-default-content {
        opacity: 0 !important;
    }

    .ssw-service-item.ssw-mobile-active .ssw-main-title,
    .ssw-service-item.ssw-mobile-active .ssw-subtitle,
    .ssw-service-item.ssw-mobile-active .ssw-cta-button {
        transform: translateY(0);
    }

    .ssw-main-title {
        font-size: 28px;
    }

    .ssw-subtitle {
        font-size: 16px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.ssw-service-item:focus {
    outline: 2px solid #ffffff;
    outline-offset: -4px;
}

.ssw-cta-button:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .ssw-service-item,
    .ssw-service-bg,
    .ssw-service-overlay,
    .ssw-tab-title,
    .ssw-default-content,
    .ssw-expanded-content,
    .ssw-main-title,
    .ssw-subtitle,
    .ssw-cta-button {
        transition: none !important;
    }
}
