/* Immagini Responsive con Centratura Assoluta */
.responsive-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto; /* FIX: Questa è la magia che centra le immagini ovunque */
}

@media (max-width: 991.98px) {
    .project-section .row > div,
    .development-section .row > div,
    .realization-section .row > div {
        margin-bottom: 30px;
    }

    .project-section .row > div:last-child,
    .development-section .row > div:last-child,
    .realization-section .row > div:last-child {
        margin-bottom: 0;
    }
    
    .image-container {
        /* FIX: Rimosso il display: flex che andava in conflitto con d-inline-block sui tablet */
        margin: 0 auto;
        text-align: center;
        display: block; /* Assicura che il contenitore prenda la riga intera su mobile/tablet */
    }
    
    .section-content,
    .section-title,
    .text-muted.lead {
        text-align: center !important;
    }

    .group-list {
        text-align: left;
        display: inline-block;
    }

    .group-list-item {
        text-align: left;
    }
}

#carousel .carousel {
    margin: 0 auto;
    overflow: visible;
}

@media (max-width: 991.98px) {
    #carousel .carousel {
        width: 80%;
    }

    .carousel-control-prev {
        left: -15%;
        width: 15%;
        justify-content: flex-end;
    }

    .carousel-control-next {
        right: -15%;
        width: 15%;
        justify-content: flex-start;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 1.5rem;
        height: 1.5rem;
        filter: invert(1) grayscale(100);
    }
}

@media (min-width: 992px) {
    #carousel .carousel {
        max-width: 700px;
    }

    .carousel-control-prev {
        left: -80px;
        width: 60px;
        opacity: 0.5;
    }

    .carousel-control-next {
        right: -80px;
        width: 60px;
        opacity: 0.5;
    }

    .carousel-control-prev:hover,
    .carousel-control-next:hover {
        opacity: 1;
        transform: scale(1.1);
        transition: all 0.2s ease;
    }
}

@media (max-width: 767.98px) {
    .carousel-caption {
        bottom: 10px;
        left: 5%;
        right: 5%;
    }
    
    .carousel-caption h5 {
        color: #fff;
        text-shadow: 0 2px 4px rgba(0,0,0,0.8);
        font-size: 1rem;
        margin-bottom: 0;
    }
}

@media (min-width: 768px) {
    .carousel-caption {
        background: rgba(255, 255, 255, 0.85);
        color: #2c3e50;
        border-radius: 12px;
        padding: 15px 30px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        left: 10%;
        right: 10%;
        bottom: 30px;
    }

    .carousel-caption h5 {
        color: #2c3e50;
        font-weight: 600;
        margin: 0;
    }
}

@media (min-width: 992px) {
    .carousel-caption {
        left: 15%;
        right: 15%;
        bottom: 40px;
        transition: all 0.4s ease-in-out;
    }

    .carousel-caption h5 {
        transition: color 0.4s ease-in-out;
    }

    .carousel-item.active:hover .carousel-caption {
        background: rgba(255, 255, 255, 0);
        box-shadow: none;
    }

    .carousel-item.active:hover .carousel-caption h5 {
        color: #ffffff;
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    }
}