/* =========================================
   1. RESET E VARIABILI 
   ========================================= */
:root {
    --color-primary: #000000;
    --color-accent: #ff0000;
    --color-light: #ffffff;
    --color-gray: #f5f5f5;
    --color-dark-gray: #333333;
    --font-family: 'Poppins', 'Montserrat', sans-serif;
    --transition: all 0.3s ease;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html { 
    scroll-behavior: smooth; 
}

body { 
    font-family: var(--font-family); 
    color: var(--color-primary); 
    background: var(--color-light); 
    line-height: 1.6; 
    overflow-x: hidden; 
}

/* =========================================
   2. ANIMAZIONI 
   ========================================= */
.fade-in { 
    opacity: 0; 
    transform: translateY(20px); 
    transition: opacity 0.8s ease-out, transform 0.8s ease-out; 
}

.fade-in.visible { 
    opacity: 1; 
    transform: translateY(0); 
}

/* =========================================
   3. HEADER 
   ========================================= */
.header { 
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-dark-gray) 100%); 
    color: var(--color-light); 
    padding: 30px 20px; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: var(--shadow); 
}

.header-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logo-img, .profile-pic { 
    width: 110px; 
    height: 110px; 
    border-radius: 50%; 
    border: 3px solid var(--color-accent); 
    object-fit: cover; 
    transition: var(--transition); 
}

.header-title { 
    flex: 1; 
    text-align: center; 
}

.header-title h1 { 
    font-size: 2.5rem; 
    font-weight: 800; 
    letter-spacing: 2px; 
}

.header-title p { 
    font-size: 1rem; 
    color: var(--color-accent); 
}

/* =========================================
   4. PRESENTAZIONE 
   ========================================= */
.presentation { 
    background: linear-gradient(180deg, var(--color-light) 0%, var(--color-gray) 100%); 
    padding: 60px 20px; 
    text-align: center; 
}

.presentation h2 { 
    font-size: 2.5rem; 
    margin-bottom: 10px; 
}

.subtitle { 
    font-size: 1.2rem; 
    color: var(--color-accent); 
    font-weight: 500; 
}

/* =========================================
   5. SEZIONE VIDEO HERO (DIMENSIONI CONTROLLATE E SCURITE) 
   ========================================= */
.main-image { 
    position: relative; 
    width: 100%;
    /* Altezza fissa e discreta */
    height: 350px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    background: #000; /* Sfondo nero per le zone non coperte dal video */
    overflow: hidden;
}
.analisi-image { 
    position: relative; 
    width: 100%;
    /* Altezza fissa e discreta */
    height: 1300px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    background: #000; /* Sfondo nero per le zone non coperte dal video */
    overflow: hidden;
}

.responsive-video { 
    width: 100%; 
    height: 100%; 
    display: block;
    /* 'contain' per mostrare il video intero, 'center' per centrarlo */
    object-fit: contain; 
    object-position: center;
    filter: brightness(0.7); /* Scurisce il video per far leggere il testo */
}

