/* MAES Masonry Projects Styles */

.maes-masonry-container {
    margin: 0;
    padding: 0;
    width: 100%;
}

.maes-masonry-grid {
    margin: 0 -7.5px;
    position: relative;
}

.maes-masonry-item {
    width: calc(33.333% - 15px);
    margin: 0 7.5px 15px 7.5px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    background: #fff;
}

.maes-masonry-item:hover {
    transform: translateY(-5px);
}

.maes-masonry-item-image {
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
    height: auto;
}

.maes-masonry-item-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.maes-masonry-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 20px;
    box-sizing: border-box;
}

.maes-masonry-item:hover .maes-masonry-item-overlay {
    opacity: 1;
}

.maes-masonry-item:hover .maes-masonry-item-image img {
    opacity: 0.4;
    transform: scale(1.05);
}

.maes-masonry-item-title {
    color: #333;
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-align: left;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.maes-masonry-item-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    margin: 0;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.maes-masonry-item:hover .maes-masonry-item-title,
.maes-masonry-item:hover .maes-masonry-item-excerpt {
    transform: translateY(0);
}

/* États de chargement */
.maes-masonry-loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.maes-masonry-loading::after {
    content: "...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Responsive Design */

/* Tablette */
@media (max-width: 1024px) {
    .maes-masonry-grid {
        margin: 0 -10px;
    }
    
    .maes-masonry-item {
        width: calc(50% - 20px);
        margin: 0 10px 20px 10px;
    }
    
    .maes-masonry-item-title {
        font-size: 16px;
    }
    
    .maes-masonry-item-excerpt {
        font-size: 13px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .maes-masonry-grid {
        margin: 0 -5px;
    }
    
    .maes-masonry-item {
        width: calc(50% - 10px);
        margin: 0 5px 15px 5px;
    }
    
    /* Remplacer hover par tap sur mobile */
    .maes-masonry-item {
        cursor: pointer;
    }
    
    .maes-masonry-item.mobile-active .maes-masonry-item-overlay {
        opacity: 1;
    }
    
    .maes-masonry-item.mobile-active .maes-masonry-item-image img {
        opacity: 0.4;
        transform: scale(1.05);
    }
    
    .maes-masonry-item.mobile-active .maes-masonry-item-title,
    .maes-masonry-item.mobile-active .maes-masonry-item-excerpt {
        transform: translateY(0);
    }
    
    .maes-masonry-item-title {
        font-size: 15px;
    }
    
    .maes-masonry-item-excerpt {
        font-size: 12px;
    }
}

/* Très petit mobile */
@media (max-width: 480px) {
    .maes-masonry-item {
        width: calc(100% - 10px);
    }
    
    .maes-masonry-item-overlay {
        padding: 15px;
    }
    
    .maes-masonry-item-title {
        font-size: 16px;
    }
    
    .maes-masonry-item-excerpt {
        font-size: 13px;
    }
}

/* Animation d'apparition des items */
.maes-masonry-item {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.maes-masonry-item:nth-child(1) { animation-delay: 0.1s; }
.maes-masonry-item:nth-child(2) { animation-delay: 0.2s; }
.maes-masonry-item:nth-child(3) { animation-delay: 0.3s; }
.maes-masonry-item:nth-child(4) { animation-delay: 0.4s; }
.maes-masonry-item:nth-child(5) { animation-delay: 0.5s; }
.maes-masonry-item:nth-child(6) { animation-delay: 0.6s; }
.maes-masonry-item:nth-child(7) { animation-delay: 0.7s; }
.maes-masonry-item:nth-child(8) { animation-delay: 0.8s; }
.maes-masonry-item:nth-child(9) { animation-delay: 0.9s; }
.maes-masonry-item:nth-child(10) { animation-delay: 1.0s; }
.maes-masonry-item:nth-child(11) { animation-delay: 1.1s; }
.maes-masonry-item:nth-child(12) { animation-delay: 1.2s; }
.maes-masonry-item:nth-child(n+13) { animation-delay: 1.3s; }

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

/* Styles pour le mode sans image */
.maes-masonry-item-no-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.maes-masonry-item-no-image .maes-masonry-item-title {
    color: #333;
    transform: none;
    margin-bottom: 15px;
}

.maes-masonry-item-no-image .maes-masonry-item-excerpt {
    color: #666;
    transform: none;
}