/**
 * Styles pour Project Grid
 */

/* Container principal */
.project-grid-container {
    width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Grille */
.project-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
}

/* Style Masonry */
.project-grid-container[data-style="masonry"] .project-grid {
    grid-auto-rows: 10px;
}

.project-grid-container[data-style="masonry"] .project-image-wrapper::before {
    display: none;
}

.project-grid-container[data-style="masonry"] .project-image-wrapper {
    position: relative;
    width: 100%;
    height: auto;
}

.project-grid-container[data-style="masonry"] .project-image {
    position: relative;
    width: 100%;
    height: auto;
}

/* Responsive - colonnes dynamiques */
.project-grid-container[data-columns="1"] .project-grid {
    grid-template-columns: repeat(1, 1fr);
}

.project-grid-container[data-columns="2"] .project-grid {
    grid-template-columns: repeat(2, 1fr);
}

.project-grid-container[data-columns="3"] .project-grid {
    grid-template-columns: repeat(3, 1fr);
}

.project-grid-container[data-columns="4"] .project-grid {
    grid-template-columns: repeat(4, 1fr);
}

.project-grid-container[data-columns="5"] .project-grid {
    grid-template-columns: repeat(5, 1fr);
}

.project-grid-container[data-columns="6"] .project-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive */
@media (max-width: 1200px) {
    .project-grid-container[data-columns="6"] .project-grid,
    .project-grid-container[data-columns="5"] .project-grid,
    .project-grid-container[data-columns="4"] .project-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .project-grid {
        grid-template-columns: repeat(1, 1fr) !important;
        gap: 10px;
    }
}

/* Item de la grille */
.project-grid-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.project-grid-item:hover {
    transform: translateY(-5px);
}

/* Wrapper de l'image */
.project-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f0f0f0;
}

.project-image-wrapper::before {
    content: '';
    display: block;
    padding-top: 100%; /* Ratio 1:1 - Images carrées */
}

/* Image du projet */
.project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.4s ease, transform 0.4s ease;
}

/* Effet hover - couleur */
.project-grid-item:hover .project-image {
    filter: grayscale(0%);
    transform: scale(1.05);
}

/* Légende - Cachée par défaut */
.project-caption {
    display: none;
}

/* === LIGHTBOX === */

.project-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.project-lightbox.active {
    display: block;
}

/* Overlay */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18" stroke="white" stroke-width="2" stroke-linecap="round"/><line x1="6" y1="6" x2="18" y2="18" stroke="white" stroke-width="2" stroke-linecap="round"/></svg>') 12 12, pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Contenu de la lightbox */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px 20px;
    box-sizing: border-box;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18" stroke="white" stroke-width="2" stroke-linecap="round"/><line x1="6" y1="6" x2="18" y2="18" stroke="white" stroke-width="2" stroke-linecap="round"/></svg>') 12 12, pointer;
}

/* Container de l'image */
.lightbox-image-container {
    max-width: 90%;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    cursor: default;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
    cursor: default;
    pointer-events: none;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Informations */
.lightbox-info {
    text-align: center;
    color: #fff;
    max-width: 800px;
    padding: 0 20px;
}

.lightbox-title {
    display: none;
}

.lightbox-legend {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    color: #ccc;
}

/* Boutons de navigation */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    transition: all 0.3s ease;
    z-index: 10000;
    line-height: 1;
    opacity: 0.7;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

/* Bouton de fermeture avec croix SVG */
.lightbox-close {
    top: 180px;
    right: 30px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
}

.lightbox-close:hover svg {
    stroke-width: 2.5;
}

/* Flèches fines avec SVG */
.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-prev svg,
.lightbox-next svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev:hover svg,
.lightbox-next:hover svg {
    stroke-width: 2.5;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 80px 10px 10px;
    }
    
    .lightbox-image-container {
        max-height: 60vh;
    }
    
    .lightbox-image {
        max-height: 60vh;
    }
    
    .lightbox-title {
        font-size: 20px;
    }
    
    .lightbox-legend {
        font-size: 14px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 32px;
        height: 32px;
        padding: 8px;
    }
    
    .lightbox-prev svg,
    .lightbox-next svg {
        width: 20px;
        height: 20px;
    }
    
    .lightbox-close {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }
    
    .lightbox-close svg {
        width: 20px;
        height: 20px;
    }
}

/* Masquer les boutons si un seul projet */
.project-lightbox.single-project .lightbox-prev,
.project-lightbox.single-project .lightbox-next {
    display: none;
}