.image-overlay { 
    position: absolute; 
    /* Centriamo la scritta esattamente nel mezzo del video */
    top: 50%;
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: rgba(0, 0, 0, 0.6); 
    color: white; 
    padding: 10px 25px; 
    border-radius: 50px; 
    font-size: 1.1rem; 
    font-weight: 600; 
    z-index: 5;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* =========================================
   6. FRASE MOTIVAZIONALE 
   ========================================= */
.motivational { 
    background: var(--color-primary); 
    color: var(--color-light); 
    padding: 60px 20px; 
    text-align: center; 
}

.motivational blockquote { 
    max-width: 900px; 
    margin: 0 auto; 
    font-size: 1.4rem; 
    font-style: italic; 
    border-left: 5px solid var(--color-accent); 
    padding-left: 30px; 
    text-align: left; 
}

/* =========================================
   7. SERVIZI (6 COLONNE E CORNICI UNIFORMI) 
   ========================================= */
.services { 
    max-width: 1400px; /* Larghezza massima aumentata per 6 colonne */
    margin: 80px auto; 
    padding: 0 20px; 
    text-align: center;
}

.services h2 { 
    font-size: 2.5rem; 
    margin-bottom: 50px; 
}

/* Griglia desktop: 6 colonne uguali */
.services-grid { 
    display: grid; 
    grid-template-columns: repeat(6, 1fr); 
    gap: 15px; 
}

/* Stile della Card */
.service-card { 
    background: #f9f9f9; 
    border-radius: 15px; 
    padding: 20px 15px; 
    transition: var(--transition); 
    display: flex;
    flex-direction: column; /* Allineamento verticale */
    justify-content: flex-start;
    height: 100%; /* Tutte le card hanno la stessa altezza */
    border: 1px solid transparent;
}

/* Effetto Hover sulla Card */
.service-card:hover { 
    transform: translateY(-10px); 
    box-shadow: 0 10px 25px rgba(255, 0, 0, 0.1); /* Ombra rossa leggera */
    border: 1px solid var(--color-accent); 
}

/* IL CONTENITORE DELL'IMMAGINE (La "cornice bianca") */
.service-img-container { 
    background-color: white; /* Sfondo bianco puro */
    padding: 10px; /* Spazio interno alla cornice */
    border-radius: 12px; /* Arrotondamento della cornice */
    margin-bottom: 20px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Leggera ombra */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 130px; /* Altezza fissa del contenitore immagine */
    overflow: hidden; 
}

/* L'IMMAGINE DENTRO LA CORNICE */
.service-img { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; /* L'immagine intera entra nella cornice senza tagli */
    border-radius: 4px; 
}

/* Testi della Card */
.service-card h3 { 
    font-size: 1rem; 
    font-weight: 700; 
    margin-bottom: 10px; 
    color: #000;
    min-height: 40px; /* Altezza minima per allineare titoli su 2 righe */
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-card p { 
    font-size: 0.85rem; 
    color: var(--color-dark-gray); 
    line-height: 1.4;
    margin-top: auto; /* Spinge la descrizione in fondo se c'è spazio */
}
.service-card {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   8. CONTATTI E MODAL 
   ========================================= */
.contact { 
    padding: 80px 20px; 
    text-align: center; 
    background: var(--color-gray); 
}

.btn-contact { 
    background: var(--color-primary); 
    color: white; 
    padding: 14px 40px; 
    border: none; 
    border-radius: 8px; 
    font-weight: 600; 
    cursor: pointer; 
    text-transform: uppercase; 
    transition: var(--transition); 
}

.btn-contact:hover { 
    background: var(--color-accent); 
    transform: translateY(-3px); 
}

/* Stili Modal */
.modal { 
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.7); 
    z-index: 1000; 
    align-items: center; 
    justify-content: center; 
    padding: 20px; 
}

.modal.show { 
    display: flex; 
}

.modal-content { 
    background: white; 
    padding: 35px; 
    border-radius: 15px; 
    width: 100%; 
    max-width: 500px; 
    position: relative; 
}

.close-modal { 
    position: absolute; 
    right: 20px; 
    top: 15px; 
    font-size: 28px; 
    cursor: pointer; 
}

.full-contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group { 
    text-align: left; 
}

.form-group label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: 600; 
    font-size: 0.9rem;
}

.form-group input, .form-group textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
    font-family: inherit;
}

.btn-submit { 
    width: 100%; 
    background: var(--color-primary); 
    color: white; 
    padding: 14px; 
    border: none; 
    border-radius: 6px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: var(--transition);
}

.btn-submit:hover { 
    background: var(--color-accent); 
}

.success-message {
    text-align: center;
    padding: 20px;
    color: green;
}

/* =========================================
   9. FOOTER E RESPONSIVE 
   ========================================= */
.footer { 
    background: var(--color-primary); 
    color: white; 
    text-align: center; 
    padding: 30px 20px; 
    border-top: 3px solid var(--color-accent); 
    font-size: 0.9rem;
}

/* Desktop Medio (sotto i 1100px): 3 colonne servizi */
@media (max-width: 1100px) { 
    .services-grid { grid-template-columns: repeat(3, 1fr); } 
}

/* Mobile (sotto i 768px): Hero più bassa */
@media (max-width: 768px) {
    .main-image {
        height: 200px; /* Hero discreta su mobile */
    }
    .image-overlay {
        font-size: 0.9rem;
        padding: 8px 20px;
    }
}

/* Mobile Piccolo (sotto i 650px): Scorrimento orizzontale servizi */
@media (max-width: 650px) {
    .header-title h1 { font-size: 1.5rem; }
    
    .services-grid { 
        display: flex; 
        overflow-x: auto; /* Scorrimento orizzontale */
        gap: 15px; 
        padding-bottom: 15px; 
        scroll-snap-type: x mandatory; /* Effetto calamita */
    }
    
    .service-card { 
        flex: 0 0 250px; /* Larghezza fissa card mobile */
        scroll-snap-align: center;
    }
}

.back-home {
    text-align: center;
    margin: 40px 0;
}

.back-button {
    display: inline-block;
    padding: 12px 25px;
    background: #000;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    transition: 0.3s;
}

.back-button:hover {
    background: #ff0000;
}