/* Variabili colori */
:root {
    --colore-primario: #D22630; /* Rosso */
    --colore-secondario: #003366; /* Blu */
    --colore-accento: #f5f5f5; /* Grigio chiaro */
    --colore-neutro-chiaro: #ffffff;
    --colore-neutro-scuro: #333333;
}

/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--colore-neutro-scuro);
    line-height: 1.6;
    background-color: var(--colore-neutro-chiaro);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    margin-bottom: 20px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1300px; /* Allargato per dare più respiro all'header */
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-title h2 {
    font-size: 36px;
    color: var(--colore-secondario);
    position: relative;
    display: inline-block;
}

.section-title h2:after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background: linear-gradient(to right, var(--colore-secondario), var(--colore-primario));
}

/* Animazioni */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.8s ease forwards;
}

/* Header */
.site-header {
    background-color: var(--colore-neutro-chiaro);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 40px; /* Spostato sotto il ticker banner fisso */
    z-index: 100; /* Deve essere inferiore a ticker-banner (1005) */
    padding: 10px 0;
}

.site-tagline {
    font-size: 10px !important;
    line-height: 1.2;
    margin-top: 0 !important;
    margin-left: 20px !important; /* Spostato a destra del nome */
    display: inline-block; /* Per stare sulla stessa riga del nome se c'è spazio */
    color: var(--colore-secondario) !important; /* Blu coerente con il sito */
    font-weight: 600;
    vertical-align: middle;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {
    display: flex;
    align-items: center;
    flex: 1; /* Prende lo spazio necessario per centrare la tagline */
}

.site-title {
    font-size: 24px;
    margin: 0;
}

.site-title .nome {
    color: var(--colore-secondario);
}

.site-title .cognome {
    color: var(--colore-primario);
}

.main-navigation {
    display: flex;
    align-items: center;
}

.menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu li {
    margin-left: 25px;
}

.menu a {
    color: var(--colore-neutro-scuro);
    font-weight: 600;
    position: relative;
    padding: 5px 0;
}

.menu a:hover,
.menu a.active {
    color: var(--colore-primario);
}

.menu a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--colore-primario);
    transition: width 0.3s ease;
}

.menu a:hover:after,
.menu a.active:after {
    width: 100%;
}

.cta-button {
    background-color: var(--colore-primario);
    color: var(--colore-neutro-chiaro);
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 25px;
    transition: background-color 0.3s ease;
}

.cta-button:hover {
    background-color: #b01f28;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 25px;
    position: relative;
}

.menu-icon {
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: var(--colore-secondario);
    top: 50%;
    transform: translateY(-50%);
    transition: background-color 0.3s ease;
}

.menu-icon:before,
.menu-icon:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: var(--colore-secondario);
    transition: transform 0.3s ease;
}

.menu-icon:before {
    top: -8px;
}

.menu-icon:after {
    bottom: -8px;
}

.menu-toggle.active .menu-icon {
    background-color: transparent; /* Nasconde la linea centrale */
}

.menu-toggle.active .menu-icon:before {
    transform: rotate(45deg) translate(5px, 5px);
    top: 0;
}

.menu-toggle.active .menu-icon:after {
    transform: rotate(-45deg) translate(5px, -5px);
    bottom: 0;
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 600px;
    background-size: cover;
    background-position: center;
    color: var(--colore-neutro-chiaro);
    display: flex;
    align-items: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 51, 102, 0.8), rgba(210, 38, 48, 0.8));
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 0 20px;
}

