/* =============================================
   Instagram Gallery Slideshow
   ============================================= */

.instagram-gallery {
    position: relative;
    max-width: 700px;
    margin: 0 auto 2rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    background: #f5f5f5;
}

/* Loading state */
.ig-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #999;
    gap: 1rem;
}

.ig-loading i {
    font-size: 2rem;
    color: #D4A574;
    animation: ig-spin 1.2s linear infinite;
}

.ig-loading p {
    font-size: 0.95rem;
    margin: 0;
}

@keyframes ig-spin {
    to { transform: rotate(360deg); }
}

/* Viewport & Track */
.ig-gallery-viewport {
    overflow: hidden;
    position: relative;
    width: 100%;
}

.ig-gallery-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.ig-gallery-track.no-transition {
    transition: none;
}

/* Individual Slide */
.ig-slide {
    min-width: 100%;
    position: relative;
    aspect-ratio: 1;
    flex-shrink: 0;
}

.ig-slide a {
    display: block;
    width: 100%;
    height: 100%;
}

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

/* Caption overlay on hover */
.ig-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    color: #fff;
    padding: 3rem 1.5rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    /* Truncate long captions */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-slide:hover .ig-slide-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Navigation Arrows */
.ig-gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: #333;
    font-size: 1rem;
    opacity: 0;
}

.instagram-gallery:hover .ig-gallery-btn {
    opacity: 1;
}

.ig-gallery-btn:hover {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.05);
}

.ig-gallery-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.ig-prev {
    left: 12px;
}

.ig-next {
    right: 12px;
}

/* Dot Indicators */
.ig-gallery-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.ig-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.ig-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.ig-dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* Instagram branding bar */
.ig-gallery-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-top: 1px solid #eee;
}

.ig-gallery-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    font-size: 0.9rem;
    font-weight: 600;
}

.ig-gallery-bar-left i {
    font-size: 1.2rem;
    background: linear-gradient(45deg, #E1306C, #FD1D1D, #F77737, #FCAF45);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ig-gallery-bar-right {
    font-size: 0.8rem;
    color: #999;
}

/* Fallback message */
.ig-fallback {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #666;
}

.ig-fallback i {
    font-size: 3rem;
    color: #D4A574;
    margin-bottom: 1rem;
    display: block;
}

.ig-fallback p {
    margin: 0.5rem 0;
}

.ig-fallback a {
    color: #D4A574;
    font-weight: 600;
    text-decoration: none;
}

.ig-fallback a:hover {
    text-decoration: underline;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 768px) {
    .instagram-gallery {
        border-radius: 12px;
        margin: 0 auto 1.5rem;
    }

    .ig-gallery-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        opacity: 1; /* Always visible on mobile for discoverability */
    }

    .ig-prev {
        left: 8px;
    }

    .ig-next {
        right: 8px;
    }

    .ig-gallery-dots {
        bottom: 12px;
    }

    .ig-dot {
        width: 6px;
        height: 6px;
    }

    .ig-slide-caption {
        font-size: 0.8rem;
        padding: 2rem 1rem 1rem;
    }

    .ig-loading {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .instagram-gallery {
        border-radius: 8px;
    }

    .ig-gallery-bar {
        padding: 0.6rem 1rem;
    }

    .ig-gallery-bar-left {
        font-size: 0.8rem;
    }
}
