/**
 * Additional responsive fixes and performance optimizations for kevinzuccaro.it
 */

/* Performance optimizations */
* {
    box-sizing: border-box;
}

/* Critical rendering path optimization */
.preload-hidden {
    opacity: 0;
    visibility: hidden;
}

/* Progressive image loading */
img {
    max-width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Better table handling on small screens */
table {
    width: 100%;
    overflow-x: auto;
    display: block;
}

/* Fix form elements on small screens */
input, select, textarea, button {
    max-width: 100%;
    touch-action: manipulation; /* Prevents 300ms delay on mobile */
}

/* Fix embedded content */
iframe, embed, object, video {
    max-width: 100%;
}

/* Improve touch targets for mobile */
button, .btn, a[role="button"] {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 24px;
}

/* Fix portfolio items */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Fix service detail items */
@media screen and (max-width: 576px) {
    .service-detailed-item {
        margin-bottom: 30px;
        flex-direction: column;
        text-align: center;
    }
    
    .service-detailed-icon {
        margin-bottom: 20px;
        margin-right: 0;
        padding: 15px;
    }
    
    .benefit-item {
        flex-direction: column;
        text-align: center;
    }
    
    .benefit-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
    }
}

/* Fix tab content on small screens */
@media screen and (max-width: 768px) {
    .tab-header {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Fix service grid on small screens */
@media screen and (max-width: 768px) {
    .service-grid {
        grid-template-columns: 1fr;
    }
    
    .service-item-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .service-icon-large {
        margin-bottom: 15px;
    }
    
    .service-image-small {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .service-actions {
        flex-direction: column;
    }
    
    .service-actions .btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Fix call-to-action section */
@media screen and (max-width: 768px) {
    .cta .container {
        flex-direction: column;
        text-align: center;
    }
    
    .cta-content {
        margin-bottom: 20px;
    }
    
    .cta-buttons {
        justify-content: center;
    }
}

/* Additional fixes for servizi.html */
@media screen and (max-width: 992px) {
    .service-item {
        margin-left: auto;
        margin-right: auto;
        max-width: 700px;
    }
}

@media screen and (max-width: 768px) {
    .faq-question {
        padding: 15px 40px 15px 15px;
        font-size: 0.95rem;
    }
    
    .faq-question::after {
        right: 15px;
        top: 15px;
    }
    
    .faq-answer {
        font-size: 0.9rem;
    }
    
    .faq-item.active .faq-answer {
        padding: 0 15px 15px;
    }
    
    .services-intro h2 {
        font-size: 1.8rem;
    }
    
    .services-intro p {
        font-size: 0.95rem;
    }
}

/* Fix for service feature wrap on small screens */
@media screen and (max-width: 480px) {
    .service-features {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .service-feature {
        width: 100%;
        justify-content: center;
    }
}

/* Why Choose section responsive improvements */
@media screen and (max-width: 576px) {
    .why-choose-item {
        padding: 20px 15px;
    }
    
    .why-choose-icon {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .why-choose-item h3 {
        font-size: 1.2rem;
    }
    
    .why-choose-item p {
        font-size: 0.9rem;
    }
}

/* CTA section adjustments for better mobile display */
@media screen and (max-width: 576px) {
    .cta-content h2 {
        font-size: 1.8rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
    
    .cta {
        padding: 50px 0;
    }
}
