/* Header styling */
.category-header {
    padding-top: 180px;
    padding-bottom: 60px;
    text-align: center;
    background: linear-gradient(to bottom, rgba(250,248,244,0.8), transparent);
}

.category-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    margin-top: 10px;
}

/* The "Mind-Blowing" Masonry Grid */
.thobe-gallery {
    padding: 20px 9% 100px;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 300px;
    grid-auto-flow: dense; /* Fills gaps automatically */
    gap: 20px;
}

.gallery-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: var(--dark);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Grid Spanning Logic */
.gallery-item.large {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item.tall {
    grid-row: span 2;
}

.gallery-item.wide {
    grid-column: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

/* Hover Effects */
.gallery-item:hover img {
    transform: scale(1.1);
}

.item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(17,17,17,0.8) 0%, transparent 60%);
    opacity: 0;
    display: flex;
    align-items: flex-end;
    padding: 30px;
    transition: all 0.4s ease;
}

.gallery-item:hover .item-overlay {
    opacity: 1;
}

.overlay-text {
    transform: translateY(20px);
    transition: 0.5s ease;
}

.gallery-item:hover .overlay-text {
    transform: translateY(0);
}

.overlay-text h3 {
    color: var(--gold);
    font-family: 'Playfair Display';
    font-size: 22px;
}

.overlay-text p {
    color: #eee;
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .gallery-container {
        grid-template-columns: 1fr;
        grid-auto-rows: 400px;
    }
    .gallery-item.large, .gallery-item.wide, .gallery-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }
    .category-header h1 {
        font-size: 2.5rem;
    }
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 17, 17, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s ease;
}

.lightbox.visible {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 80%;
    max-height: 80vh;
    text-align: center;
    position: relative;
}

#lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 2px solid var(--gold);
}

#lightbox-caption {
    color: var(--gold);
    margin-top: 15px;
    font-family: 'Playfair Display';
    font-size: 24px;
}

/* Nav Buttons */
.nav-btn {
    position: absolute;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 20px;
    transition: 0.3s;
    z-index: 2100;
}

.nav-btn:hover { color: var(--gold); }
.prev-btn { left: 20px; }
.next-btn { right: 20px; }

.close-lightbox {
    position: absolute;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

/* MOBILE ADJUSTMENTS */
@media (max-width: 768px) {
    .lightbox-content { max-width: 95%; }
    .nav-btn {
        bottom: 20px;
        font-size: 24px;
        background: rgba(255,255,255,0.1);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .prev-btn { left: 30%; }
    .next-btn { right: 30%; }
    #lightbox-caption { font-size: 18px; }
}