/* Bernz Social Feed Styles - Fixed Footer Issues */
.bernz-social-feed {
    width: 100%;
    margin: 40px 0;
    position: relative;
    /* No z-index - let it flow naturally in the document */
    z-index: auto;
}

.bernz-feed-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.bernz-feed-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    /* Use padding for aspect ratio instead of height */
    width: 100%;
    padding-bottom: 125%; /* 4:5 aspect ratio */
}

.bernz-feed-item a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.bernz-feed-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.5s ease;
    display: block;
}

/* Hover effect */
.bernz-feed-item:hover img {
    transform: scale(1.1);
}

/* Gradient overlay */
.bernz-feed-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    pointer-events: none;
}

.bernz-feed-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: white;
    padding: 15px;
    font-size: 14px;
    line-height: 1.4;
    z-index: 2; /* Only for text above gradient */
}

/* Responsive Design */
@media (max-width: 1024px) {
    .bernz-feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .bernz-feed-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .bernz-feed-item::after {
        height: 35%;
    }
    
    .bernz-feed-caption {
        padding: 12px;
        font-size: 13px;
    }
}

/* Elementor-specific fixes - Minimal and safe */
.elementor .bernz-social-feed {
    z-index: 1; /* Low z-index to stay in normal flow */
    margin-bottom: 60px; /* Ensure space for footer */
}

.elementor-section .bernz-social-feed {
    overflow: visible; /* Prevent clipping in Elementor sections */
}

/* Ensure footer is visible in mobile view */
@media (max-width: 640px) {
    .elementor .elementor-section,
    .elementor-page .elementor-section {
        position: relative;
        z-index: auto;
    }
    
    .elementor .elementor-section + .elementor-section,
    .elementor-page .elementor-section + .elementor-section {
        margin-top: 0 !important; /* Remove any negative margins */
    }
}

/* Fix for footer visibility */
footer, 
.footer, 
.site-footer, 
#footer {
    position: relative;
    z-index: 5; /* Higher than feed but not excessive */
    background: #fff; /* Ensure footer has solid background */
}

/* Ensure content flows naturally after feed */
.content-after-feed {
    clear: both;
    position: relative;
    z-index: 2;
}