/* --- Gallery Layout --- */
.gallery-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 100px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 250px;
    grid-auto-flow: dense; /* Fills gaps automatically */
    gap: 20px;
}

.gallery-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sizing Variants for Artistic Feel */
.gallery-item.wide { grid-column: span 2; }
.gallery-item.tall { grid-row: span 2; }

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) brightness(0.8);
    transition: all 0.6s ease;
}

.gallery-item:hover img {
    filter: grayscale(0%) brightness(1);
    transform: scale(1.08);
}

/* Glow Effect on Hover */
.gallery-item:hover {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
    z-index: 2;
}

.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .item-overlay {
    opacity: 1;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox-content {
    max-width: 85%;
    max-height: 80vh;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 50px rgba(0,0,0,1);
}

.close-btn {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 40px;
    color: white;
    cursor: pointer;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: 1fr 1fr; }
    .gallery-item.wide { grid-column: span 1; }
}