/* Stili di base */
body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    background-color: #f8f8f8;
    box-sizing: border-box; /* Aggiunto per un migliore controllo del layout */
}

*, *::before, *::after {
    box-sizing: border-box; /* Assicura che padding e border siano inclusi nella larghezza/altezza */
}


h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    color: #858834; /* Blu scuro simile al logo */
    margin-bottom: 15px;
}

h1 {
    font-size: 2.8em;
    text-align: center;
    color: #fff; /* Bianco per l'hero section */
}

h2 {
    font-size: 2.2em;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 10px;
    text-align: center;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #5c662e; /* Colore accento */
    margin: 10px auto 0;
}

.text-center {
    text-align: center;
}

a {
    color: #858834;
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-padding {
    padding: 80px 0;
}

.bg-light {
    background-color: #f0f0f0;
}

/* --- Header --- */
header {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.4s ease-in-out, box-shadow 0.4s ease-in-out, padding 0.4s ease-in-out;
}

header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 10px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Permette agli elementi di andare a capo se necessario */
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-link {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: translateY(-5px) scale(1.02);
}

#main-logo {
    height: 100px;
    width: auto;
    display: block;
    transition: height 0.4s ease-in-out;
}

header.scrolled #main-logo {
    height: 60px;
}

.site-title-slogan h1 {
    font-family: 'Playfair Display', serif;
    color: #858834;
    font-size: 2.2em;
    margin: 0;
    line-height: 1.2;
    text-align: left;
    transition: font-size 0.4s ease-in-out, color 0.4s ease-in-out;
}

header.scrolled .site-title-slogan h1 {
    font-size: 1.8em;
}

.site-title-slogan p {
    font-family: 'Open Sans', sans-serif;
    color: #666;
    font-size: 1em;
    margin: 5px 0 0 0;
    text-align: left;
    transition: font-size 0.4s ease-in-out, color 0.4s ease-in-out;
}

header.scrolled .site-title-slogan p {
    font-size: 0.8em;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    /* transition per l'apertura/chiusura del menu mobile */
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    color: #858834;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.3s ease;
    display: block;
    padding: 5px 0;
}

nav ul li a:hover {
    color: #5c662e;
    text-decoration: none;
    transform: translateY(-5px);
}

.phone-contact-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.phone-text {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    color: #858834;
    font-size: 1.1em;
    white-space: nowrap;
    transition: color 0.3s ease;
    animation: pulseText 2s infinite alternate;
    transform-origin: left center;
}

.phone-contact-wrapper:hover .phone-text {
    color: #5c662e;
    animation-play-state: paused;
    transform: scale(1);
}

.phone-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.phone-icon-link:hover {
    transform: translateY(-5px) scale(1.1);
}

.phone-icon {
    height: 50px;
    width: auto;
    transition: height 0.4s ease-in-out;
}

header.scrolled .phone-icon {
    height: 40px;
}

header.scrolled .phone-contact-wrapper {
    gap: 8px;
}

header.scrolled .phone-text {
    font-size: 0.9em;
    color: #666;
}

/* --- Hamburger Menu (Visibile solo su schermi piccoli) --- */
.hamburger-menu {
    display: none; /* Nascosto di default */
    background: none;
    border: none;
    font-size: 2em;
    color: #858834;
    cursor: pointer;
    padding: 10px;
    z-index: 1001; /* Assicurati che sia sopra altri elementi */
    transition: color 0.3s ease;
}

.hamburger-menu:hover {
    color: #5c662e;
}

/* Stili per la sezione hero */
#hero {
    position: relative;
    height: 80vh;
    overflow: hidden;
}

#hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

.hero-content {
    height: 100%;
    position: relative;
    padding: 0;
    box-sizing: border-box;
    max-width: none;
    margin: 0;
    width: 100%;
    display: flex; /* Aggiunto flex per centrare il text-box su mobile */
    align-items: center; /* Centra verticalmente */
    justify-content: center; /* Centra orizzontalmente */
}

