/* =====================================================
 * Masonry Gallery — Easy Elements Pro
 * Pure CSS columns masonry (no JS layout, no race conditions)
 * ===================================================== */

.eel-mg {
    --eel-mg-gap:  15px;
    --eel-mg-cols: 4;
    column-count: var(--eel-mg-cols);
    column-gap:   var(--eel-mg-gap);
    width: 100%;
    box-sizing: border-box;
}

.eel-mg-item {
    display: block;
    width: 100%;
    margin: 0 0 var(--eel-mg-gap);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.eel-mg-item.eel-mg-is-hidden {
    display: none;
}

/* Fade-in for items that become visible after a filter — keeps the
 * "replace and sit" feel smooth without any spinner/dim overlay. */
@keyframes eelMgFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.eel-mg-item.eel-mg-fade-in {
    animation: eelMgFadeIn 0.35s ease forwards;
}

.eel-mg-item a {
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

/* === Image === */
.eel-mg-item img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

.eel-mg-item:hover img {
    transform: scale(1.05);
}

/* === Image wrap (overflow guard for hover scale) === */
.eel-mg-image-wrap {
    position: relative;
    overflow: hidden;
    line-height: 0;
}

/* === Hover Overlay === */
.eel-mg-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.eel-mg-item:hover .eel-mg-hover {
    opacity: 1;
}

.eel-mg-hover-text span {
    color: #fff;
    font-size: 18px;
    text-transform: capitalize;
    line-height: 1.2;
}

.eel-mg-hover-icon i,
.eel-mg-hover-icon svg {
    color: #fff;
    fill: #fff;
}

/* === Caption / Description === */
.eel-mg-caption {
    padding: 12px 0;
    line-height: 1.4;
}

.eel-mg-caption-text {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.eel-mg-description {
    font-size: 14px;
    color: #4b5563;
    margin: 6px 0 0;
}

/* "top" position places caption before image — flex-order trick on the link */
.eel-mg-caption.top {
    order: -1;
}

/* === Filter Buttons === */
.eel-mg-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 0 auto 32px;
    background: transparent;
}

.eel-mg-filter {
    position: relative;
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    padding: 9px 22px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
    border-radius: 999px;
    outline: none;
    transition: color 0.2s ease, background-color 0.2s ease,
                border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.eel-mg-filter:hover {
    color: #111827;
    border-color: #111827;
}

.eel-mg-filter.active {
    color: #111827;
    border-color: #111827;
    background-color: transparent;
}

.eel-mg-filter:focus,
.eel-mg-filter:focus-visible {
    outline: none;
    box-shadow: none;
}

/* When the gallery is busy filtering (loader shown), dim the buttons slightly */
.eel-mg-filters.is-busy .eel-mg-filter {
    pointer-events: none;
    opacity: 0.7;
}

/* === Filter Loader (overlay during filter transition) === */
.eel-mg-filter-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    margin-left: -22px;
    border-radius: 50%;
    border: 3px solid rgba(17, 24, 39, 0.12);
    border-top-color: #111827;
    animation: eelMgSpin 0.8s linear infinite;
    z-index: 5;
}

.eel-mg-filter-loader.is-active {
    display: block;
}

/* During filter transition, soften the gallery items */
.eel-mg.is-filtering {
    position: relative;
    min-height: 80px;
}

.eel-mg.is-filtering .eel-mg-item {
    opacity: 0.35;
    transition: opacity 0.25s ease;
}

/* === Search bar (Dropdown with search) === */
.eel-mg-search-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px;
    padding: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.eel-mg-search-wrapper .eel-mg-filters-dropdown {
    border: 0;
    background: transparent;
    padding: 8px 12px;
    font-size: 14px;
    color: #1f2937;
    border-right: 1px solid #e5e7eb;
    outline: none;
    cursor: pointer;
}

.eel-mg-search-input-wrapper {
    position: relative;
    flex: 1;
}

.eel-mg-search-input-wrapper .unicon-search {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
}

.eel-mg-search {
    width: 100%;
    border: 0;
    background: transparent;
    outline: none;
    padding: 8px 12px 8px 30px;
    font-size: 14px;
    color: #1f2937;
}

.eel-mg-search::placeholder {
    color: #9ca3af;
}

/* === Lightbox === */
.eel-mg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    place-items: center;
    text-align: center;
}

.eel-mg-lightbox.loading .eel-mg-lightbox-image {
    opacity: 0;
}

.eel-mg-lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    transition: opacity 0.25s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.eel-mg-close {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 32px;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    user-select: none;
}

.eel-mg-prev,
.eel-mg-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: 0;
    padding: 10px 16px;
    font-size: 22px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.eel-mg-prev { left: 20px; }
.eel-mg-next { right: 20px; }

.eel-mg-prev:hover,
.eel-mg-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.eel-mg-lightbox .eel-mg-loader {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: eelMgSpin 0.8s linear infinite;
    display: none;
}

.eel-mg-lightbox .eel-mg-loader.is-active {
    display: block;
}

@keyframes eelMgSpin {
    to { transform: rotate(360deg); }
}

/* === Responsive defaults — JS overrides via --eel-mg-cols when data-columns-* set === */
@media (max-width: 1024px) {
    .eel-mg { --eel-mg-cols: 3; }
}

@media (max-width: 767px) {
    .eel-mg { --eel-mg-cols: 2; }
}

@media (max-width: 480px) {
    .eel-mg { --eel-mg-cols: 1; }
}
