/**
 * Styles pour la Grille de Projets
 * Projects Grid for Divi
 */

/* Conteneur principal de la grille */
.pgd-projects-grid {
    display: grid;
    gap: var(--grid-gap, 32px);
    width: 100%;
    margin: 0 auto;
}

/* Configuration des colonnes selon le nombre sélectionné */
.pgd-projects-grid.pgd-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.pgd-projects-grid.pgd-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.pgd-projects-grid.pgd-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive : 1 colonne sur tablette ET mobile */
@media (max-width: 980px) {
    .pgd-projects-grid.pgd-columns-2,
    .pgd-projects-grid.pgd-columns-3,
    .pgd-projects-grid.pgd-columns-4 {
        grid-template-columns: 1fr !important;
    }
}

/* Item de projet individuel */
.pgd-project-item {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pgd-project-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Lien du projet */
.pgd-project-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

/* Image de fond du projet */
.pgd-project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.pgd-project-item:hover .pgd-project-image {
    transform: scale(1.05);
}

/* Image placeholder si pas d'image */
.pgd-project-image.pgd-no-image {
    background-color: #e5e7eb;
    background-image: linear-gradient(135deg, #f3f4f6 25%, transparent 25%),
                      linear-gradient(225deg, #f3f4f6 25%, transparent 25%),
                      linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
                      linear-gradient(315deg, #f3f4f6 25%, #e5e7eb 25%);
    background-position: 10px 0, 10px 0, 0 0, 0 0;
    background-size: 20px 20px;
    background-repeat: repeat;
}

/* Overlay léger pour assombrir et améliorer la lisibilité */
.pgd-project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.3) 30%,
        rgba(0, 0, 0, 0.1) 60%,
        transparent 100%
    );
    transition: background 0.3s ease;
}

.pgd-project-item:hover .pgd-project-overlay {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.4) 30%,
        rgba(0, 0, 0, 0.15) 60%,
        transparent 100%
    );
}

/* Contenu du projet (titre + catégorie) */
.pgd-project-content {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 2;
    max-width: calc(100% - 48px);
}

/* Titre du projet */
.pgd-project-title {
    font-size: 20px;
    font-weight: 600;
    color: #f5f6f7;
    margin: 0 0 12px 0;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.pgd-project-item:hover .pgd-project-title {
    transform: translateX(4px);
}

/* Étiquette de catégorie */
.pgd-project-category {
    display: inline-block;
    padding: 4px 16px;
    border: solid 1px #f5f6f7;
    border-radius: 100px;
    background-color: rgba(245, 246, 247, 0.28);
    color: #f5f6f7;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.pgd-project-item:hover .pgd-project-category {
    background-color: rgba(245, 246, 247, 0.4);
    transform: translateX(4px);
}

/* Animations de chargement */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pgd-project-item {
    animation: fadeInUp 0.5s ease forwards;
}

/* Délai d'animation pour chaque item (effet cascade) */
.pgd-project-item:nth-child(1) { animation-delay: 0.05s; }
.pgd-project-item:nth-child(2) { animation-delay: 0.1s; }
.pgd-project-item:nth-child(3) { animation-delay: 0.15s; }
.pgd-project-item:nth-child(4) { animation-delay: 0.2s; }
.pgd-project-item:nth-child(5) { animation-delay: 0.25s; }
.pgd-project-item:nth-child(6) { animation-delay: 0.3s; }
.pgd-project-item:nth-child(7) { animation-delay: 0.35s; }
.pgd-project-item:nth-child(8) { animation-delay: 0.4s; }
.pgd-project-item:nth-child(9) { animation-delay: 0.45s; }

/* État initial avant l'animation */
.pgd-project-item {
    opacity: 0;
}

/* Accessibilité : focus states */
.pgd-project-link:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.pgd-project-link:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* ================================================
   Filtre par catégorie — Barre de pills
   ================================================ */

.pgd-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.pgd-filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 20px;
    background-color: transparent;
    border: 1.5px solid currentColor;
    border-radius: 100px;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0.55;
    font-family: inherit;
}

.pgd-filter-pill:hover {
    opacity: 1;
}

.pgd-filter-pill.is-active {
    background-color: #111827;
    border-color: #111827;
    color: #ffffff;
    opacity: 1;
}

.pgd-filter-pill:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Items masqués lors du filtrage */
.pgd-project-item.pgd-hidden {
    display: none;
}