/**
 * Gallery Lightbox Styles
 * PhotoSwipe integration and thumbnail navigation
 */

/* Gallery block enhancements */
.wp-block-gallery {
    margin-bottom: 2rem;
}

.wp-block-gallery figure.wp-block-image {
    cursor: pointer;
    transition: opacity 0.3s ease;
    position: relative;
}

.wp-block-gallery figure.wp-block-image:hover {
    opacity: 0.8;
}

.wp-block-gallery figure.wp-block-image::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 8px;
    border-radius: 50%;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wp-block-gallery figure.wp-block-image:hover::after {
    opacity: 1;
}

/* Thumbnail Navigation */
.gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.gallery-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
}

.gallery-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #007cba;
}

.gallery-thumb.active {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.3);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* PhotoSwipe Customizations */
.pswp {
    z-index: 999999;
}

.pswp__bg {
    background: rgba(0, 0, 0, 0.9);
}

.pswp__counter {
    color: white;
    font-size: 14px;
    padding: 20px;
}

.pswp__button {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    transition: background 0.3s ease;
}

.pswp__button:hover {
    background: rgba(0, 0, 0, 0.5);
}

.pswp__button--arrow--left,
.pswp__button--arrow--right {
    background: rgba(0, 0, 0, 0.3);
}

.pswp__button--arrow--left:hover,
.pswp__button--arrow--right:hover {
    background: rgba(0, 0, 0, 0.5);
}

.pswp__caption {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 20px;
    font-size: 14px;
    line-height: 1.4;
}

.pswp__caption__center {
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-thumbnails {
        gap: 8px;
        padding: 10px;
    }
    
    .gallery-thumb {
        width: 60px;
        height: 60px;
    }
    
    .pswp__button {
        width: 40px;
        height: 40px;
    }
    
    .pswp__counter {
        padding: 15px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-thumbnails {
        gap: 6px;
        padding: 8px;
    }
    
    .gallery-thumb {
        width: 50px;
        height: 50px;
    }
    
    .pswp__button {
        width: 36px;
        height: 36px;
    }
}

/* Loading animation for thumbnails */
.gallery-thumb img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-thumb img.loaded {
    opacity: 1;
}

/* Gallery block specific enhancements */
.wp-block-gallery.is-style-default {
    gap: 1rem;
}

.wp-block-gallery.is-style-default figure.wp-block-image {
    margin: 0;
}

/* Focus states for accessibility */
.wp-block-gallery figure.wp-block-image:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.gallery-thumb:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .gallery-thumbnails,
    .pswp {
        display: none !important;
    }
    
    .wp-block-gallery figure.wp-block-image::after {
        display: none;
    }
}
