/* ============================================
   VARIABILI COLORI
   ============================================ */
:root {
    --bg: #f7f6f0;
    --primary: #ebe8e0;
    --secondary: #f2efe7;
    --accent: #e6e9f0;
    --gold: #c9a961;
    --text: #222;
    --text-light: #555;
    --shadow: rgba(0,0,0,0.08);
}

/* ============================================
   RESET E BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.7;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.fonts-loaded {
    opacity: 1;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    text-align: center;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    position: relative;
    padding-bottom: 15px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gold);
}

p {
    margin-bottom: 1.2rem;
    color: var(--text-light);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 1000;
}

.logo img {
    height: 45px;
    width: auto;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    margin: 0 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--gold);
}

.lang-switch {
    cursor: pointer;
    font-size: 12px;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 6px;
    background: white;
    transition: all 0.3s;
}

.lang-switch:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* MENU TOGGLE (Mobile) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text);
    border-radius: 2px;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
main {
    padding-top: 80px; /* SPAZIO PER LA NAVBAR FISSA */
}

section {
    margin: 0 auto;
    padding: 60px 20px;
    max-width: 1000px;
    width: 100%;
}

/* HERO SECTION - CENTRATO */
.hero-section {
    width: 100%;
    padding: 0;
}

.hero {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-logo img {
    max-width: 280px;
    width: 100%;
    height: auto;
    margin-bottom: 20px;
}

.hero > img {
    max-width: 700px;
    width: 100%;
    border-radius: 12px;
    margin: 20px auto;
    display: block;
}

.scroll-hint {
    margin-top: 25px;
    font-size: 14px;
    opacity: 0.6;
}

/* BIOGRAFIA */
.bio-content p {
    min-height: auto;
    overflow: visible;
    text-align: justify;
}

/* LISTA CINEMA */
.stats-list {
    list-style-position: outside;
    padding-left: 20px;
    margin: 20px 0;
}

.stats-list li {
    margin-bottom: 10px;
    color: var(--text-light);
}

/* ============================================
   GALLERIA - OTTIMIZZATA (NO TAGLI)
   ============================================ */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

figure img {
    width: 100%;
    height: auto; /* IMPORTANTE: Rimuove l'altezza fissa per evitare tagli */
    object-fit: contain; /* Mostra l'immagine intera senza ritagli */
    border-radius: 10px;
    transition: transform 0.3s ease;
    display: block; /* Elimina spazi bianchi inferiori */
    background-color: transparent; /* O usa un colore neutro se necessario */
}

/* Effetto hover */
figure:hover img {
    transform: scale(1.03);
}

figcaption {
    margin-top: 8px;
    font-size: 13px;
    font-family: 'Playfair Display', serif;
    text-align: center;
    color: var(--text-light);
}

/* Stile specifico per la pagina Galleria (se usata) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.gallery-grid figure {
    margin: 0;
}

.gallery-grid img {
    width: 100%;
    height: auto; /* Correzione per la pagina galleria */
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.gallery-grid figure:hover img {
    transform: scale(1.05);
}

/* ============================================
   EVENTI
   ============================================ */
.event {
    background: var(--accent);
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.event-image {
    width: 100%;
    margin-top: 15px;
    border-radius: 10px;
    height: auto;
    object-fit: contain;
}

/* ============================================
   CONTATTI
   ============================================ */
.contact-box {
    background: var(--secondary);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
}

.contact-box a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.contact-box a:hover {
    color: var(--gold);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: 20px;
    background: var(--primary);
    margin-top: 40px;
    font-size: 14px;
    color: var(--text-light);
}

/* ============================================
   RESPONSIVE MOBILE
   ============================================ */
/* ============================================
   RESPONSIVE MOBILE E ORIENTAMENTO
   ============================================ */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 65px;
        left: 0;
        width: 100%;
        background: white;
        padding: 20px 0;
        box-shadow: 0 10px 20px var(--shadow);
        text-align: center;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        margin: 12px 0;
        font-size: 16px;
        display: block;
        padding: 10px 20px;
    }

    .logo img {
        height: 35px;
    }

    h2 {
        font-size: 1.6rem;
    }

    section {
        padding: 40px 20px;
    }

    .hero {
        padding: 30px 20px;
    }

    .bio-content p, .cinema-text p {
        font-size: 15px;
        line-height: 1.65;
    }

    .stats-list li {
        font-size: 15px;
    }

    /* --- CORREZIONE SPECIFICA PER IMMAGINI SU MOBILE (VERTICALE E ORIZZONTALE) --- */
    .gallery, .gallery-grid {
        /* Riduciamo il gap per schermi stretti o orizzontali */
        gap: 15px;
        /* Assicuriamoci che la griglia non forzi colonne troppo strette */
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .gallery figure img,
    .gallery-grid img {
        /* FORZA altezza automatica per evitare tagli */
        height: auto !important; 
        /* Mostra l'immagine intera */
        object-fit: contain !important;
        /* Rimuove eventuali altezze fisse ereditate */
        max-height: none !important;
        /* Assicura che l'immagine non superi la larghezza del contenitore */
        width: 100%;
        /* Centra l'immagine se è più piccola del contenitore */
        display: block;
        margin: 0 auto;
        border-radius: 10px;
    }
    
    /* Gestione specifica per l'orientamento orizzontale (Landscape) su mobile */
    @media (orientation: landscape) and (max-width: 768px) {
        .gallery figure img,
        .gallery-grid img {
            /* In landscape, a volte lo spazio verticale è limitato. 
               Limitiamo l'altezza massima a 60% dell'altezza viewport per non coprire tutto */
            max-height: 60vh; 
            /* Ma manteniamo height auto per le proporzioni */
            height: auto;
            object-fit: contain;
        }
        
        /* Riduciamo il padding delle sezioni per dare più spazio verticale */
        section {
            padding: 20px 15px;
        }
    }
}
/* ============================================
   LIGHTBOX STYLES
   ============================================ */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 4px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
    cursor: zoom-in;
    object-fit: contain; /* Garantisce che l'immagine nella lightbox non sia tagliata */
}

