/* ==========================================
   1. STILI DEL LOGO E DEL BRAND
   ================================          */
.logo-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-main {
    font-family: 'Bauhaus 93', Arial, sans-serif;
    font-size: 2.0rem;
    font-weight: normal;
    color: #333333;
    letter-spacing: 0.5px;
    text-transform: lowercase;
}

.logo-sub {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.95rem;
    color: #555555;
    margin-top: 2px;
    line-height: 1.1; /* <-- Regola l'interlinea (1.2 o 1.4 sono valori ottimali) */
}

.logo-author {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.95rem;
    color: #555555;
    margin-top: 3px;
    line-height: 1.1; /* <-- Regola l'interlinea */
}

/* ==========================================
   2. STILI GENERALI E DI RESET
   ================================          */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    color: #333;
    line-height: 1.6;
    background-color: #f8f9fa;
    padding-top: var(--header-height, 110px); /* Spazio per l'header fisso (aggiornato da script.js) */
}

/* ==========================================
   3. HEADER E NAVIGAZIONE
   ================================          */
/* ==========================================
   3. HEADER E NAVIGAZIONE (Fisso e sempre visibile)
   ================================          */
header {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    
    /* Forza l'header a rimanere fisso in alto sullo schermo */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999; /* Altissimo per stare sopra a tutto (slideshow, immagini, ecc.) */
}

/* IMPORTANTE: Dà un po' di spazio sotto l'header nel body o nel container 
   principale per evitare che la prima sezione della pagina vada sotto l'header fisso */
body {
    padding-top: var(--header-height, 110px); /* Altezza reale dell'header, calcolata da script.js */
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0.8rem 1.0rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.logo-img {
    height: 85px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333333;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: #333330ec;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

/* ==========================================
   PULSANTE HAMBURGER (visibile solo nei breakpoint mobile/tablet)
   ================================ */
.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
}

.nav-toggle .bar {
    display: block;
    width: 24px;
    height: 3px;
    background-color: #333333;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle:focus-visible {
    outline: 3px solid #0056b3;
    outline-offset: 2px;
}

/* ==========================================
   NAVIGAZIONE: HOVER E PAGINA ATTIVA
   ================================          */

/* Stile base dei link della navbar */
.nav-links a {
    text-decoration: none;
    color: #495057; /* Colore di default dei testi */
    font-weight: 500;
    transition: color 0.3s ease; /* Rende il cambio di colore fluido e graduale */
}

/* Effetto al passaggio del mouse (HOVER) */
.nav-links a:hover {
    color: #0056b3; /* Scegli qui il colore che preferisci al passaggio del mouse */
}

/* Evidenziazione della pagina corrente (ACTIVE) */
.nav-links a.active {
    color: #0056b3; /* Stesso colore dell'hover o diverso per distinguerlo */
    font-weight: 700; /* Rende il testo leggermente più in grassetto per la pagina attiva */
    border-bottom: 2px solid #0056b3; /* Opzionale: aggiunge una finestrella/sottolineatura stilosa */
    padding-bottom: 3px;
}

/* ==========================================
   4. SEZIONE HERO (Tipica della Home)
   ================================          */
.hero {
    background: linear-gradient(135deg, #333333, #333333);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.btn {
    display: inline-block;
    background-color: #ffffff;
    color: #0056b3;
    padding: 0.8rem 1.8rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s, color 0.3s;
    }

.btn + .btn {
  margin-left: 15px; /* Aggiunge spazio solo se c'è un altro .btn subito dopo */
}
    .btn:hover {
    background-color: #e2e6ea;
}

/* ==========================================
   5. CONTENITORI, GRIGLIE E CARD
   ================================          */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    margin-bottom: -10rem;
    padding: 0 1.5rem;
    min-height: 40vh; /* Garantisce lo spazio anche se il testo è corto */
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
}

.card h3 {
    margin-bottom: 1rem;
    color: #0056b3;
}

/* ==========================================
   6. FOOTER
   ================================          */
footer {
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Previene scroll orizzontali indesiderati */
    background-color: #212529;
    color: #ced4da;
    text-align: center;
    padding: 2rem 1rem; 
    margin-top: 3rem;
}

/* ==========================================
   7. MEDIA QUERY (Responsive Avanzato)
   Breakpoint scelti in base alla struttura delle pagine:
   - 1100px : navbar -> menu hamburger (logo + 6 voci non stanno piu' su una riga)
   - 992px  : tablet grandi, logo ridotto
   - 768px  : tablet verticali / smartphone grandi, footer e hero compatti
   - 480px  : smartphone
   ================================          */
html { -webkit-text-size-adjust: 100%; }
img, video { max-width: 100%; }

@media (max-width: 1100px) {
    /* Nav su una riga: logo a sinistra + hamburger a destra */
    nav {
        position: relative;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 1rem;
    }
    .logo {
        flex: 1 1 auto;
        min-width: 0;
    }
    .logo-img {
        flex-shrink: 0;
    }
    .nav-toggle {
        display: inline-flex;
    }

    /* Il menu diventa un pannello a tendina sotto l'header */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        background-color: #ffffff;
        border-top: 1px solid #e9ecef;
        box-shadow: 0 8px 16px rgba(0,0,0,0.12);
        max-height: calc(100vh - var(--header-height, 96px));
        max-height: calc(100dvh - var(--header-height, 96px));
        overflow-y: auto;
    }
    header.nav-open .nav-links {
        display: flex;
    }
    .nav-links li {
        width: 100%;
    }
    .nav-links a {
        display: block;
        padding: 0.9rem 1.5rem;
        font-size: 1.05rem;
    }
    .nav-links a.active {
        border-bottom: none;
        padding-bottom: 0.9rem;
        padding-left: calc(1.5rem - 4px);
        border-left: 4px solid #0056b3;
        background-color: #f1f6fb;
    }

    /* Animazione hamburger -> X */
    header.nav-open .nav-toggle .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    header.nav-open .nav-toggle .bar:nth-child(2) { opacity: 0; }
    header.nav-open .nav-toggle .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* Evita che il footer risalga sopra i contenuti (margine negativo del desktop) */
    .container {
        margin-bottom: 2rem;
    }
}

