/* FIX GLOBALE SCROLL ORIZZONTALE */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}


/* =============================================================
* {
    outline: 1px solid red !important;
} 
   ============================================================= */


/* =============================================================
   1. HEADER FISSO (STICKY) E LOGO
   ============================================================= */
.header-custom-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background-color: #000000 !important;
    padding: 0 40px !important;
    height: 80px !important;

    /* Posizionamento assoluto rispetto al viewport */ 
    position: fixed !important;
    top: 0; 
    left: 0;
    right: 0;
    width: 100%;

    /* Z-index estremo per superare slideshow o moduli sovrapposti */  
    z-index: 100000 !important;
    box-sizing: border-box !important;

    /* Opzionale: aggiunge un'ombra per distaccarlo dal contenuto che scorre sotto */
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);  
}
.navbar-brand .site-title {
    display: none !important;
    width: 0 !important;
}

.navbar-brand-custom img {
    max-height: 45px !important;
    width: auto !important;

}

/* =============================================================
   1.1 Scroll Progress Indicator
   ============================================================= */

/* Container del cerchio e freccia */
#scroll-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    transition: transform 0.2s ease;
    cursor: pointer;
}

#scroll-wrapper:hover {
    transform: scale(1.1); /* Si ingrandisce leggermente al passaggio del mouse */
}

/* Stile della freccia (creata con CSS puro) */
.arrow-up {
    position: absolute;
    width: 10px;
    height: 10px;
    border-top: 3px solid #ffffff; /* Colore freccia */
    border-left: 3px solid #ffffff;
    transform: rotate(45deg);
    margin-top: 4px; /* Centratura ottica */
    opacity: 0.5;
    transition: opacity 0.3s;
}

#scroll-wrapper:hover .arrow-up {
    opacity: 1; /* La freccia si illumina al passaggio del mouse */
}

#scroll-wrapper svg {
    transform: rotate(-90deg);
}

#scroll-wrapper .bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

#scroll-wrapper .bar {
    fill: none;
    stroke: #ffffff; 
    stroke-width: 8;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* Nasconde su dispositivi piccoli per non affollare l'header */
@media (max-width: 768px) {
    #scroll-wrapper { display: none; }
}

/* =============================================================
   MENU
   ============================================================= */

/* 1. RESET COLORI BASE PER BOTTONI E LINK SOTTOMENU */
/* Modificato: background-color ora è transparent per eliminare i rettangoli bianchi */
body .metismenu-item ul li a, 
body .metismenu-item ul li button.mm-toggler {
    background-color: transparent !important; /* <--- MODIFICATO */
    color: #000000 !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    padding: 5px 20px !important; /* Ti ho aggiunto un po' di padding, 0px era troppo stretto */
    border: none !important;
/*    border-bottom: 2px solid #000000 !important; */
    font-size: 18px !important;
    text-transform: none !important;
    text-decoration: none !important;
    transition: background 0.2s ease;
}

/* 2. FIX CONTRASTO HOVER */
/* Qui lo sfondo compare SOLO quando passi il mouse */
body .metismenu-item ul li a:hover, 
body .metismenu-item ul li button.mm-toggler:hover,
body .metismenu-item ul li.mm-active > a,
body .metismenu-item ul li.mm-active > button {
    background-color: #f1f1f1 !important; /* Un grigio leggero per evidenziare la scelta */
    color: #000000 !important;
    opacity: 1 !important;
}

/* 3. SFONDO GENERALE DEL SOTTOMENU */
/* Questo serve a dare il colore bianco a tutto il "blocco" del sottomenu */
body .container-nav ul.mod-menu li ul {
    background-color: #ffffff !important;
}

/* 4. RIMOZIONE BORDO ULTIMO ELEMENTO */
body .metismenu-item ul li:last-child > a,
body .metismenu-item ul li:last-child > button {
    border-bottom: none !important;
}

/* =============================================================
   CREDIT & PHOTO LAYOUT
   ============================================================= */

/* Contenitore principale aggiornato */
.custom-photo-wrapper {
    width: 100%;
    /* Utilizziamo le variabili per i margini. Il default è 'auto' (centrato) */
    margin-top: 0;
    margin-bottom: 2rem;
    margin-left: var(--photo-align-left, auto);
    margin-right: var(--photo-align-right, auto);
    
    display: flow-root; 
}

.custom-photo-wrapper:has(.credit-verticale) {
    padding-left: 30px;
}

/* Comportamento Desktop (Default: 50% della larghezza) */
@media (min-width: 768px) {
    .custom-photo-wrapper {
        width: 50%;
    }
    
    /* Forza la larghezza piena se aggiungi questa classe nell'HTML */
    .custom-photo-wrapper.full-width {
        width: 100%;
        padding-left: 0; /* Opzionale: rimuove spazio extra per foto grandi */
    }
}

