/* ================================
   Portfolio (Project) Section
   ================================ */

.portfolio {
    padding: 120px 0;
    background-color: #ffffff;
    overflow: hidden;
}

.portfolio__title-wrapper {
    margin-bottom: 60px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portfolio__title-wrapper .block-title__tagline-wrapper {
    align-items: center;
}

/* Portfolio Flex Container */
.portfolio__container {
    width: 100%;
    overflow: hidden;
    padding: 20px 40px; /* Increased side padding for desktop/tablet */
}

.portfolio__list {
    display: flex;
    gap: 20px;
    padding: 0;
    margin: 0;
    list-style: none;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: max-content; /* Ensure list doesn't wrap and takes full width of children */
}

.portfolio__item {
    position: relative;
    flex: 0 0 180px; /* Fixed base width for inactive items */
    height: 550px;
    border-radius: 20px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Redirection Link coverage */
.portfolio__link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* Background Overlay */
.portfolio__item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.1) 100%);
    opacity: 0.8;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.portfolio__item:hover::before {
    opacity: 0.9;
}

/* Vertical Title (Hidden when active) */
.portfolio__vertical-title {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center;
    white-space: nowrap;
    z-index: 2;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.portfolio__vertical-title h3 {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    opacity: 0.9;
}

/* Active State Expansion */
.portfolio__item.active {
    flex: 0 0 500px; /* Expanded width */
}

.portfolio__item.active .portfolio__vertical-title {
    opacity: 0;
    transform: translateX(-50%) rotate(-90deg) translateY(20px);
}

/* Hidden Content revealed on active */
.portfolio__content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px);
    transition: all 0.5s ease 0.2s;
    z-index: 3;
}

.portfolio__item.active .portfolio__content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.portfolio__tag {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    background-color: var(--color-primary);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 15px;
}

.portfolio__project-title {
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
}

.portfolio__project-text {
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 25px;
}

.portfolio__icon {
    width: 60px;
    height: 60px;
    background-color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-secondary);
    transition: all 0.3s ease;
}

.portfolio__item:hover .portfolio__icon {
    transform: scale(1.1);
    background-color: var(--color-primary);
    color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .portfolio__item {
        height: 450px;
        min-width: 120px;
    }
}

@media (max-width: 767px) {
    .portfolio__container {
        padding: 20px 15px; /* Less padding for mobile */
    }

    .portfolio__list {
        flex-direction: column;
        gap: 20px;
        width: 100%; /* Fix: Override max-content from desktop */
    }
    
    .portfolio__item {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important; /* Fix: Override the 120px from Tablet */
        height: 350px;
    }
    
    .portfolio__vertical-title {
        display: none;
    }
    
    .portfolio__content {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}