@media (max-width: 992px) {
    :root {
        --header-height: 96px; /* valore di riserva: lo script lo aggiorna con l'altezza reale */
    }
    .logo-img {
        height: 70px;
    }
    .logo-main {
        font-size: 1.7rem;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 84px;
    }
    nav {
        gap: 0.6rem;
        padding: 0.6rem 0.8rem;
    }
    .logo {
        gap: 10px;
    }
    .logo-img {
        height: 56px;
    }
    .logo-main {
        font-size: 1.4rem;
        line-height: 1.1;
    }
    .logo-sub,
    .logo-author {
        font-size: 0.8rem;
    }
    .nav-links a {
        padding: 1rem 1.2rem;
    }

    .hero {
        padding: 3rem 1rem;
    }
    .hero h1 {
        font-size: 1.5rem;
        overflow-wrap: break-word;
    }
    .hero p {
        font-size: 1rem;
    }
    /* Pulsanti hero uno sotto l'altro, a piena larghezza utile */
    .btn {
        display: block;
        width: 100%;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }
    .btn + .btn {
        margin-left: auto;
        margin-top: 12px;
    }

    .container {
        padding: 0 1rem;
        min-height: auto;
    }
    .card {
        padding: 1.5rem;
    }

    footer {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
    }
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    footer a {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 84px;
    }
    nav {
        padding: 0.5rem 0.6rem;
    }
    .logo-img {
        height: 46px;
    }
    .logo-main {
        font-size: 1.1rem;
    }
    .logo-sub,
    .logo-author {
        font-size: 0.7rem;
        line-height: 1.15;
    }
    .nav-toggle {
        width: 44px;
        height: 44px;
    }
    .hero {
        padding: 2.2rem 1rem;
    }
    .hero h1 {
        font-size: 1.25rem;
    }
    .grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ==========================================
   8. STILE SLIDESHOW HOME (RotatingImage1)
   ================================          */
.slideshow-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px auto;
    width: 100%;
    padding: 0 15px;
}

#RotatingImage1 {
    width: 1000px;   /* <-- Aumenta la larghezza (es. da 640px a 800px) */
    height: 750px;  /* <-- Aumenta l'altezza in proporzione (es. da 480px a 600px per mantenere il 4:3) */
    max-width: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Fai in modo che tutte le immagini dentro il box riempiano lo spazio proporzionalmente */
#RotatingImage1 img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Taglia leggermente i lati se necessario per evitare distorsioni, mantenendo la proporzione */
}
/* Responsive per tablet e smartphone: niente altezza fissa, proporzione 4:3 */
@media (max-width: 992px) {
    #RotatingImage1 {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

@media (max-width: 768px) {
    .slideshow-container {
        margin: 20px auto;
        padding: 0 10px;
    }
}