.foto-container {
    position: relative;
    line-height: 0;
}

.foto-container img {
    width: 100%;
    height: auto;
    /* Se vuoi limitare l'altezza massima per le foto orizzontali */
    max-height: 80vh; 
    object-fit: cover; /* Evita distorsioni se metti max-height */
    border-radius: 10px;
    display: block;
}

/* Credito Verticale */
.credit-verticale {
    position: absolute;
    bottom: 0;
    left: 5px;
    transform: rotate(-90deg);
    transform-origin: bottom left;
    font-size: 11px;
    font-style: italic; /* Aggiunto Italico come richiesto */
    color: var(--credit-color, #666);
    white-space: nowrap;
    line-height: 1;
}

/* Credito Orizzontale */
.credit-orizzontale {
    display: block;
    text-align: right;
    font-size: 11px;
    font-style: italic; /* Aggiunto Italico */
    color: var(--credit-color, #666);
    padding-top: 5px;
    line-height: 1;
}

/* Credito Overlay */
.credit-overlay {
    position: absolute;
    bottom: 25px;
    right: 20px;
    transform: rotate(90deg);
    transform-origin: bottom right;
    font-size: 11px;
    font-style: italic;
    color: var(--credit-color, #fff); /* Default bianco per overlay */
/*    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); */
    line-height: 1;
}

/* =============================================================
   3. SEZIONE CITAZIONE - PENDOLO (PARALLASSE)
   ============================================================= */
.parallax-section {
    margin-top: 0px; 
    height: 650px !important; /* Altezza Desktop */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Proprietà mantenute per l'effetto */
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    color: #ffffff !important;
}

@media (max-width: 767px) {
    .parallax-section {
        height: 550px !important; /* Altezza ridotta per Mobile */
    }
}

.quote-container, blockquote {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center;
}

.quote-text {
    font-size: clamp(24px, 5vw, 45px) !important;
    font-weight: 800;
    text-align: center;
    color: #ffffff !important;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
    line-height: 1.1 !important;
}

.quote-author {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #ffffff !important;
    opacity: 0.8;
}

/* =============================================================
   4. PITTOGRAMMA HERO RESPONSIVE
   ============================================================= */
.img-hero-responsive {
    display: block;
    width: 90%; 
    height: auto;
    margin: 0 auto;
    padding-top: 40px;
    object-fit: cover;
}

@media (min-width: 992px) {
    .img-hero-responsive {
        width: 30% !important; 
        padding-top: 80px;
    }
}

/* =============================================================
   CAROUSEL & CARDS - STRUTTURA GENERALE
   ============================================================= */
.carousel-container-custom {
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    padding: 20px 50px !important; 
    width: 100% !important;
    background-color: #ffffff !important;
}

.scroll-wrapper {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    scroll-behavior: smooth !important;
    gap: 20px !important;
    width: 100% !important;
    padding: 10px 5px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
}

.scroll-wrapper::-webkit-scrollbar { display: none !important; }

/* =============================================================
   STILE CARD (PC)
   ============================================================= */

.card-progetto {
    flex: 0 0 calc(25% - 15px) !important;
    min-width: calc(25% - 15px) !important;
    height: 420px !important; /* Altezza totale */
    background-color: #000000 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform 0.3s ease !important;
}

.card-img-container {
    height: 300px !important; /* Immagine alta */
    width: 100% !important;
    overflow: hidden !important;
}

.card-img-top {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.card-progetto .card-body {
    background-color: #000000 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.3) !important; 
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
}

.card-progetto h2 {
    color: #ffffff !important;
    font-size: 1.1rem !important;
    font-weight: bold !important;
    text-transform: uppercase;
    margin: 0 !important;
    line-height: 1.2 !important;
}

.btn-progetto {
    display: block !important;
    width: 100% !important;
    padding: 12px !important;
    border-radius: 15px !important;
    text-align: center !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    margin-top: auto !important; /* Bottone in basso */
}

/* FRECCE */
.btn-scroll {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #000 !important;
    color: #fff !important;
    border: none !important;
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    z-index: 800 !important;
    cursor: pointer !important;

    /* Inizialmente gestito dal JS, ma definiamo come deve apparire quando c'è */
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#btn-prev { left: 10px !important; }
#btn-next { right: 10px !important; }

/* =============================================================
   MEDIA QUERIES (MOBILE - CARD PIÙ LARGHE)
   ============================================================= */
@media (max-width: 991px) {
    .carousel-container-custom {
        padding: 10px 0px !important; /* Riduciamo il padding laterale della cornice */
    }

    .card-progetto { 
        /* 92% permette di vedere un pezzettino della card successiva */
        flex: 0 0 92% !important; 
        min-width: 92% !important; 
        height: 420px !important; /* Aumentata anche qui per l'immagine alta */
    }

    .card-img-container {
        height: 300px !important; /* Immagine bella alta anche su mobile */
    }

    .btn-scroll {
        display: none !important; /* Nascondiamo le frecce su mobile */
    }
}

/* =============================================================
   7. FOOTER OTTIMIZZATO
   ============================================================= */

/* Regola generale per Desktop e Tablet */
.footer-custom-container {
    background-color: #000000 !important;
    background: #000000 !important;
    height: 5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important; /* Centra su PC e Tablet */
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.footer-custom-container span {
    color: #ffffff !important;
    font-size: 12px;
    text-align: center !important;
    display: block !important;
    width: 100%;
}

/* Configurazione specifica per MOBILE */
@media (max-width: 991px) {
    .footer-custom-container {
        /*display: none !important; /* Nascondi se avevi deciso di nasconderlo */
        /* Oppure, se vuoi vederlo ma staccato, usa invece: */
        /* margin-top: 30px !important; */
    }
}

/* Se decidi di NON nasconderlo su mobile, aggiungiamo spazio dall'oggetto sopra */
footer.footer, .footer-wrapper {
    margin-top: 20px !important; /* Distanza dall'ultimo oggetto della pagina */
    background: #000000 !important;
}

/* =============================================================
   8. MENU HAMBURGER MOBILE
   ============================================================= */

/* Icona Hamburger - BIANCO */
.hamburger-menu {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    z-index: 10001;
}

.hamburger-menu span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 3px;
    transition: all 0.3s ease;
}

@media (max-width: 991px) {
    .hamburger-menu {
        display: flex !important;
    }

    /* HEADER MOBILE - BIANCO */
    .header-custom-container {
        display: flex !important;
        height: 100px !important;
        background-color: #000000 !important;
        padding: 0 20px !important;
        align-items: center !important;
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10000;
        border-bottom: 1px solid #eeeeee;
    }

    /* PANNELLO MENU - NERO */
    .nav-collapse {
        position: fixed;
        top: 85px; /* Corretto per combaciare con altezza header */
        left: -100%; 
        width: 100%;
        height: calc(100vh - 85px);
        background-color: #000000 !important; 
        transition: 0.4s;
        overflow-y: auto;
        z-index: 9999;
        display: block !important; /* Forza il contenitore a gestire il flusso */
        box-sizing: border-box !important;
    }

    .nav-collapse.active {
        left: 0 !important;
    }

    /* STILE LISTE JOOMLA */
    .nav-collapse ul.nav,
    .nav-collapse ul.mod-menu {
        list-style: none !important;
        padding: 20px !important;
        margin: 0 !important;
    }

    .nav-collapse li {
        width: 100% !important;
        background: transparent !important;
        position: relative;
        height: auto !important; /* Permette l'espansione verticale */
    }

    /* LINK */
    .nav-collapse li a, 
    .nav-collapse li span,
    .nav-collapse li .nav-link {
        color: #ffffff !important;
        display: block !important;
        padding: 12px 0 !important;
        text-decoration: none !important;
        background: transparent !important;
        font-size: 18px !important;
    }

    /* FIX FISARMONICA: Il sottomenu occupa spazio e spinge i genitori sotto */
    .nav-collapse .nav-child {
        position: static !important; /* Rimuove il posizionamento assoluto */
        display: none;                /* Nasconde di default */
        float: none !important;
        width: 100% !important;
        padding-left: 20px !important;
        list-style: none !important;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Quando il sottomenu è aperto (Joomla/Bootstrap aggiunge .show o .open) */
    .nav-collapse .nav-child.show,
    .nav-collapse .collapse.show {
        display: block !important;
    }

    /* Assicura che il menu collassabile si chiuda quando Joomla lo richiede */
    .nav-collapse .collapse:not(.show) {
        display: none !important;
    }

    /* Colore link sottomenu */
    .nav-collapse .nav-child a {
        font-size: 16px !important;
        padding: 8px 0 !important;
        color: #cccccc !important; /* Grigio per visibilità su nero */
    }

    /* Bordo separatore */
    .nav-collapse > ul > li {
        border-bottom: 1px solid #333333;
    }

    /* ICONA HAMBURGER ANIMATA */
    .hamburger-menu.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .hamburger-menu.open span:nth-child(2) { opacity: 0; }
    .hamburger-menu.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    .navbar-brand-custom img { max-height: 45px !important; }
}




