/* Grid container */
.foto {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 20px;
    position: relative; /* needed for overlay inside it */
}



/* Make images square and cover the grid cell */
.foto img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
    display: block;
}

/* Zoom effect on hover */
.foto img:hover {
    transform: scale(1.05);
}


/* overlay should apply globally */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: auto;
    padding: 20px;
}

.overlay.active {
    display: flex;
}



.overlay .close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: white;
    background-color: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.overlay .arrow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    color: white;
    background-color: rgba(0,0,0,0.4);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 10;
}
.overlay-content {
    position: relative;      /* NEW – arrows now position to this box */
    display: inline-block;   /* shrink-wrap around the image */
}

.overlay-content img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 10px;
    pointer-events: none;
}

.overlay .arrow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    color: white;
    background-color: rgba(0,0,0,0.4);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    z-index: 10;
}

.overlay-content .close-btn {
    position: absolute;
    top: 10px;               /* distance from image top */
    right: 10px;             /* distance from image right */
    font-size: 36px;
    color: white;
    background: rgba(0,0,0,0.4);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.overlay-content .close-btn:hover {
    background: rgba(0,0,0,0.7);
}

.overlay .arrow-left  { left: 10px;  }  /* now relative to the image */
.overlay .arrow-right { right: 10px; }

.overlay .arrow-btn:hover {
    background-color: rgba(0,0,0,0.7);
}

@media (max-width: 1000px) {
    .foto {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Ensure the flexbox truly centers the content */
    .overlay {
        padding: 0;               /* remove side padding that was pushing right */
        justify-content: center;
        align-items: center;
    }

    .overlay-content {
        width: auto;              /* don’t force 100% width */
        max-width: 95vw;
        margin: 0;                /* kill any accidental margins */
    }

    .overlay-content img {
        max-width: 95vw;
        max-height: 80vh;
    }

    /* keep buttons inside */
    .overlay .arrow-left  { left: 10px; }
    .overlay .arrow-right { right: 10px; }
    .overlay-content .close-btn { right: 10px; }
}

