/* Gallery Grid voor sub-portfolio's */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px 20px;
    max-width: 1024px;
    margin: 20px auto 40px auto;
}

.gallery-item {
    display: block;
    cursor: pointer;
    border: 1px solid #ddd;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
}

/* Lightbox Overlay */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.lightbox-overlay.active {
    display: flex;
}

/* Lightbox Content Box */
.lightbox-content {
    position: relative;
    /* FIX VOOR IPAD: Gebruik viewport units direct voor stabiele afmetingen */
    width: 80vw; 
    height: 80vh;
    
    padding: 20px;
    box-sizing: border-box;
    background-color: #333;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; 
}

/* Lightbox Afbeelding */
.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;

    opacity: 0; /* Standaard onzichtbaar totdat JS het laadt en zichtbaar maakt */
    transition: opacity 0.2s ease-in-out; 
}

/* Lightbox Sluitknop */
.lightbox-close {
    position: fixed; /* TERUG NAAR FIXED voor consistente zichtbaarheid */
    top: 20px;
    right: 20px;
    background: #333; /* Achtergrond voor betere zichtbaarheid */
    color: #fff;     /* Witte kleur voor het kruisje */
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
    z-index: 1002; /* Hoger dan overlay (1000) en nav-buttons (1001) */
}

.lightbox-close:hover,
.lightbox-close:focus {
    background-color: #555;
    color: #fff;
}

/* Lightbox Navigatieknoppen */
.lightbox-nav-button {
    position: absolute; /* Positioneren t.o.v. lightbox-content */
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(51, 51, 51, 0.7); 
    color: #fff;
    border: none;
    padding: 10px 15px;
    font-size: 3rem; 
    line-height: 1;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    z-index: 10; /* Zorg dat ze boven de afbeelding liggen */
    user-select: none; 
    -webkit-tap-highlight-color: rgba(0,0,0,0); 
}

.lightbox-nav-button:hover {
    background-color: rgba(0, 0, 0, 0.9); 
}

.lightbox-prev {
    left: 10px; /* Afstand vanaf de linkerkant van de lightbox-content */
}

.lightbox-next {
    right: 10px; /* Afstand vanaf de rechterkant van de lightbox-content */
}

/* Voorkom scrollen van de body wanneer lightbox open is */
body.no-scroll {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0px);
}

/* Verbeter responsive voor algemene afbeeldingen in main content LET OP, CODE IN MBT DE MAIN CONTENT HOORT HIER NIET
main img.page-image {
    max-width: 80%;
    height: auto;
    margin-bottom: 20px;
}*/

/* ============================================== */
/* MEDIA QUERIES VOOR RESPONSIVE GEDRAG           */
/* ============================================== */

/* Mobiele aanpassingen (max-width: 768px) */
@media (max-width: 768px) {
    .lightbox-content {
        width: 95vw; 
        height: 95vh;
        padding: 10px;
    }

    .lightbox-close {
        top: 15px; /* Iets minder afstand op mobiel, maar nog steeds zichtbaar */
        right: 15px;
        font-size: 2rem;
        padding: 3px 8px; 
    }

    .lightbox-nav-button {
        font-size: 2.5rem; 
        padding: 8px 12px;
    }
    .lightbox-prev {
        left: 5px;
    }
    .lightbox-next {
        right: 5px;
    }
}