.hero-title {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 20px;
    margin-bottom: 30px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.hero-button-primary {
    background-color: var(--colore-primario);
    color: var(--colore-neutro-chiaro);
    padding: 12px 25px;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.hero-button-primary:hover {
    background-color: #b01f28;
}

.hero-button-secondary {
    background-color: transparent;
    color: var(--colore-neutro-chiaro);
    padding: 12px 25px;
    border-radius: 4px;
    font-weight: 600;
    border: 2px solid var(--colore-neutro-chiaro);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hero-button-secondary:hover {
    background-color: var(--colore-neutro-chiaro);
    color: var(--colore-secondario);
}

/* Pulsante contattami blu */
.contattami-button {
    background-color: var(--colore-secondario);
    color: var(--colore-neutro-chiaro);
    padding: 12px 25px;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.contattami-button:hover {
    background-color: #002244;
}

/* Footer */
.site-footer {
    background-color: var(--colore-secondario);
    color: var(--colore-neutro-chiaro);
    padding: 60px 0 20px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.footer-column {
    width: 30%;
    margin-bottom: 30px;
}

.footer-column h3 {
    font-size: 20px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 15px;
}

.footer-column h3:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--colore-primario);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #ccc;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--colore-neutro-chiaro);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.social-link:hover {
    background-color: var(--colore-primario);
}

.footer-newsletter {
    display: flex;
    margin-top: 20px;
}

.footer-newsletter input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px 0 0 4px;
}

.footer-newsletter button {
    background-color: var(--colore-primario);
    color: var(--colore-neutro-chiaro);
    padding: 10px 15px;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.footer-newsletter button:hover {
    background-color: #b01f28;
}

.footer-copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    color: #ccc;
}

/* Responsive */
@media (max-width: 992px) {
    .footer-column {
        width: 48%;
    }
}

@media (max-width: 768px) {
    .header-content {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 5px;
    }
    .site-branding {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .site-title {
        font-size: 16px;
        white-space: nowrap;
    }
    .site-tagline {
        font-size: 8px !important;
        margin-top: 2px !important;
        margin-left: 0 !important; /* Reset margine sinistro su mobile */
        display: block;
    }
    .menu-toggle {
        display: block;
        margin-right: 0; /* Ridotto al minimo lo spazio dai trattini */
    }
    .cta-button {
        margin-left: 0;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .menu {
        position: fixed; /* Use fixed to cover viewport */
        top: 0;
        left: 0;
        width: 100%; /* Modificato per coprire l'intera larghezza */
        /* max-width: 300px; Rimosso per permettere larghezza piena */
        height: 100vh;
        background-color: var(--colore-neutro-chiaro);
        flex-direction: column;
        padding: 40px 20px 20px; /* Add padding top for header space */
        box-shadow: 5px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        opacity: 1;
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease;
        z-index: 101; /* Higher z-index */
        overflow-y: auto; /* Allow scrolling if content overflows */
    }

    .menu.active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    .menu li {
        margin: 15px 0;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .section-title h2 {
        font-size: 28px;
    }
    
    .footer-column {
        width: 100%;
    }
    
    /* Sistemazione layout mobile per evitare sovrapposizione */
    .main-navigation {
        position: relative;
    }
    
    .cta-button {
        margin-left: 15px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: 500px;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
}


/* Modifiche layout header mobile */
@media (max-width: 768px) {
    .site-header {
        padding: 10px 0; /* Riduci padding header */
        position: sticky; /* Mantiene l'header sticky */
        top: 40px; /* Altezza del ticker banner */
        z-index: 1000; /* Assicura che l'header sia sopra altri elementi ma sotto il menu aperto */
    }
    body.has-ticker {
        padding-top: 0; /* Rimuoviamo il padding-top aggiunto precedentemente per il ticker */
    }
    .ticker-banner {
        position: sticky;
        top: 0;
        z-index: 1001; /* Più alto dell'header */
    }
    .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
        flex-wrap: nowrap;
        height: 50px;
    }
    .site-branding {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        z-index: 1;
        white-space: normal;
    }
    .site-title {
        font-size: 16px;
        margin: 0;
        line-height: 1.1;
    }
    .site-title .nome,
    .site-title .cognome {
        display: block;
    }
    .main-navigation {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: static;
        width: 100%;
    }
    .menu-toggle {
        display: block;
        z-index: 1003; /* Più alto di tutti per essere cliccabile */
        margin-right: 0;
        flex-shrink: 0;
        /* Stili per l'icona hamburger/X */
        width: 30px;
        height: 25px;
        position: relative;
        background: transparent; /* Sfondo trasparente */
        border: none;
        cursor: pointer;
    }
    .menu-icon {
        position: absolute;
        width: 100%;
        height: 3px;
        background-color: var(--colore-secondario);
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        transition: background-color 0.3s ease, transform 0.3s ease;
    }
    .menu-icon:before,
    .menu-icon:after {
        content: '';
        position: absolute;
        width: 100%;
        height: 3px;
        background-color: var(--colore-secondario);
        left: 0;
        transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
    }
    .menu-icon:before {
        top: -8px;
    }
    .menu-icon:after {
        bottom: -8px;
    }
    .menu-toggle.active .menu-icon {
        background-color: transparent; /* La linea centrale scompare */
    }
    .menu-toggle.active .menu-icon:before {
        top: 0;
        transform: rotate(45deg);
    }
    .menu-toggle.active .menu-icon:after {
        bottom: 0;
        transform: rotate(-45deg);
    }

    .cta-button {
        margin-left: 0;
        z-index: 2;
        padding: 6px 10px;
        font-size: 14px;
        flex-shrink: 0;
    }

    /* Stili menu dropdown (modificato per discesa dall'alto, full width, altezza auto) */
    .menu {
        position: fixed;
        top: 110px; /* Altezza ticker (~40px) + altezza header (70px) */
        left: 0;
        width: 100vw; /* Forzatura larghezza viewport */
        height: auto; /* Altezza automatica basata sul contenuto */
        max-height: calc(100vh - 110px); /* Evita che il menu superi l'altezza della viewport */
        background-color: var(--colore-neutro-chiaro);
        flex-direction: column;
        padding: 20px 0; /* Spazio interno verticale, nessun padding orizzontale per full-width */
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0s 0.3s; /* Ritarda la scomparsa della visibilità */
        z-index: 1002; /* Sotto il menu-toggle ma sopra il resto */
        overflow-y: auto; /* Abilita lo scroll se il contenuto è troppo */
        box-sizing: border-box; /* Assicura che padding/border non alterino la larghezza totale */
    }
    .menu.active {
        transform: translateY(0); /* Per left:0 e width:100vw */
        /* transform: translateX(-50%) translateY(0); se si usa left:50% */
        visibility: visible;
        transition: transform 0.3s ease, visibility 0s; /* La visibilità appare con la trasformazione */
    }
    .menu li {
        margin: 15px 0;
        text-align: center; /* Centra le voci del menu */
    }
    .menu a {
        display: block; /* Per occupare tutta la larghezza e facilitare il click */
        padding: 10px;
    }

    /* Rimuoviamo gli stili per .menu-close e .hidden-by-js/.visible-by-js se presenti da modifiche precedenti */
    .menu-close,
    .menu-toggle.hidden-by-js,
    .menu-close.visible-by-js {
        display: none !important;
    }
}

/* Correzione per il widget Netlify Identity */
.netlify-identity-widget {
    z-index: 1000 !important; /* Assicura che sia sopra l'header */
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
}

/* Assicura che i moduli di Netlify non siano nascosti sotto l'header */
.netlify-identity-modal {
    z-index: 1001 !important;
    top: 0 !important;
}

/* Padding aggiuntivo per i moduli di Netlify per evitare che siano nascosti */
body.netlify-identity-modal-open {
    padding-top: 0;
}

/* Assicura che il modulo di login sia completamente visibile */
.netlify-identity-modal .netlify-identity-modal-box {
    margin-top: 60px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
