/**
 * BW Gallery Frontend Styles
 */

.bwg-gallery {
    margin: 20px 0;
    /* Typography inheritance - no font-family specified */
}

/* Tabs Navigation */
.bwg-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.bwg-tab-button {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 1em; /* Relative sizing */
    line-height: inherit;
    font-family: inherit; /* Explicit inheritance */
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.bwg-tab-button:hover {
    color: #333;
    background-color: #f5f5f5;
}

.bwg-tab-button.active {
    color: #333;
    font-weight: bold;
    border-bottom-color: #333;
}

/* Tab Content */
.bwg-tab-content {
    display: none;
}

.bwg-tab-content.active {
    display: block;
}

/* Images Grid */
.bwg-images-grid {
    display: grid;
    gap: var(--bwg-gap, 10px);
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.bwg-columns-1 .bwg-images-grid {
    grid-template-columns: 1fr;
}

.bwg-columns-2 .bwg-images-grid {
    grid-template-columns: repeat(2, 1fr);
}

.bwg-columns-3 .bwg-images-grid {
    grid-template-columns: repeat(3, 1fr);
}

.bwg-columns-4 .bwg-images-grid {
    grid-template-columns: repeat(4, 1fr);
}

.bwg-columns-5 .bwg-images-grid {
    grid-template-columns: repeat(5, 1fr);
}

.bwg-columns-6 .bwg-images-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Gallery Items */
.bwg-gallery-item {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    /* No border-radius for clean edges */
    aspect-ratio: 1 / 1; /* Maintain square aspect ratio to prevent shifts */
}

.bwg-gallery-link {
    display: block;
    position: relative;
    cursor: pointer;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Contain the zoom effect */
}

.bwg-gallery-link img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure images fill container */
    display: block;
    transition: transform 0.3s ease;
    will-change: transform; /* Optimize for animations */
}

.bwg-gallery-link:hover img {
    transform: scale(1.1); /* Zoom effect on image only */
}

/* Captions */
.bwg-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px;
    font-size: 0.875em; /* Relative sizing */
    font-family: inherit;
    line-height: 1.4;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 2; /* Ensure caption is above image */
}

.bwg-gallery-link:hover .bwg-caption {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .bwg-columns-4 .bwg-images-grid,
    .bwg-columns-5 .bwg-images-grid,
    .bwg-columns-6 .bwg-images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bwg-columns-3 .bwg-images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bwg-tab-button {
        font-size: 0.875em; /* Relative sizing */
        padding: 8px 15px;
    }
}

@media (max-width: 480px) {
    .bwg-columns-2 .bwg-images-grid,
    .bwg-columns-3 .bwg-images-grid,
    .bwg-columns-4 .bwg-images-grid,
    .bwg-columns-5 .bwg-images-grid,
    .bwg-columns-6 .bwg-images-grid {
        grid-template-columns: 1fr;
    }
}