/* Container */
.uffizio-group-container {
    width: 100%;
    height: 500px;
    position: relative;
    overflow: hidden;
}

/* Wrapper - becomes Flex container on Desktop */
.uffizio-group-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 15px;
}

/* Card Item */
.uffizio-group-item {
    position: relative;
    flex: 1;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: flex 0.4s cubic-bezier(0.25, 1, 0.3, 1);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Active State */
.uffizio-group-item.active {
    flex: 3;
    cursor: default;
}

/* Overlay Gradient */
.uffizio-group-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.85) 100%);
    transition: opacity 0.4s ease;
}

.uffizio-group-item:hover .uffizio-group-overlay,
.uffizio-group-item.active .uffizio-group-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0.95) 100%);
}

/* Center Content (Inactive State) */
.uffizio-group-center-content {
    /* Removed absolute positioning to prevent sliding during expansion */
    position: relative;
    z-index: 3;
    width: 100%;
    text-align: center;
    padding: 20px;
    opacity: 1;
    /* Return to Idle: Wait for shrink (0.6s) then fade in */
    transition: opacity 0.4s ease 0.6s;
}

.uffizio-group-item:hover .uffizio-group-center-content,
.uffizio-group-item.active .uffizio-group-center-content {
    opacity: 0;
    pointer-events: none;
    /* Hover/Active: Hide instantly so we don't see it move */
    transition: opacity 0s;
}

/* Bottom Content (Active State) */
.uffizio-group-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 4;
    padding: 30px;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    /* Return to Idle: Hide instantly */
    transition: opacity 0s;
}

.uffizio-group-item:hover .uffizio-group-content,
.uffizio-group-item.active .uffizio-group-content {
    opacity: 1;
    pointer-events: auto;
    /* Hover/Active: Wait 0.4s for mostly expanded, then fade in */
    transition: opacity 0.5s ease 0.2s;
}

/* Common Titles Style */
.uffizio-group-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    font-family: var(--uffizio-font-heading, "Oswald", sans-serif);
    color: var(--uffizio-text-white);
    line-height: 1.2;
}

.uffizio-group-title.center {
    font-size: 22px;
    /* Slightly larger in center */
    letter-spacing: 1px;
}

.uffizio-group-title.bottom {
    font-size: 22px;
    margin-bottom: 10px;
}

/* Description & Button Wrap */
.uffizio-group-desc-wrap {
    display: flex;
    flex-direction: column;
}

.uffizio-group-desc {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
    display: block;
}

/* Full Box Link Overlay */
.uffizio-full-box-link {
    position: absolute;
    inset: 0;
    z-index: 10;
    cursor: pointer;
}

/* Explore More Link */
.uffizio-group-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    text-transform: capitalize;
    text-decoration: none;
    font-size: 14px;
    position: relative;
    z-index: 2;
    transition: gap 0.3s ease;
}

.uffizio-group-link svg {
    fill: currentColor;
    width: 16px;
    height: 16px;
}

.uffizio-group-link:hover {
    gap: 12px;
    color: var(--uffizio-color-accent, #007bff);
}

/* Mobile / Tablet Styles */
@media (max-width: 1024px) {
    .uffizio-group-container {
        height: auto;
        display: block;
    }

    .uffizio-group-wrapper {
        display: flex;
        gap: 0;
        height: auto;
    }

    .uffizio-group-item {
        height: 450px;
        flex: none !important;
        width: 100% !important;
        justify-content: flex-end;
        /* Always bottom on mobile */
    }

    .uffizio-group-center-content {
        display: none !important;
        /* No center title on mobile */
    }

    .uffizio-group-content {
        position: relative;
        opacity: 1 !important;
        transform: none !important;
        background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
        padding: 20px;
        pointer-events: auto;
    }

    .uffizio-group-title.bottom {
        font-size: 20px;
    }

    .swiper-pagination {
        position: relative;
        margin-top: 15px;
        text-align: center;
    }

    .swiper-pagination-bullet-active {
        background: var(--uffizio-color-accent, #007bff);
        width: 20px;
        border-radius: 4px;
    }
}