.lightbox-caption {
    margin-top: 15px;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
    line-height: 1.5;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.3s;
    line-height: 1;
}

.lightbox-close:hover {
    color: var(--gold);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive per mobile lightbox */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95%;
        max-height: 90%;
    }
    
    .lightbox-img {
        max-height: 65vh;
    }
    
    .lightbox-caption {
        font-size: 14px;
        margin-top: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
}

/* ============================================
   NAVIGAZIONE LIGHTBOX (FRECCE)
   ============================================ */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 50px;
    font-weight: bold;
    padding: 10px 20px;
    cursor: pointer;
    user-select: none;
    z-index: 2002;
    transition: all 0.3s ease;
    opacity: 0.5;
    text-decoration: none;
    line-height: 1;
}

.lightbox-nav:hover {
    opacity: 1;
    color: var(--gold);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* Nascondi le frecce su schermi molto piccoli se necessario */
@media (max-width: 768px) {
    .lightbox-nav {
        font-size: 30px;
        padding: 5px 10px;
    }
    
    .lightbox-nav.prev {
        left: 10px;
    }
    
    .lightbox-nav.next {
        right: 10px;
    }
}

/* ============================================
   RESPONSIVE PER GALLERIA (Desktop)
   ============================================ */
@media (min-width: 1024px) {
    .gallery figure img,
    .gallery-grid img {
        /* LIMITA LA LARGHEZZA MAX (es. 400px o 500px) */
        max-width: 600px; 
        
        /* MANTIENE LE PROPORZIONI */
        height: auto;
        object-fit: contain;
        
        /* CENTRA L'IMMAGINE NEL SUO CONTENITORE */
        display: block;
        margin: 0 auto; 
        
        /* OPZIONALE: Aggiunge un po' di spazio intorno se vuoi che non tocchi i bordi */
        padding: 5px; 
    }
}