/**
 * Portfolio Images Fix - Equal Size and Proper Alignment
 * Author: Gocha Shevardnadze
 * Description: Makes all portfolio images equal size and properly arranged in rows
 */

/* Portfolio Container Improvements */
#bl-work-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 20px;
    padding: 20px 0;
    margin: 0;
}

/* Portfolio Item Styling */
#bl-work-items > div {
    flex: 0 0 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    float: none;
}

/* Portfolio Link Container */
#bl-work-items > div a {
    display: block;
    position: relative;
    overflow: hidden;
    border: 1px solid #eff0f0;
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 100%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#bl-work-items > div a:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #daa520;
}

/* Portfolio Image Styling - Equal Size */
#bl-work-items > div a img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 8px 8px 0 0;
}

#bl-work-items > div a:hover img {
    transform: scale(1.05);
}

/* Portfolio Overlay */
#bl-work-items > div a div {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(218, 165, 32, 0.9) 0%,
        rgba(218, 165, 32, 0.7) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 8px;
}

#bl-work-items > div a:hover div {
    opacity: 1;
}

/* Portfolio Text */
#bl-work-items > div a div span {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    padding: 10px 20px;
    border: 2px solid #fff;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#bl-work-items > div a:hover div span {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 1200px) {
    #bl-work-items > div {
        flex: 0 0 calc(50% - 15px);
        max-width: calc(50% - 15px);
    }
    
    #bl-work-items {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    #bl-work-items {
        flex-direction: column;
        gap: 20px;
        padding: 15px 0;
    }
    
    #bl-work-items > div {
        flex: 1 1 100%;
        max-width: 100%;
        margin: 0;
    }
    
    #bl-work-items > div a img {
        height: 200px;
    }
}

@media (max-width: 480px) {
    #bl-work-items > div a img {
        height: 180px;
    }
    
    #bl-work-items > div a div span {
        font-size: 14px;
        padding: 8px 16px;
    }
}

/* Dark Theme Support */
body.dark #bl-work-items > div a {
    background: #333;
    border-color: #555;
}

body.dark #bl-work-items > div a:hover {
    border-color: #daa520;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Animation for loading */
#bl-work-items > div {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(30px);
}

#bl-work-items > div:nth-child(1) { animation-delay: 0.1s; }
#bl-work-items > div:nth-child(2) { animation-delay: 0.2s; }
#bl-work-items > div:nth-child(3) { animation-delay: 0.3s; }
#bl-work-items > div:nth-child(4) { animation-delay: 0.4s; }
#bl-work-items > div:nth-child(5) { animation-delay: 0.5s; }
#bl-work-items > div:nth-child(6) { animation-delay: 0.6s; }
#bl-work-items > div:nth-child(7) { animation-delay: 0.7s; }
#bl-work-items > div:nth-child(8) { animation-delay: 0.8s; }
#bl-work-items > div:nth-child(9) { animation-delay: 0.9s; }
#bl-work-items > div:nth-child(10) { animation-delay: 1.0s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fix for Materialize Grid Conflicts */
#bl-work-items > div.col {
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure proper spacing in container */
.container #bl-work-items {
    margin-left: -10px;
    margin-right: -10px;
    width: calc(100% + 20px);
}

/* Portfolio Section Padding */
.bl-content .container {
    padding: 0 20px;
}

@media (max-width: 600px) {
    .bl-content .container {
        padding: 0 15px;
    }
    
    .container #bl-work-items {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
    }
}