.portfolio {
    background: var(--bg-dark);
    position: relative;
}

.portfolio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-purple), transparent);
}

.carousel-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

.carousel-wrapper {
    overflow: hidden;
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.carousel {
    display: flex;
    transition: none; 
    will-change: transform;
    gap: 1.5rem;
}

.carousel-item {
    flex: 0 0 calc(50% - 0.75rem); 
    aspect-ratio: 4 / 5;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-orange));
    border-radius: 12px;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-item:hover img {
    transform: scale(1.05);
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(123, 44, 191, 0.8);
    border: none;
    border-radius: 50%;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

.portfolio .section-title::before {
    content: 'BEFORE & AFTER';
    display: block;
    font-size: 0.9rem;
    letter-spacing: 2px;
    color: var(--primary-purple);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.carousel-nav:hover {
    background: var(--accent-orange);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 24px rgba(90, 31, 166, 0.4);
}

@media (max-width: 768px) {
    .carousel-item {
        flex: 0 0 100%;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .carousel-prev {
        left: 10px;
    }

    .carousel-next {
        right: 10px;
    }
}