/* ==================== */
/* Servizi Section      */
/* ==================== */
.services {
    padding: 50px 20px;
    background-color: #ffffff;
}

.services .container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Card layout: altezza determinata SOLO dal testo */
.service-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "img content";
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.service-card:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}

.service-card:nth-child(odd) {
    grid-template-areas: "content img";
}

.service-card:nth-child(even) {
    grid-template-areas: "img content";
}

/* Wrapper: unico vero grid item lato immagine.
   Non ha contenuto "intrinseco" perché l'img dentro è assoluta:
   la sua altezza sarà quindi solo quella che la grid gli assegna
   in base al testo, mai il contrario. */
.img-wrapper {
    grid-area: img;
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.img-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.img-wrapper img.img-verticale {
    object-fit: contain;
    padding: 15px;
    box-sizing: border-box;
    background-color: #f4f4f4;
}

/* Contenuto: detta l'altezza della card */
.service-card .content {
    grid-area: content;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    min-width: 0;
}

.service-card h2 {
    font-size: 24px;
    color: #003366;
    margin-top: 0;
    margin-bottom: 10px;
}

.service-card p {
    font-size: 15px;
    color: #444;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

/* Pulsante */
.button-container {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.service-button {
    padding: 12px 24px;
    background-color: #003366;
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.3s ease;
}

.service-button:hover {
    background-color: #002244;
    color: #ffcc00;
}

/* Altezza minima per card con testo molto corto (es. "Prodotti Ricondizionati") */
.service-card {
    min-height: 280px;
}

/* Responsive Servizi */
@media (max-width: 768px) {
    .service-card {
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "img"
            "content" !important;
        min-height: 0;
    }

    .img-wrapper {
        height: 220px !important;
    }

    .service-card .content {
        padding: 20px;
    }

    .button-container {
        justify-content: center;
        margin-top: 15px;
    }

    .service-button {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .img-wrapper {
        height: 180px !important;
    }

    .service-card h2 {
        font-size: 18px;
    }

    .service-card p {
        font-size: 14px;
    }

    .service-button {
        font-size: 14px;
        padding: 10px;
    }
}