/**
 * Feminism Magazine - Smart Gallery System CSS
 * Grid, Masonry, Slider layouts, Lazy loading, Lightbox, Captions
 * Version: 2.0.0
 */

/* ==============================================
   GALLERY CONTAINER
   ============================================== */
.fem-gallery--grid,
.fem-gallery--masonry,
.fem-gallery--slider {
    margin: 2rem 0;
}

/* ==============================================
   GRID LAYOUT
   ============================================== */
.fem-gallery--grid {
    display: grid;
    gap: 1rem;
}

@media (max-width: 768px) {
    .fem-gallery--grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .fem-gallery--grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==============================================
   MASONRY LAYOUT
   ============================================== */
.fem-masonry {
    display: flex;
    gap: 1rem;
}

.fem-masonry__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .fem-masonry {
        flex-direction: column;
    }
}

/* ==============================================
   SLIDER LAYOUT
   ============================================== */
.fem-gallery--slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.fem-gallery__track {
    display: flex;
    transition: transform 0.4s ease;
}

.fem-gallery__slide {
    flex-shrink: 0;
    width: 100%;
}

.fem-gallery__nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
}

.fem-gallery__prev,
.fem-gallery__next {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #333;
}

.fem-gallery__prev:hover,
.fem-gallery__next:hover {
    background: #fff;
    transform: scale(1.1);
}

.fem-gallery__dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
}

.fem-gallery__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fem-gallery__dot.active {
    background: #fff;
    width: 24px;
    border-radius: 5px;
}

/* ==============================================
   GALLERY ITEM
   ============================================== */
.fem-gallery__item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: zoom-in;
    background: #f0f0f0;
}

.fem-gallery__item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.fem-gallery__item:hover img {
    transform: scale(1.05);
}

/* Blur-up placeholder */
.fem-gallery__placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    transition: opacity 0.3s ease;
}

.fem-lazy-image {
    opacity: 0;
}

.fem-lazy-image.loaded {
    opacity: 1;
}

/* ==============================================
   CAPTION OVERLAY
   ============================================== */
.fem-gallery__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    color: #fff;
    font-size: 0.875rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.fem-gallery__item:hover .fem-gallery__caption {
    transform: translateY(0);
}

.fem-gallery__caption span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fem-gallery__download {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fem-gallery__download:hover {
    background: #D4486D;
    transform: scale(1.1);
}

/* ==============================================
   LIGHTBOX
   ============================================== */
.fem-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fem-gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.fem-gallery-lightbox__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: zoom-out;
}

.fem-gallery-lightbox__image {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.fem-gallery-lightbox__close,
.fem-gallery-lightbox__download {
    position: absolute;
    z-index: 2;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.fem-gallery-lightbox__close {
    top: 20px;
    right: 20px;
}

.fem-gallery-lightbox__download {
    top: 20px;
    right: 80px;
}

.fem-gallery-lightbox__close:hover,
.fem-gallery-lightbox__download:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ==============================================
   WORDPRESS GALLERY ENHANCEMENT
   ============================================== */
.wp-block-gallery .blocks-gallery-item,
.gallery-item {
    overflow: hidden;
    border-radius: 8px;
}

.wp-block-gallery .blocks-gallery-item img,
.gallery-item img {
    transition: transform 0.3s ease;
}

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