/* ==========================================================================
   ALTRA FLEXIBLE LAYOUT SYSTEM CSS
   Système de grille flexible inspiré de Sheriff Projects
   ========================================================================== */

/* Fond noir pleine largeur */
.site-main {
    background-color: #ffff; /* Fond noir sur toute la largeur */
}

/* RESET de la grille actuelle */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    row-gap: 98px;
    padding: 40px 30px 80px;
    margin-top: 0;
    /* Hauteur de ligne = largeur d'une colonne × ratio portrait
       admin : padding 60px×2 + 3 gaps 20px = 180px → col = (100vw - 180px)/4
       row = col × 3.31/2 = (100vw - 180px) × 3.31/8 */
    grid-auto-rows: min(calc((100vw - 180px) * 3.31 / 8), 500px);
}

/* CLASSES DE LARGEUR - Toutes les cartes prennent 1 colonne */
.project-card {
    grid-column: span 1; /* Tous les projets prennent 1 colonne (4 par ligne) */
}

/* Landscape images span 2 columns */
.project-card.project-landscape {
    grid-column: span 2;
}

/* Landscape videos span 4 columns (full width) */
.project-card.project-video-landscape {
    grid-column: span 4;
}

/* Portrait videos — same as portrait photos (1 column) */
.project-card.project-video-portrait {
    grid-column: span 1;
}

/* Note: Grid Manager inline styles (grid-column, grid-row) override these classes automatically */

/* Style de la carte projet */
.project-card {
    position: relative;
    background-color: #ffffff00;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Project link wrapper */
.project-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* grid-auto-rows fournit la hauteur exacte — toutes les .project-image la remplissent.
   flex-shrink: 0 empêche le collapse des cartes vidéo (iframe position:absolute = pas
   de contenu naturel, flex effondrerait sinon l'image au profit du .project-info) */
.project-image {
    height: 100%;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    background-color: #000;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Vimeo background embed wrapper */
.project-video-wrapper {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}

.project-video-wrapper iframe {
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    min-width: 100%; min-height: 100%;
    transform: translate(-50%, -50%) scale(1.01);
    pointer-events: none;
    border: 0;
}


.project-card:hover .project-image img {
    transform: scale(1.02);
}

/* Info section - fixed below image */
.project-info {
    padding: 12px 0 15px;
    background: transparent;
    color: #000;
}

/* One-line caption: Title (bold) — Photographer (regular) */
.project-caption {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.project-title {
    font-weight: 700;
}

.project-photographer {
    font-weight: 400;
}

/* ==========================================================================
   RESPONSIVE : TABLETTE & MOBILE
   Note: Responsive disabled for logged-in users (admin mode)
   Same behavior for both: 2 columns, portrait=1col, landscape=2cols
   ========================================================================== */

/* Tablette (≤1024px) — 2 colonnes, espacements réduits */
@media (max-width: 1024px) {
    body:not(.logged-in) .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2vw;
        row-gap: 9vw;
        padding: 3vw 4vw 10vw;
        /* 2 cols, 1 gap (2vw), padding 4vw×2 = 8vw → col = (100vw - 10vw) / 2 = 45vw */
        grid-auto-rows: min(calc(45vw * 1.655), 500px);
    }

    body:not(.logged-in) .project-card {
        grid-column: span 1;
    }

    body:not(.logged-in) .project-card.project-landscape {
        grid-column: span 2;
    }

    /* Vidéo paysage : pleine largeur des 2 colonnes */
    body:not(.logged-in) .project-card.project-video-landscape {
        grid-column: span 2;
    }

    .project-caption {
        font-size: 80%;
    }

    .project-info {
    padding: 3px 0 25px;
    background: transparent;
    color: #000;
    }

    /* 2 lignes : titre / photographe */
    .project-sep { display: none; }
    .project-photographer { display: block; }
}

/* Mobile portrait (≤768px) — espacements encore réduits */
@media (max-width: 768px) {
    body:not(.logged-in) .projects-grid {
        gap: 3vw;
        row-gap: 20vw;
        padding: 4vw 4vw 12vw;
        /* 2 cols, 1 gap (3vw), padding 4vw×2 = 8vw → col = (100vw - 11vw) / 2 = 44.5vw */
        grid-auto-rows: min(calc(44.5vw * 1.655), 380px);
    }
}

/* Mobile paysage — 4 colonnes compactes */
@media (orientation: landscape) and (max-height: 500px) {
    body:not(.logged-in) .projects-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2vw;
        row-gap: 9vw; /* 3vw était trop petit pour les captions sur 2 lignes */
        padding: 2vw 4vw 8vw;
        /* 4 cols, 3 gaps (6vw), padding 4vw×2 = 8vw → col = (100vw - 14vw) / 4 = 21.5vw */
        grid-auto-rows: min(calc(21.5vw * 1.655), 240px);
    }

    body:not(.logged-in) .project-card.project-video-landscape {
        grid-column: span 4;
    }
}

/* ==========================================================================
   ANIMATIONS ET TRANSITIONS
   ========================================================================== */

/* Animation d'apparition au scroll - DISABLED for debugging */
/* .project-card {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
} */

/* Délai progressif pour chaque carte - DISABLED */
/* .project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; } */

/* @keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
} */

/* ==========================================================================
   ÉTATS SPÉCIAUX
   ========================================================================== */

/* État de chargement */
.project-card.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   UTILITAIRES
   ========================================================================== */

/* Classe pour forcer un saut de ligne */
.project-card.force-new-row {
    grid-column: 1 / -1; /* Occupe toute la largeur */
    margin-top: var(--spacing-md, 30px);
}
