/*
   Expanding Image Gallery Slider
   Frontend Stylesheet
*/

.eg-gallery-wrapper {
    width: 100%;
    box-sizing: border-box;
}

/* Accordion Flexbox Gallery */
.eg-gallery-container {
    display: flex;
    gap: 16px;
    width: 100%;
    height: 560px; /* fixed height for the horizontal gallery */
    transition: all 0.5s ease;
}

/* Gallery Item / Card */
.eg-gallery-card {
    position: relative;
    flex: 1;
    height: 100%;
    border-radius: 28px; /* CSS Fallback */
    overflow: hidden;
    cursor: pointer;
    background-color: #000; /* Set to black to make sub-pixel gaps invisible */
    isolation: isolate; /* Native Safari border-radius clipping fix */
    
    /* Using cubic-bezier for a high-end, premium feel during transition */
    transition: flex 0.7s cubic-bezier(0.25, 1, 0.3, 1);
}

/* Link tag wrapper if a URL is provided */
.eg-gallery-link-wrapper {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

/* Hover & Active States */
.eg-gallery-card.active {
    flex: 5.5; /* Expands to take up the majority of the container */
    cursor: default;
}

/* Card Image */
.eg-gallery-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.3, 1);
}

.eg-gallery-card.active .eg-gallery-image {
    transform: scale(1.02); /* Very subtle zoom effect on the expanded image */
}

/* Bottom Dark Gradient Overlay for Text Readability */
.eg-gallery-overlay {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s cubic-bezier(0.25, 1, 0.3, 1);
}

.eg-gallery-card.active .eg-gallery-overlay {
    opacity: 1;
}

/* Card Content Text Container */
.eg-gallery-content {
    position: absolute;
    left: 32px;
    bottom: 32px;
    color: #ffffff;
    z-index: 2;
    pointer-events: none;
    
    /* Hide by default, slide up when active */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease 0.15s, transform 0.5s cubic-bezier(0.25, 1, 0.3, 1) 0.15s;
    white-space: nowrap; /* Prevent title wrapping issues during animations */
}

.eg-gallery-card.active .eg-gallery-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto; /* Enable clicks/taps on button and links inside active card */
}

/* Typography resets to isolate headings from global theme overrides */
.eg-gallery-content h1,
.eg-gallery-content h2,
.eg-gallery-content h3,
.eg-gallery-content h4,
.eg-gallery-content h5,
.eg-gallery-content h6,
.eg-gallery-content p,
.eg-gallery-content span,
.eg-gallery-content div {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    text-transform: none !important;
    box-sizing: border-box !important;
}

/* Category Pill text default style */
.eg-gallery-category {
    display: block !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    margin-bottom: 6px !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Card Main Title default style */
.eg-gallery-card-title {
    display: block !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Interactive Action Button styles */
.eg-gallery-button-wrapper {
    display: inline-block;
    margin-top: 18px; /* CSS Fallback */
    text-decoration: none;
    
    /* Fade and slide up transition with a small delay so it enters after headers */
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.5s ease 0.25s, transform 0.5s cubic-bezier(0.25, 1, 0.3, 1) 0.25s;
}

.eg-gallery-card.active .eg-gallery-button-wrapper {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Styled Anchor Link Button */
.eg-gallery-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important; /* Fix overlapping text distortion */
    border: none !important;
    outline: none !important;
    text-decoration: none !important; /* Ensure no theme underline */
    font-weight: 700 !important;
    cursor: pointer !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    padding: 12px 28px !important; /* Premium button padding */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.3, 1) !important, box-shadow 0.3s ease !important, background-color 0.3s ease !important;
}

.eg-gallery-btn:hover {
    transform: scale(1.04) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25) !important;
}

.eg-gallery-btn:active {
    transform: scale(0.98) !important;
}

/* Fix Dashicons display inside frontend buttons */
.eg-gallery-btn .dashicons {
    line-height: 1 !important;
    vertical-align: middle !important;
    display: inline-block !important;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Responsive Media Queries (Mobile & Tablet) */
@media (max-width: 768px) {
    /* Switch to vertical expansion on mobile */
    .eg-gallery-container {
        flex-direction: column;
        height: 680px;
        gap: 12px;
    }
    
    .eg-gallery-card {
        width: 100%;
        height: auto;
        flex: 1;
        border-radius: 20px !important; /* CSS Fallback override for mobile */
    }
    
    .eg-gallery-card.active {
        flex: 4;
    }
    
    .eg-gallery-content {
        left: 20px;
        bottom: 20px;
    }
    
    .eg-gallery-card-title {
        font-size: 22px !important; /* Slightly scale down title on mobile */
    }
    
    .eg-gallery-category {
        font-size: 9px !important; /* Slightly scale down category text on mobile */
        letter-spacing: 1.5px !important;
    }
    
    .eg-gallery-button-wrapper {
        margin-top: 12px; /* Removed !important to allow inline PHP margin values on mobile */
    }
    
    .eg-gallery-btn {
        padding: 8px 22px !important;
    }
}
