/* Image Gallery Styles - Prefixed with 'ig-' to avoid conflicts */





/* Gallery Container */
.ig-gallery {
    --gallery-columns: 2; /* Default to 2 columns - change this value to customize */
    display: grid;
    grid-template-columns: repeat(var(--gallery-columns), 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    /* This centers items within their grid cells */
    align-items: center;
}

/* Gallery Items */
.ig-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: center;
    /* Remove align-self to allow grid centering */
}

.ig-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    z-index: 5;
}

.ig-gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover; /* Changed from contain to cover for consistent container filling */
    object-position: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    border-radius: 16px; /* Add border-radius directly to image as backup */
}

.ig-gallery-item:hover img {
    /* No scaling - just keep the image as is */
}

/* Lightbox Overlay */
.ig-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

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

.ig-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    animation: ig-lightboxSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ig-lightbox img {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease-out;
    flex-shrink: 0;
}

.ig-lightbox img.ig-shake-left {
    animation: ig-shakeLeft 0.6s ease-in-out infinite;
}

.ig-lightbox img.ig-shake-right {
    animation: ig-shakeRight 0.6s ease-in-out infinite;
}

.ig-lightbox img.ig-slide-out-left {
    animation: ig-slideOutLeft 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.ig-lightbox img.ig-slide-out-right {
    animation: ig-slideOutRight 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.ig-lightbox img.ig-slide-in-from-left {
    animation: ig-slideInFromLeft 0.4s cubic-bezier(0, 0, 0.2, 1) forwards;
}

.ig-lightbox img.ig-slide-in-from-right {
    animation: ig-slideInFromRight 0.4s cubic-bezier(0, 0, 0.2, 1) forwards;
}

/* Keyframe Animations */
@keyframes ig-lightboxSlideIn {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes ig-shakeLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-2px); }
}

@keyframes ig-shakeRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(2px); }
}

@keyframes ig-slideOutLeft {
    0% { transform: translateX(0) scale(1); opacity: 1; }
    100% { transform: translateX(-100%) scale(0.8); opacity: 0; }
}

@keyframes ig-slideOutRight {
    0% { transform: translateX(0) scale(1); opacity: 1; }
    100% { transform: translateX(100%) scale(0.8); opacity: 0; }
}

@keyframes ig-slideInFromLeft {
    0% { transform: translateX(-100%) scale(0.8); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes ig-slideInFromRight {
    0% { transform: translateX(100%) scale(0.8); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}

/* Navigation Buttons */
.ig-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    font-size: 32px;
    font-weight: 300;
    width: 60px;
    height: 60px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    line-height: 1;
    padding-bottom: 8px;
    z-index: 10;
}

.ig-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
}

.ig-lightbox-prev {
    left: 30px;
}

.ig-lightbox-next {
    right: 30px;
}

/* Picture Counter */
.ig-lightbox-counter {
    position: absolute;
    bottom: 30px;
    right: 30px; /* Changed from centered to right side */
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.9;
    z-index: 10;
}

/* Caption */
.ig-lightbox-caption {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.95;
    z-index: 10;
    max-width: 70%; /* Reduced from 80% to give more space for counter */
    text-align: center;
    display: none;
    margin-top: 15px;
    margin-bottom: 60px; /* Add bottom margin to ensure space for counter */
    flex-shrink: 0;
}

.ig-lightbox-caption.ig-show {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ig-gallery {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }

    .ig-gallery-item img {
        /* Let images use their natural dimensions on mobile too */
    }

    .ig-lightbox-nav {
        font-size: 24px;
        width: 50px;
        height: 50px;
    }

    .ig-lightbox-prev {
        left: 20px;
    }

    .ig-lightbox-next {
        right: 20px;
    }

    .ig-lightbox-counter {
        bottom: 20px;
        right: 20px; /* Keep right alignment on mobile */
        font-size: 13px;
        padding: 6px 14px;
    }

    .ig-lightbox-caption {
        font-size: 14px;
        padding: 10px 16px;
        max-width: 65%; /* Reduced for mobile to avoid counter */
        margin-top: 12px;
        margin-bottom: 50px; /* Ensure space for counter on mobile */
    }
}

@media (max-width: 480px) {
    .ig-gallery {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }

    .ig-gallery-item img {
        /* Let images use their natural dimensions on small screens too */
    }

    .ig-lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .ig-lightbox-prev {
        left: 15px;
    }

    .ig-lightbox-next {
        right: 15px;
    }

    .ig-lightbox-counter {
        bottom: 15px;
        right: 15px; /* Keep right alignment on small screens */
        font-size: 12px;
        padding: 5px 12px;
    }

    .ig-lightbox-caption {
        font-size: 13px;
        padding: 8px 14px;
        max-width: 60%; /* Further reduced for small screens */
        margin-top: 10px;
        margin-bottom: 45px; /* Ensure space for counter on small screens */
    }
}