/* ==========================================================================
   1. RESET E REGOLE GENERALI
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Century Gothic", "Century", AppleGothic, sans-serif;
    color: #333;
    line-height: 1.6;
    background-color: #fcfcfc;
    scroll-behavior: smooth;
}

/* ==========================================================================
   2. NAVBAR & HEADER (DESKTOP)
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: space-between; /* Spinge il logo a sinistra e il menu a destra */
    align-items: center;
    padding: 20px 8%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo {
    font-size: 24px;
    letter-spacing: 2px;
}

.logo img {
    height: 40px;
    width: auto;
    display: block;
}

nav {
    display: flex;
    justify-content: flex-end;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: 400;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #1795a8;
}

/* --- HAMBURGER MENU (DI BASE NASCOSTO SU PC) --- */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 16px;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-menu span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #333;
    border-radius: 3px;
    transition: all 0.3s ease;
}


/* ==========================================================================
   3. HERO SECTION (CON VIDEO DI SFONDO)
   ========================================================================== */
.hero {
    position: relative;
    height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 0 20px;
    overflow: hidden;
}

/* L'immagine si comporta come un background-cover perfetto */
#hero-img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover; /* Ritaglia l'immagine proporzionalmente senza schiacciarla */
    z-index: 1;
}

/* Stile per il logo all'interno della Hero */
.hero-logo {
    max-width: 350px;  /* Cambia questo valore (es. 300px o 400px) per ingrandire/rimpicciolire il logo */
    width: 100%;       /* Permette al logo di rimpicciolirsi automaticamente sui telefoni */
    height: auto;      /* Mantiene le proporzioni corrette */
    margin-bottom: 10px; /* Regola lo spazio tra il logo e il testo sotto */
    display: inline-block;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background: rgba(0, 0, 0, 0.45); */
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
}

.hero-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 1px;
}

.hero-content p {
    font-size: 20px;
    margin-bottom: 30px;
    font-weight: 300;
}

.btn {
    display: inline-block;
    padding: 12px 35px;
    background-color: #1795a8;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    transition: background 0.3s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #0b4952;
}


/* ==========================================================================
   4. SEZIONI GENERALI & SERVIZI (GRIGLIA 3 COLONNE)
   ========================================================================== */
section {
    padding: 100px 8% 80px 8%;
}

section h2 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 50px;
    position: relative;
    letter-spacing: 1px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px;
    max-width: 1300px;
    margin: 0 auto;
}

.service-card {
    background: #fff;
    padding: 40px 30px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    border-top: 3px solid transparent;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    border-top: 3px solid #1795a8;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.service-card h3 {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    color: #111;
}

.service-card p {
    line-height: 1.7;
    font-size: 15px;
    color: #555;
}


/* ==========================================================================
   5. PORTFOLIO & POPUP GALLERIA
   ========================================================================== */
.portfolio-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
    position: relative;
}

.portfolio-categories[style*="display: none"] {
    display: grid !important;
}

