/* =======================================
   1. VARIABILI E RESET
   ======================================= */
:root {
    /* Colori Brand */
    --colore-sfondo-primario: #EEF0F2;
    --colore-testo-primario: #0a2354;
    --colore-navbar-footer: #0A2354;
    --colore-card-sfondo: #E1E8EB;
    
    /* Tipografia */
    --font-titolo: 'Montserrat', sans-serif;
    --font-nav: 'Exo', sans-serif;
    
    /* Layout */
    --navbar-height: 80px;

    /* Animazioni */
    --transition-speed: 0.6s;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--navbar-height) + 20px);
    overflow-x: hidden; 
}

body {
    font-family: var(--font-titolo);
    background-color: var(--colore-sfondo-primario);
    color: var(--colore-testo-primario);
    line-height: 1.6;
    overflow-x: hidden;
}

img, svg {
    max-width: 100%;
    height: auto;
}

/* =======================================
   2. PRELOADER
   ======================================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--colore-navbar-footer);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.loader-content img {
    width: 150px;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.preloader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* =======================================
   3. TIPOGRAFIA E LAYOUT BASE
   ======================================= */
h1 {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

h2 {
    font-size: clamp(22px, 4vw, 30px);
    margin-bottom: 15px;
}

p {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 15px;
    max-width: 75ch;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 90%;
}

/* =======================================
   4. SEZIONI "A BLOCCHI" (Card Style)
   ======================================= */
#chi-siamo, 
#servizi, 
#partner, 
#contatti {
    background-color: var(--colore-card-sfondo);
    border-radius: 30px;
    padding: 60px 50px;
    margin: 40px auto;
    max-width: 1400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(10, 35, 84, 0.05);
    overflow: hidden;
}

/* =======================================
   5. ANIMAZIONI (Modificate per dinamismo)
   ======================================= */
.reveal {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
    transition: all var(--transition-speed) cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* =======================================
   6. NAVBAR & UI ELEMENTS
   ======================================= */
#navbar {
    background-color: var(--colore-navbar-footer);
    height: var(--navbar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: transform 0.4s ease-in-out;
}

#navbar.navbar-hidden {
    transform: translateY(-100%);
}

.nav-logo a {
    display: flex;
    align-items: center;
}

.nav-logo img {
    width: 300px;
    display: block;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: white;
    font-family: var(--font-nav);
    font-size: 18px;
    font-weight: 500;
    position: relative;
    transition: color 0.3s;
    padding: 5px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    display: block;
    background: white;
    transition: width 0.3s ease;
    bottom: 0;
    left: 0;
}

.nav-links a:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 1001;
    user-select: none;
}

/* --- Back to Top Button --- */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--colore-navbar-footer);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    z-index: 999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
    cursor: pointer;
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#backToTop:hover {
    background-color: #1a3c7a;
    transform: translateY(-5px);
}

/* =======================================
   7. HERO SECTION
   ======================================= */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    background-image: url('img/hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 50px;
    margin-top: 0;
    padding-top: 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    z-index: 2;
    text-align: center;
}

.scroll-down {
    display: block;
    width: 60px;
    height: 60px;
    border: 2px solid white;
    border-radius: 50%;
    position: relative;
    transition: background-color 0.3s;
    cursor: pointer;
}

.scroll-down:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border-right: 3px solid white;
    border-bottom: 3px solid white;
    transform: translate(-50%, -65%) rotate(45deg);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translate(-50%, -65%) rotate(45deg); }
    40% { transform: translate(-50%, -50%) rotate(45deg); }
    60% { transform: translate(-50%, -55%) rotate(45deg); }
}

/* =======================================
   8. DETTAGLI SEZIONI
   ======================================= */

/* --- Chi Siamo --- */
#chi-siamo .content-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 60px;
    align-items: flex-start;
}

#chi-siamo .text-content {
    width: 100%;
}

/* --- Servizi & Swiper --- */
.swiper-slider {
    width: 100%;
    padding: 40px 0 60px 0;
}

.swiper-slide {
    text-align: center;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.swiper-slide:hover {
    transform: translateY(-5px);
}

.swiper-slide img {
    width: 100%;
    height: 450px; 
    object-fit: cover;
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 14px;
    font-weight: bold;
    background: rgba(10, 35, 84, 0.9);
    color: white;
    padding: 15px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Contatti (NUOVI EFFETTI HOVER) --- */
.contatti-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-top: 30px;
}

.contact-details {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
    gap: 25px; /* Spazio aumentato per l'effetto hover */
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 20px; /* Padding più arioso */
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(10, 35, 84, 0.05);
    
    /* Proprietà per l'animazione */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Rimbalzo elastico */
    border-left: 5px solid transparent; /* Preparazione per la linea colorata */
    cursor: pointer;
}

/* Effetto Hover sul Box Contatto */
.contact-item:hover {
    transform: translateY(-8px); /* Sale verso l'alto */
    box-shadow: 0 15px 35px rgba(10, 35, 84, 0.15); /* Ombra profonda */
    border-left: 5px solid var(--colore-navbar-footer); /* Appare la linea blu */
}

.contact-item .icon svg {
    transition: transform 0.4s ease;
    fill: var(--colore-navbar-footer);
}

/* Animazione Icona su Hover */
.contact-item:hover .icon svg {
    transform: scale(1.2) rotate(-10deg); /* Zoom e rotazione */
}

.contact-item a {
    color: var(--colore-testo-primario);
    font-weight: 600;
    font-size: 18px;
    word-break: break-all;
    transition: color 0.3s ease;
}

/* Cambio colore testo su Hover */
.contact-item:hover a {
    color: #1a4db3; /* Diventa un blu più acceso */
}

.contatti-mappa {
    flex: 1 1 400px;
    height: 350px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.contatti-mappa iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* =======================================
   9. FOOTER
   ======================================= */
#footer {
    background-color: var(--colore-navbar-footer);
    padding: 40px 5%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    color: white;
    gap: 20px;
    margin-top: 60px;
}

#footer p {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    font-weight: 400;
    margin: 0;
}

#footer a {
    color: white;
    text-decoration: underline;
}

.footer-branding {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-main-logo {
    width: 150px;
}

.footer-separator {
    width: 1px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.4);
}

.ds-logo {
    width: 90px;
    filter: brightness(0) invert(1);
}

/* =======================================
   10. MEDIA QUERIES
   ======================================= */
@media (max-width: 992px) {
    /* --- CAMBIO SFONDO HERO PER MOBILE/TABLET --- */
    #hero {
        background-image: url('img/hero_mobile_tablet.png');
        background-position: center top; 
    }

    #chi-siamo .content-grid {
        gap: 30px;
    }
    
    .hamburger { display: block; }
    .nav-logo img { width: 180px; }

    .nav-links {
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--navbar-height));
        background-color: var(--colore-navbar-footer);
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 50px;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
    }

    .nav-links.active { transform: translateX(0); }
    .nav-links a { font-size: 22px; margin: 15px 0; display: block; width: 100%; text-align: center; }
    
    .contatti-wrapper { flex-direction: column; }
    .contatti-mappa { width: 100%; height: 300px; }
    #footer { flex-direction: column; text-align: center; }
    
    .footer-branding {
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    /* Mobile */
    #chi-siamo, 
    #servizi, 
    #partner, 
    #contatti {
        padding: 40px 25px;
        border-radius: 20px;
        width: 95%;
    }
    
    #chi-siamo .content-grid {
        display: block; 
    }

    .swiper-slide img {
        height: 300px;
    }

    #backToTop {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 32px; }
    .nav-logo img { width: 150px; }
    .scroll-down { width: 50px; height: 50px; }
}