/* =========================================
   PAGE HEADER
   ========================================= */
.page-header {
    position: relative;
    height: 50vh;
    /* Metà schermo */
    min-height: 400px;
    background: url('../immagini/sfondi/1.jpg') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    /* Parallax */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 0;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* Molto scuro */
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    color: var(--main-white);
    padding: 0 20px;
}

.header-content h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.breadcrumb {
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 1px;
    color: #ccc;
    text-transform: uppercase;
}

/* =========================================
   GALLERY GRID (Masonry)
   ========================================= */
.gallery-section {
    padding: 80px 20px;
    background-color: var(--main-white);
    min-height: 100vh;
}

.gallery-grid {
    display: grid;
    /* Crea colonne automatiche min 350px */
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    height: 300px;
    /* Altezza fissa per uniformità */
    overflow: hidden;
    cursor: pointer;
    background: #000;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.6s ease;
}

/* OVERLAY (Testo nascosto) */
.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
    opacity: 0;
    /* Nascosto */
    transition: 0.4s ease;
    display: flex;
    align-items: flex-end;
    /* Testo in basso */
    padding: 30px;
}

/* Hover Effects */
.gallery-item:hover .overlay {
    opacity: 1;
    /* Mostra overlay */
}

.gallery-item:hover img {
    transform: scale(1.1);
    /* Zoom */
}

.text {
    transform: translateY(20px);
    transition: transform 0.4s;
    width: 100%;
}

.gallery-item:hover .text {
    transform: translateY(0);
}

.text h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 5px;
    text-transform: uppercase;
    color: var(--main-white);
    border-left: 3px solid var(--main-red);
    padding-left: 10px;
}

.text p {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: #ddd;
    padding-left: 13px;
    /* Allineato col titolo */
    margin: 0;
}

/* =========================================
   MODALE (Popup)
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
}

.modal-content-wrapper {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 1000px;
    text-align: center;
}

/* Caption Modale */
#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 20px 0;
}

#caption h3 {
    font-family: var(--font-heading);
    color: var(--main-white);
    font-size: 1.5rem;
    margin-bottom: 5px;
    text-transform: uppercase;
}

#caption p {
    color: var(--main-red);
    /* Luogo in rosso nel modale */
    font-size: 1rem;
}

/* =========================================
   MODAL ANIMATO
   ========================================= */

/* Keyframes per l'animazione di apertura */
@keyframes fadeInBackdrop {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

@keyframes zoomInImage {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Container del modal */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: none;
}

.photo-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Backdrop con blur */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    animation: fadeInBackdrop 0.3s ease-out;
    z-index: 3000;
}

/* Container interno del modal */
.modal-content {
    position: relative;
    z-index: 3001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Immagine nel modal */
#modal-image {
    position: relative;
    z-index: 3001;
    max-width: 90vw;
    max-height: 65vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: zoomInImage 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Info della foto */
.modal-info {
    text-align: center;
    color: var(--main-white);
    animation: zoomInImage 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 25px 30px;
    border-radius: 4px;
    width: 100%;
    max-width: 700px;
}

#modal-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--main-white);
    margin: 0 0 12px 0;
    border-left: 4px solid var(--main-red);
    padding-left: 15px;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#modal-description {
    font-family: var(--font-body);
    font-size: 1rem;
    color: #e0e0e0;
    margin: 0;
    line-height: 1.6;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Bottone chiudi */
.modal-close {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--main-white);
    font-size: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 3002;
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: var(--main-red);
    color: var(--main-red);
    transform: rotate(90deg);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media only screen and (max-width: 768px) {
    .modal-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 32px;
    }

    #modal-image {
        max-width: 95vw;
        max-height: 60vh;
    }

    #modal-title {
        font-size: 1.3rem;
    }

    #modal-description {
        font-size: 0.9rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        /* Una colonna su mobile */
        gap: 15px;
    }

    .gallery-item {
        height: 250px;
    }

    .header-content h1 {
        font-size: 2.5rem;
    }
}