:root {
    --bg: #f7f7f9;
    --card: #ffffff;
    --accent: #4b5563;
    --muted: #6b7280;
    --overlay: rgba(0, 0, 0, 0.4);
    --primary: #8B4513;
    --primary-light: #D2691E;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    line-height: 1.6;
    /* Migliora la leggibilità del testo aumentando la spaziatura*/
    margin: 0;
    /* Rimuove i margini di default del browser */
    background: var(--bg);
    /* Colore di sfondo chiaro per un aspetto pulito */
    color: #111;
    /* Colore del testo scuro per un buon contrasto */
    font-size: 1.2rem;
    /* Dimensione del testo base */
}



/* HERO SECTION */
.hero {
    height: 100vh;
    /* Occupa l'intera altezza della finestra */
    min-height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4)),
        url('images/buon-ladrone-hero.png') center/cover no-repeat;
    /* Immagine di sfondo con overlay scuro */
    display: flex;
    /* Usa Flexbox per centrare il contenuto */
    align-items: center;
    /* Centra verticalmente */
    justify-content: center;
    /* Centra orizzontalmente */
    text-align: center;
    /* Centra il testo */
    color: #fff;
    /* Colore del testo bianco per contrastare con lo sfondo */
    padding: 2rem 1rem;
    /* Spaziatura interna */
    position: relative;
}

.hero-text {
    max-width: 90%;
}

/* CONTAINER E LAYOUT */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* CARD OTTIMIZZATE */
.card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

/* SEZIONI */
main {
    padding: 2rem 0;
}

/* IMMAGINE PRINCIPALE PIÙ GRANDE SU DESKTOP */
.main-image-card {
    grid-column: 1 / -1;
    /* Occupa tutta la larghezza disponibile */
}

.main-image-card img {
    transition: transform 0.3s ease;
    cursor: pointer;
}

.main-image-card img:hover {
    transform: scale(1.05);
    /* Zoom leggero al passaggio del cursore */
}

.main-image {
    max-width: 600px;
    /* Dimensione base mobile */
    margin: 0 auto;
    display: block;
}

section h2 {
    color: var(--accent);
    border-bottom: 3px solid #e6e6e9;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

section h3 {
    color: var(--accent);
    margin: 1.5rem 0 1rem 0;
    font-size: 1.2rem;
}

/* IMMAGINI RESPONSIVE */
img.responsive {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
}


/* GALLERIA OTTIMIZZATA */
.gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.thumb {
    height: 260px;              
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    background: #f5f5f5;
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;          
    object-position: center;
    transition: transform 0.3s ease;
}



.thumb::after {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumb:hover::after {
    opacity: 1;
}

.thumb img:hover {
    transform: scale(1.1);
    /* Ingrandisce del 10% */
}

.caption {
    font-size: 1.1rem;
    color: var(--muted);
    margin-top: 0.8rem;
    line-height: 1.4;
    padding: 0 0.5rem;
}

/* FAQ OTTIMIZZATE */
.faq dt {
    font-weight: 600;
    margin-top: 1.5rem;
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1.4;
}

.faq dd {
    margin: 0.5rem 0 1rem 0;
    padding-left: 1rem;
    border-left: 3px solid #e6e6e9;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* TESTO */
.meta {
    font-size: 1.2rem;
    color: var(--muted);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

p {
    margin-bottom: 1.2rem;
}

/* LISTE */
ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* VIDEO RESPONSIVE */
.video-wrap {
    position: relative;
    padding-top: 56.25%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    margin: 1rem 0;
}

.video-wrap iframe {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* BOTTONI */
a.button {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
    margin: 0.5rem 0;
}

a.button:hover {
    background: linear-gradient(135deg, #A0522D, #F4A460);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
}

/* FOOTER */
footer {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    background: var(--card);
    margin-top: 2rem;
}

/* LIGHTBOX */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 999;
    backdrop-filter: blur(4px);
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 95%;
    max-height: 90%;
}

.lightbox img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    color: #fff;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: center;
    margin-top: 1.5rem;
    padding: 0 2rem;
    max-width: 800px;
}

.close-x {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close-x:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* PROGRESS BAR */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    z-index: 1000;
    transition: width 0.1s ease;
}

/* SMOOTH SCROLLING */
html {
    scroll-behavior: smooth;
}

/* MEDIA QUERIES */
@media (min-width: 480px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero p {
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    .hero {
        min-height: 100vh;
        /* Mantiene schermo intero anche su tablet */
    }

    .hero h1 {
        font-size: 2.8rem;
    }

    .hero p {
        font-size: 1.1rem;
        padding: 0 2rem;
    }
    .thumb {
        height: 300px;
    }

    .grid {
        grid-template-columns: 2fr 1fr;
    }

    .gallery {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }

    /* IMMAGINE PRINCIPALE PIÙ GRANDE SU DESKTOP */
    .main-image {
        max-width: 800px;
        /* Più grande su tablet */
    }
}

@media (min-width: 1024px) {
    .hero h1 {
        font-size: 3.5rem;
    }

    .hero p {
        font-size: 1.2rem;
    }
    .thumb {
        height: 340px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2rem;
    }

    /* IMMAGINE PRINCIPALE MOLTO PIÙ GRANDE SU DESKTOP */
    .main-image {
        max-width: 1000px;
        /* Molto più grande su desktop */
    }
}

@media (min-width: 1200px) {
    .gallery {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 2rem;
    }

    /* IMMAGINE PRINCIPALE MASSIMA SU SCHERMI GRANDI */
    .main-image {
        max-width: 1200px;
        /* Dimensione massima */
    }
}

/* ANIMAZIONI */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* ACCESSIBILITA' */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* FOCUS STATES */
button:focus,
a:focus,
.thumb:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}