
main {
    flex: 1; /* Permet que el main ocupi tot l'espai restant */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* =========================================
   DARRERS TREBALLS (GRID DE 3 BOTONS)
   ========================================= */
.darrers-treballs-main {
    max-width: 1400px;
    margin: 100px auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
}

.treballs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columnes idèntiques */
    gap: 30px; /* Espai entre els botons */
    width: 100%;
}

.treball-card {
    position: relative;
    height: 450px; /* Alçada dels botons, pots fer-los més alts o baixos */
    background-size: cover;
    background-position: center;
    text-decoration: none;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* La capa fosca semitransparent que va sobre la foto */
.treball-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.4); /* Fons negre al 40% d'opacitat */
    transition: background-color 0.4s ease;
    z-index: 1;
}

.treball-card h2 {
    color: #ffffff;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 2px;
    z-index: 2; /* El text queda per sobre de la capa fosca */
    transition: transform 0.4s ease;
    text-align: center;
}

/* --- ANIMACIONS HOVER (Al passar el ratolí) --- */
.treball-card:hover {
    transform: translateY(-5px); /* Puja una miqueta */
    box-shadow: 0 15px 30px rgba(0,0,0,0.15); /* Fa una ombra elegant */
}

.treball-card:hover .treball-overlay {
    background-color: rgba(0, 0, 0, 0.15); /* La imatge s'aclareix al passar el ratolí */
}

.treball-card:hover h2 {
    transform: scale(1.05); /* El text creix lleugerament */
}

/* --- RESPONSIVE (Mòbils i Tauletes) --- */
@media (max-width: 900px) {
    .treballs-grid {
        grid-template-columns: 1fr; /* Passa a ser 1 sola columna vertical al mòbil */
    }
    
    .treball-card {
        height: 250px; /* Al mòbil els botons són més baixos per no ocupar tanta pantalla */
    }
    .treball-card h2 {
        color: #ffffff;
        font-size: 20px;
    }
    .darrers-treballs-main {
        padding: 0 20px;
        margin: 40px auto;
    }
}