.category-card {
    position: relative;
    height: 400px;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.category-card img, 
.category-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.category-card:hover video,
.category-card:hover img {
    transform: scale(1.08);
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: background 0.3s;
}

.category-overlay h3 {
    font-size: 24px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.category-card:hover .category-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* --- DETTAGLIO POPUP DELLA GALLERIA --- */
.gallery-popup {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

.popup-content {
    background-color: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    height: 80%;
    overflow-y: auto;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn-back-popup {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: 1px solid #333;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    z-index: 10;
}

.btn-back-popup:hover {
    background-color: #333;
    color: #fff;
}

.gallery-popup h3 {
    text-align: center;
    font-size: 28px;
    margin-top: 50px;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.grid-item {
    height: 180px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.grid-item img,
.grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.grid-item:hover img,
.grid-item:hover video {
    transform: scale(1.05);
}

.grid-item video {
    pointer-events: none;
}


/* ==========================================================================
   6. CHI SIAMO (CASELLE ALLARGATE E SENZA FOTO)
   ========================================================================== */
.about-section {
    padding: 80px 8%;
    background-color: #ffffff;
    text-align: center;
}

.about-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 50px;
    font-weight: 300;
}

.team-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    max-width: 1300px;
    margin: 0 auto;
}

.team-card {
    background-color: #fcfcfc;
    border: 1px solid #eee;
    padding: 40px 45px;
    border-radius: 4px;
    flex: 1;
    min-width: 320px;
    max-width: 580px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    transition: transform 0.3s ease;
}

.team-card:hover {
    transform: translateY(-5px);
}

.team-card h3 {
    font-size: 22px;
    margin-bottom: 5px;
    color: #111;
}

.team-role {
    font-size: 14px;
    color: #8e867e;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    font-weight: 600;
}

.team-description {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
}

.btn-linkedin {
    display: inline-block;
    padding: 10px 25px;
    background-color: #0077B5;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-linkedin:hover {
    background-color: #04669b;
}


/* ==========================================================================
   7. CONTATTI, CANALI SOCIAL & FORM
   ========================================================================== */
.contact {
    background-color: #f4f4f4;
    text-align: center;
}

.contact p {
    margin-bottom: 30px;
}

#contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#contact-form input, #contact-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: inherit;
}

.social-contact-channels {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 25px;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 15px;
    transition: transform 0.3s, background-color 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.social-btn:hover {
    transform: translateY(-3px);
}

.whatsapp-btn { background-color: #25D366; }
.whatsapp-btn:hover { background-color: #20ba5a; }

.instagram-btn { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.instagram-btn:hover { opacity: 0.9; }

.linkedin-btn { background-color: #0077B5; }
.linkedin-btn:hover { background-color: #04669b; }

.separator-text {
    text-align: center;
    position: relative;
    margin: 30px auto;
    max-width: 600px;
}

.separator-text::before {
    content: "";
    position: absolute;
    top: 50%; left: 0; width: 100%; height: 1px;
    background-color: #ddd;
    z-index: 1;
}

.separator-text span {
    background-color: #f4f4f4;
    padding: 0 15px;
    position: relative;
    z-index: 2;
    color: #777;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* ==========================================================================
   8. FOOTER & LIGHTBOX INGRANDIMENTO
   ========================================================================== */
footer {
    background-color: #222;
    color: #fff;
    text-align: center;
    padding: 30px;
    font-size: 14px;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 3000;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}

.close-lightbox {
    position: absolute;
    top: 20px; right: 35px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
}

video.lightbox-content {
    max-width: 85%;
    max-height: 85%;
    outline: none;
    background: #000;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   9. RESPONSIVE DESIGN (MEDIA QUERIES INTEGRATE E CORRETTE)
   ========================================================================== */

/* --- TABLET (Fino a 1024px di larghezza) --- */
@media (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* --- MOBILE & HAMBURGER TENDINA (Fino a 768px di larghezza) --- */
@media (max-width: 768px) {
    header {
        padding: 15px 5%; /* Spazio stretto per allineare logo e hamburger ai bordi */
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Libera lo spazio occupato dal nav, consentendo il flexbox pulito */
    nav {
        display: contents; 
    }

    /* Mostra l'hamburger rimpicciolito e bloccato a destra */
    .hamburger-menu {
        display: flex; 
        margin-left: auto; 
        width: 24px;       
        height: 16px;      
    }

    /* Animazione Hamburger (Diventa una X al click) */
    .hamburger-menu.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .hamburger-menu.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger-menu.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Tendina semitrasparente e sfocata (Stile Apple) */
    nav ul {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%; 
        width: 100%;  
        height: 100vh;
        background-color: rgba(255, 255, 255, 0.85); 
        backdrop-filter: blur(10px); 
        -webkit-backdrop-filter: blur(10px);
        padding-top: 120px; 
        transition: right 0.4s cubic-bezier(0.1, 0.1, 0.1, 1);
        list-style: none;
    }

    nav ul li {
        margin: 15px 0 !important;
        text-align: center;
        margin-left: 0; /* Resetta il margine desktop */
    }

    nav ul li a {
        font-size: 24px;
        font-weight: 400;
        color: #111;
        display: block;
        padding: 10px 0;
    }

    nav ul li a:hover {
        color: #1795a8;
    }

    /* Classe JavaScript per far comparire la tendina */
    nav ul.active {
        right: 0;
    }

    .hero-content h1 {
        font-size: 32px;
    }
}

/* --- SMARTPHONE STRETTI (Fino a 600px di larghezza) --- */
@media (max-width: 600px) {
    .services-grid {
        grid-template-columns: 1fr; /* 1 sola card per riga su schermi piccoli */
        gap: 20px;
    }
    
    .service-card {
        padding: 30px 20px;
    }
}