.hero-text-box {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    text-align: left;
    color: #fff;

    /* Questi saranno sovrascritti dalle media queries per il responsive */
    width: 500px; /* Larghezza di base */
    padding: 40px;

    max-width: calc(100vw - 120px); /* Regola per schermi più piccoli */
    box-sizing: border-box;

    position: relative; /* Rimosso posizionamento assoluto generale, gestito da flexbox e poi riapplicato per desktop */
    top: auto;
    transform: none; /* Reset transform per flexbox */

    /* Stile per desktop (schermi più grandi di 992px) */
    @media (min-width: 993px) {
        position: absolute;
        top: 50%;
        left: 100px; /* Riposizionato a sinistra per desktop */
        transform: translateY(-50%);
        text-align: left;
    }
}


.hero-text-box h1 {
    font-size: 3.5em;
    margin-bottom: 25px;
    text-align: left;
    font-weight: 700;
}

.hero-text-box p {
    font-size: 1.3em;
    margin-bottom: 40px;
    line-height: 1.7;
}

/* Stili per il bottone generale */
.btn {
    display: inline-block;
    background-color: #5c662e;
    color: #fff;
    padding: 15px 35px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.hero-text-box .btn:hover {
    background-color: #365332;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 50px;
    overflow: visible;
}

.service-item {
    background-color: #fff;
    padding: 40px;
    border-radius: 15px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out, border-color 0.3s ease-out;
    position: relative;
    cursor: pointer;
    overflow: visible;
}

.service-item:hover {
    transform: translateY(-25px) scale(1.15) !important;
    box-shadow: 0 40px 80px rgba(0,0,0,0.4) !important;
    border-color: #5c662e !important;
    z-index: 10 !important;
}

.service-item h3 {
    color: #858834;
    font-size: 1.6em;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.service-item h3::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #5c662e;
    margin: 10px auto 0;
    border-radius: 2px;
}

.service-item p {
    font-size: 1.05em;
    color: #555;
    line-height: 1.7;
}

/* Icona "Tocca per scoprire" per i service-item */
.service-item::after {
    content: '';
    display: block;
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 35px;
    height: 35px;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/e4/Finger_Touch_Icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

.service-item:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

.service-item:hover {
    z-index: 11 !important;
}

/* Galleria Carosello */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-track img {
    min-width: 100%;
    height: 600px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(74, 106, 138, 0.75);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 2em;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel-button:hover {
    background-color: #5c662e;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.carousel-button.prev {
    left: 15px;
}

.carousel-button.next {
    right: 15px;
}

/* Sezione Contatti - Icone Social/Contatto */
.contact-icons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 50px;
    flex-wrap: wrap; /* Permette il wrap delle icone su schermi piccoli */
}

.contact-icon-link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90px;
    height: 90px;
    background-color: #858834;
    border-radius: 50%;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-decoration: none;
}

.contact-icon-link:hover {
    background-color: #5c662e;
    transform: translateY(-10px) scale(1.12);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.contact-icon-link img {
    width: 50px;
    height: 50px;
    filter: brightness(0) invert(1);
}

/* Footer */
footer {
    background-color: #365332;
    color: #fff;
    padding: 30px 0;
    font-size: 1em;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-links a {
    color: #e0e0e0;
    margin: 0 15px;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: #5c662e;
    text-decoration: none;
    transform: translateY(-3px);
}

/* Regole per la Mappa */
.map-container {
    position: relative;
    padding-bottom: 56.25%; /* Rapporto 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    margin-top: 40px;
}

.map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Animazioni */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.fade-in-up.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.slide-in-right.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-down {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.fade-in-down.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transition: opacity 1.5s ease-out;
}

.fade-in.animate-in {
    opacity: 1;
}

/* Reading Progress Bar */
.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: transparent;
    z-index: 1001;
    pointer-events: none;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: #5c662e;
    transition: width 0.1s linear;
}

/* Stili per la Modale Dettaglio Servizi */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1002;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.modal-overlay[style*="display: flex"] {
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    padding: 50px;
    border-radius: 20px;
    max-width: 900px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: fadeInScale 0.4s ease-out forwards;
    overflow-y: auto;
    max-height: 90vh;
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    z-index: 0;
    pointer-events: none;
}


.modal-content h2 {
    color: #365332;
    font-size: 3em;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.modal-content h2::after {
    content: '';
    display: block;
    width: 120px;
    height: 5px;
    background-color: #5c662e;
    margin: 15px auto 0;
    border-radius: 3px;
    position: relative;
    z-index: 1;
}

.modal-content p {
    font-size: 1.15em;
    line-height: 1.8;
    color: #444;
    margin-top: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    padding: 0 20px;
}


.close-button {
    position: absolute;
    top: 25px;
    right: 30px;
    color: #555;
    font-size: 45px;
    font-weight: normal;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.2s ease, background-color 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.07);
    z-index: 2;
}

.close-button:hover,
.close-button:focus {
    color: #222;
    transform: rotate(90deg) scale(1.1);
    background-color: rgba(0, 0, 0, 0.15);
}

/* Animazione per l'apertura della modale */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(40px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.btn.initial-hero-state {
    opacity: 0;
    transform: translateY(20px);
    transition: none;
}

.btn.animate-hero-entry {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
}

/* --- Media Queries per la Responsività --- */

/* Nasconde il menu di navigazione e mostra l'hamburger su schermi più piccoli */
@media (max-width: 992px) { /* breakpoint leggermente più alto per menu hamburger */
    nav {
        order: 3; /* Sposta la nav sotto il logo e il telefono */
        width: 100%;
        margin-top: 15px;
        position: absolute; /* Per farlo apparire come un overlay */
        top: 100%; /* Sotto l'header */
        left: 0;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        transform: translateY(-10px); /* Inizia leggermente sollevato */
        opacity: 0;
        pointer-events: none; /* Non intercettare eventi quando nascosto */
        transition: transform 0.3s ease-out, opacity 0.3s ease-out;
        max-height: 0; /* Nascondi l'altezza */
        overflow: hidden; /* Nascondi il contenuto in eccesso */
    }

    nav.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
        max-height: 500px; /* Altezza sufficiente per il menu */
    }

    nav ul {
        flex-direction: column;
        width: 100%;
        padding: 20px 0;
        align-items: center;
    }

    nav ul li {
        margin: 10px 0;
        width: 100%;
        text-align: center;
    }

    nav ul li a {
        padding: 10px 0;
        width: 100%;
    }

    .hamburger-menu {
        display: block; /* Mostra l'hamburger */
        margin-left: auto; /* Spostalo a destra se necessario */
        order: 2;
    }

    .header-content {
        justify-content: space-between; /* Mantieni logo e hamburger/telefono separati */
        align-items: center;
        flex-wrap: nowrap; /* Non far andare a capo l'header-content stesso */
    }

    .phone-contact-wrapper {
        display: none; /* Nascondi il contatto telefonico normale */
    }

    .hero-text-box {
        text-align: center; /* Centra il testo nella hero box su schermi più piccoli */
        left: auto; /* Annulla il posizionamento a sinistra */
        transform: none; /* Annulla la trasformazione Y */
    }

    .hero-text-box h1 {
        text-align: center; /* Centra il titolo nella hero box */
    }
}

@media (max-width: 1024px) {
    .hero-text-box {
        /* left: 50px; Rimosso per centrarlo con flexbox */
        width: 400px;
        padding: 30px;
    }
    .hero-text-box h1 {
        font-size: 3em;
    }
    .hero-text-box p {
        font-size: 1.1em;
    }
    .carousel-track img {
        height: 500px;
    }
    .services-grid {
        gap: 30px;
    }
    .service-item {
        padding: 35px;
    }
}

/* Tablet e Mobile Landscape */
@media (max-width: 768px) {
    .section-padding {
        padding: 60px 0;
    }
    h1 {
        font-size: 2em;
    }
    h2 {
        font-size: 1.8em;
    }

    /* Header e logo su mobile */
    .header-content {
        flex-direction: row; /* Mantienilo orizzontale */
        justify-content: space-between;
        align-items: center;
        padding: 0 15px; /* Riduci padding per spazio */
    }

    .logo-wrapper {
        flex-direction: row; /* Mantieni logo e titolo orizzontali */
        gap: 10px;
        margin-bottom: 0;
        align-items: center;
    }

    #main-logo {
        height: 70px; /* Dimensione del logo su mobile */
    }
    header.scrolled #main-logo {
        height: 50px;
    }

    .site-title-slogan h1 {
        font-size: 1.8em;
    }
    header.scrolled .site-title-slogan h1 {
        font-size: 1.5em;
    }

    .site-title-slogan p {
        font-size: 0.9em;
        display: none; /* Nascondi lo slogan su schermi molto piccoli */
    }

    .hero-text-box {
        max-width: 90%;
        margin: 0 auto;
        padding: 25px;
        text-align: center; /* Centra il testo nella hero box */
    }

    .hero-text-box h1 {
        text-align: center;
        font-size: 2.2em;
    }

    .hero-text-box p {
        font-size: 1em;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr); /* Due colonne per i servizi */
        gap: 25px;
    }
    .carousel-track img {
        height: 350px;
    }
    .carousel-button {
        font-size: 1.5em;
        padding: 8px 12px;
    }
    .contact-icons-container {
        gap: 25px; /* Riduci il gap per mantenere in orizzontale */
    }
    .contact-icon-link {
        width: 70px;
        height: 70px;
    }
    .contact-icon-link img {
        width: 40px;
        height: 40px;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .section-padding {
        padding: 40px 0;
    }
    h1 {
        font-size: 1.6em;
    }
    .btn {
        padding: 12px 25px;
        font-size: 0.9em;
    }
    .services-grid {
        grid-template-columns: 1fr; /* Una colonna per i servizi su schermi molto piccoli */
        gap: 20px;
    }
    .carousel-track img {
        height: 250px;
    }
    .carousel-button {
        font-size: 1.2em;
        padding: 6px 10px;
    }
    .contact-icons-container {
        flex-direction: row; /* Mantieni in riga, andranno a capo con flex-wrap */
        gap: 20px;
        padding: 0 10px; /* piccolo padding orizzontale */
    }
    .contact-icon-link {
        width: 60px;
        height: 60px;
    }
    .contact-icon-link img {
        width: 35px;
        height: 35px;
    }

    /* Nasconde la scritta "Chiamaci ora!" su schermi molto piccoli */
    .phone-text {
        display: none;
    }

    /* Dimensione logo e titolo su schermi molto piccoli */
    #main-logo {
        height: 60px;
    }
    .site-title-slogan h1 {
        font-size: 1.4em;
    }
    header.scrolled #main-logo {
        height: 45px;
    }
    header.scrolled .site-title-slogan h1 {
        font-size: 1.2em;
    }
}

/* Media Queries per la Modale (aggiornate per il nuovo layout) */
@media (max-width: 768px) {
    .modal-content {
        padding: 35px;
        max-height: 95vh;
        width: 95%;
    }
    .modal-content h2 {
        font-size: 2.5em;
        margin-bottom: 20px;
    }
    .modal-content h2::after {
        width: 90px;
        height: 4px;
    }
    .modal-content p {
        font-size: 1.05em;
        text-align: center;
    }
    .close-button {
        font-size: 35px;
        top: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 25px;
        border-radius: 15px;
    }
    .modal-content h2 {
        font-size: 2em;
        margin-bottom: 15px;
    }
    .modal-content h2::after {
        width: 70px;
        height: 3px;
    }
    .modal-content p {
        font-size: 0.95em;
    }
    .close-button {
        font-size: 30px;
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
}

/* Animazione Keyframes per il testo "Chiamaci ora!" */
@keyframes pulseText {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}