/* Base Styles - Mobile First Priority */
.gallery-main {
    padding: 0; /* Removed padding to allow header background to touch edges */
    background-color: #fff4d7;
}

.gallery-header {
   background-color: #2c5530; /* Green background to blend with navbar */
   padding: 150px 20px 30px; /* Increased top padding to clear back button */
   text-align: center;
}

.section-tag {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.15); /* Adjusted for dark background */
    color: #f97803;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.section-tag i {
    margin-right: 8px;
}

.gallery-header h1 {
    font-size: 2.2rem;
    color: white; /* White font on dark background */
    margin-bottom: 0.8rem;
    font-family: 'Playfair Display', serif;
}

.header-divider {
    width: 60px;
    height: 3px;
    background: #f97803;
    margin: 0 auto 1.5rem;
    border-radius: 2px;
}

.gallery-description {
    text-align: center;
    font-size: 1rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9); /* Off-white for description */
    font-weight: 300;
    max-width: 900px;
    margin: 0 auto; /* Keep text width contained */
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns like Instagram */
    gap: 0; /* No gaps */
    padding: 0; /* No padding */
}

.gallery-item { 
    aspect-ratio: 3 / 4; /* Portrait orientation */
    border-radius: 0; /* Square edges on mobile */
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background-color: #eae1c9;
}

/* Tablet (768px and up) */
@media (min-width: 768px) {
    .gallery-main {
        padding: 0;
    }
    .gallery-header {
        padding: 160px 5% 40px; /* Side padding applied here to match the 5% margin */
    }
    .gallery-header h1 {
        font-size: 3rem;
        margin-bottom: 1.2rem;
    }
    .gallery-description {
        font-size: 1.1rem;
        line-height: 1.6;
    }
    .gallery-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
        padding: 0 5%;
    }
    .gallery-item {
        border-radius: 0; /* Flush edges */
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .gallery-header h1 {
        font-size: 3.5rem;
        margin-bottom: 1.5rem;
    }
    .gallery-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
    }
}

.gallery-item img, .gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures images fill the square without distortion */
    display: block;
    transition: transform 0.6s ease;
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.4s ease;
    pointer-events: none;
}

.gallery-item:hover img, .gallery-item:hover video {
    transform: scale(1.05);
}

.gallery-item:hover::after {
    background: rgba(0,0,0,0.1);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    object-fit: contain;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content video, .lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

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