/* Page d'accueil - Nouveau design avec fond crème */
.projects-section {
    padding: calc(var(--space-xl) + 100px) 0 var(--space-xl);
    position: relative;
    background-color: var(--bg-base);
}

/* Grille des projets - Version PC */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 28vw;
    gap: var(--space-sm);
}

.project-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Placement des projets desktop */
.project-card:nth-child(1) { grid-column: span 7; grid-row: span 1; }
.project-card:nth-child(2) { grid-column: span 5; grid-row: span 1; }
.project-card:nth-child(3) { grid-column: span 4; grid-row: span 1; }
.project-card:nth-child(4) { grid-column: span 4; grid-row: span 1; }
.project-card:nth-child(5) { grid-column: span 4; grid-row: span 1; }
.project-card.vertical-card:nth-child(6),
.project-card.vertical-card:nth-child(7),
.project-card.vertical-card:nth-child(8) { grid-column: span 3; grid-row: span 2; }

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-md);
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 70%);
    opacity: 0;
    transition: var(--transition);
    color: white;
}

.project-card:hover .project-overlay { opacity: 1; }
.project-card:hover .project-image { transform: scale(1.05); }

.project-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
    transform: translateY(20px);
    transition: transform 0.5s ease;
}

.project-year {
    font-size: 0.9rem;
    opacity: 0.8;
    transform: translateY(20px);
    transition: transform 0.5s ease 0.1s;
}

.project-card:hover .project-title,
.project-card:hover .project-year { transform: translateY(0); }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.projects-grid .project-card {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.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; }
.project-card:nth-child(7) { animation-delay: 0.7s; }
.project-card:nth-child(8) { animation-delay: 0.8s; }

/* RESPONSIVE DESIGN - Version ultra-optimisée avec cases maxi */
@media (max-width: 1024px) {
    .projects-section {
        padding: calc(var(--space-lg) + 80px) 0 var(--space-lg);
    }
    
    .projects-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(200px, auto);
        gap: 8px;
        padding: 0 4px;
    }
    
    /* Reset complet des placements grid pour mobile */
    .project-card,
    .project-card:nth-child(1),
    .project-card:nth-child(2),
    .project-card:nth-child(3),
    .project-card:nth-child(4),
    .project-card:nth-child(5),
    .project-card.vertical-card:nth-child(6),
    .project-card.vertical-card:nth-child(7),
    .project-card.vertical-card:nth-child(8) {
        grid-column: unset !important;
        grid-row: unset !important;
        height: auto;
        min-height: 320px;
        border-radius: 8px;
    }
    
    /* Titres toujours visibles sur mobile */
    .project-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
        padding: 14px;
    }
    
    .project-title,
    .project-year { 
        transform: translateY(0);
    }
    
    /* Désactiver effets hover sur mobile */
    .project-card:hover .project-image { 
        transform: none; 
    }
    
    .project-image { 
        height: 100%; 
    }
    
    /* TEXTE RÉDUIT DE 30% */
    .project-title { 
        font-size: 1.12rem; /* Réduction de 30% par rapport à 1.6rem */
        margin-bottom: 6px; 
        line-height: 1.2;
    }
    
    .project-year { 
        font-size: 0.7rem; /* Réduction de 30% par rapport à 1rem */
    }
}

/* Tablettes */
@media (max-width: 768px) {
    .projects-grid { 
        gap: 6px; 
        padding: 0 2px;
    }
    
    .project-card {
        min-height: 280px;
    }
    
    /* Ajustement supplémentaire pour tablettes */
    .project-title { 
        font-size: 1.05rem; 
    }
    
    .project-year { 
        font-size: 0.65rem; 
    }
}

/* Mobiles - Remplir toute la largeur */
@media (max-width: 480px) {
    .projects-grid { 
        grid-template-columns: 1fr; 
        gap: 10px; 
        padding: 0 2px;
    }
    
    .project-card {
        min-height: 380px;
    }
    
    /* Ajustement pour petits écrans */
    .project-overlay {
        padding: 12px;
    }
    
    .project-title { 
        font-size: 1rem; 
    }
    
    .project-year { 
        font-size: 0.6rem; 
    }
}

/* iPhone 13 Pro Max spécifique - Remplir toute la largeur */
@media only screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 0 4px;
    }
    
    .project-card {
        min-height: 340px;
    }
    
    .project-title { 
        font-size: 1.05rem; 
    }
    
    .project-year { 
        font-size: 0.65rem; 
    }
}

/* Grands mobiles en mode paysage */
@media only screen and (max-device-width: 930px) and (orientation: landscape) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 0 4px;
    }
    
    .project-card {
        min-height: 280px;
    }
    
    .project-title { 
        font-size: 0.95rem; 
    }
    
    .project-year { 
        font-size: 0.6rem; 
    }
}

/* Support des appareils Apple avec encoche */
@supports(padding: max(0px)) {
    .projects-section .container {
        padding-left: max(0.25rem, env(safe-area-inset-left));
        padding-right: max(0.25rem, env(safe-area-inset-right));
    }
}

/* Optimisation pour très petits écrans */
@media (max-width: 340px) {
    .project-card {
        min-height: 300px;
    }
    
    .project-title { 
        font-size: 0.9rem; 
    }
    
    .project-year { 
        font-size: 0.55rem; 
    }
}

/* Styles pour les placeholders de chargement */
.image-placeholder {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.project-image {
    opacity: 1;
    transition: opacity 0.3s ease;
}