/*
 * Crystal Gallery v5.1.0
 * Structural CSS only. All selectors are scoped to the fresh v5.1 namespace.
 * Elementor controls generate their current styles directly against these classes.
 */
.crystal-gallery-v51,
.crystal-gallery-v51 * {
    box-sizing: border-box;
}

.crystal-gallery-v51 {
    --cg34-columns: 4;
    --cg34-gap: 16px;
    --cg34-height: 380px;
    --cg34-justified-height: 230px;
    --cg34-grid-fit: cover;
    --cg34-grid-position: center center;
    --cg34-custom-fit: cover;
    --cg34-custom-position: center center;
    --cg34-hover-duration: 250ms;
    --cg34-hover-scale: 1.05;
    --cg34-hover-opacity: .8;
    --cg34-lb-bg: rgba(8, 10, 14, .96);
    --cg34-lb-text: #fff;
    --cg34-lb-button: #fff;
    --cg34-lb-max-w: 92vw;
    --cg34-lb-max-h: 88vh;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

.crystal-gallery-v51-editor-empty {
    width: 100%;
    padding: 20px;
    border: 1px dashed #d5d8dc;
    border-radius: 6px;
    color: #6b7280;
    background: #fff;
    text-align: center;
    font-size: 13px;
}

/* ---------- Filters ---------- */
.crystal-gallery-v51__filters-wrap {
    width: 100%;
    min-width: 0;
    margin: 0 0 18px;
    padding: 0;
}

.crystal-gallery-v51__filters {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.crystal-gallery-v51__filter {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    max-width: 100%;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid #d5d8dc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    box-shadow: none;
    font: inherit;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.crystal-gallery-v51__filter:hover,
.crystal-gallery-v51__filter:focus-visible {
    border-color: #9ca3af;
}

.crystal-gallery-v51__filter.is-active {
    color: #fff;
    background: #111827;
    border-color: #111827;
}

.crystal-gallery-v51__filter:focus-visible,
.crystal-gallery-v51__page-button:focus-visible,
.crystal-gallery-v51__media--button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.crystal-gallery-v51__select {
    display: none;
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 8px 34px 8px 12px;
    border: 1px solid #d5d8dc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font: inherit;
    font-size: 14px;
}

/* ---------- Shared item/media ---------- */
.crystal-gallery-v51__grid {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.crystal-gallery-v51__item {
    position: relative;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    opacity: 1;
    transition: opacity .16s ease, transform var(--cg34-hover-duration) ease, filter var(--cg34-hover-duration) ease;
}

.crystal-gallery-v51__item[hidden] {
    display: none !important;
}

.crystal-gallery-v51__item.is-entering {
    opacity: 0;
}

.crystal-gallery-v51__media {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0 solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    overflow: hidden;
    text-align: inherit;
    line-height: 0;
    transition: transform var(--cg34-hover-duration) ease, box-shadow var(--cg34-hover-duration) ease, border-color var(--cg34-hover-duration) ease;
}

.crystal-gallery-v51__media--button {
    cursor: zoom-in;
}

.crystal-gallery-v51__image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    vertical-align: middle;
    transition: transform var(--cg34-hover-duration) ease, opacity var(--cg34-hover-duration) ease, filter var(--cg34-hover-duration) ease;
}

.crystal-gallery-v51__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    margin-top: 10px;
    line-height: 1.4;
}

.crystal-gallery-v51__category,
.crystal-gallery-v51__title,
.crystal-gallery-v51__caption {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.crystal-gallery-v51__category {
    display: inline-flex;
    align-self: inherit;
    color: #6b7280;
    font-size: 12px;
}

.crystal-gallery-v51__title {
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

.crystal-gallery-v51__caption {
    color: #6b7280;
    font-size: 13px;
}

/* ---------- Grid ---------- */
/*
 * Fixed-ratio Grid is a normal, predictable CSS grid. Original-ratio Grid uses
 * the same stable packed-column engine as Masonry so mixed portrait/landscape
 * images do not create giant row gaps.
 */
.crystal-gallery-v51--grid:not(.crystal-gallery-v51--ratio-original) .crystal-gallery-v51__grid,
.crystal-gallery-v51--custom-height .crystal-gallery-v51__grid {
    display: grid;
    grid-template-columns: repeat(var(--cg51-effective-columns, var(--cg34-columns)), minmax(0, 1fr));
    gap: var(--cg34-gap);
    align-items: start;
}

.crystal-gallery-v51--ratio-1-1 .crystal-gallery-v51__media { aspect-ratio: 1 / 1; }
.crystal-gallery-v51--ratio-4-3 .crystal-gallery-v51__media { aspect-ratio: 4 / 3; }
.crystal-gallery-v51--ratio-3-2 .crystal-gallery-v51__media { aspect-ratio: 3 / 2; }
.crystal-gallery-v51--ratio-16-9 .crystal-gallery-v51__media { aspect-ratio: 16 / 9; }
.crystal-gallery-v51--ratio-9-16 .crystal-gallery-v51__media { aspect-ratio: 9 / 16; }

.crystal-gallery-v51--grid:not(.crystal-gallery-v51--ratio-original) .crystal-gallery-v51__image {
    width: 100%;
    height: 100%;
    object-fit: var(--cg34-grid-fit);
    object-position: var(--cg34-grid-position);
}

/* ---------- Custom height ---------- */
.crystal-gallery-v51--custom-height .crystal-gallery-v51__media {
    height: var(--cg34-height);
}

.crystal-gallery-v51--custom-height .crystal-gallery-v51__image {
    width: 100%;
    height: 100%;
    object-fit: var(--cg34-custom-fit);
    object-position: var(--cg34-custom-position);
}

/* ---------- Stable dynamic natural-ratio layouts ---------- */
.crystal-gallery-v51--masonry:not(.is-layout-ready) .crystal-gallery-v51__grid,
.crystal-gallery-v51--justified:not(.is-layout-ready) .crystal-gallery-v51__grid,
.crystal-gallery-v51--grid.crystal-gallery-v51--ratio-original:not(.is-layout-ready) .crystal-gallery-v51__grid {
    visibility: hidden;
    min-height: 1px;
}

.crystal-gallery-v51--masonry.is-layout-ready .crystal-gallery-v51__grid,
.crystal-gallery-v51--justified.is-layout-ready .crystal-gallery-v51__grid,
.crystal-gallery-v51--grid.crystal-gallery-v51--ratio-original.is-layout-ready .crystal-gallery-v51__grid {
    display: block;
    position: relative;
    visibility: visible;
}

.crystal-gallery-v51--masonry.is-layout-ready .crystal-gallery-v51__item,
.crystal-gallery-v51--justified.is-layout-ready .crystal-gallery-v51__item,
.crystal-gallery-v51--grid.crystal-gallery-v51--ratio-original.is-layout-ready .crystal-gallery-v51__item {
    position: absolute;
    margin: 0;
}

.crystal-gallery-v51--masonry.is-layout-ready .crystal-gallery-v51__image,
.crystal-gallery-v51--justified.is-layout-ready .crystal-gallery-v51__image,
.crystal-gallery-v51--grid.crystal-gallery-v51--ratio-original.is-layout-ready .crystal-gallery-v51__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Natural-ratio boxes are calculated from attachment dimensions before paint. */
.crystal-gallery-v51--masonry.is-layout-ready .crystal-gallery-v51__media,
.crystal-gallery-v51--grid.crystal-gallery-v51--ratio-original.is-layout-ready .crystal-gallery-v51__media {
    width: 100%;
}

/* Justified rows are positioned explicitly by JS. No width/height transitions:
 * this is intentional and prevents visible resize oscillation/shaking. */
.crystal-gallery-v51--justified.is-layout-ready .crystal-gallery-v51__media {
    width: 100%;
}

/* ---------- Hover effects ---------- */
.crystal-gallery-v51--hover-zoom .crystal-gallery-v51__item:hover .crystal-gallery-v51__image {
    transform: scale(var(--cg34-hover-scale));
}

.crystal-gallery-v51--hover-fade .crystal-gallery-v51__item:hover .crystal-gallery-v51__image {
    opacity: var(--cg34-hover-opacity);
}

.crystal-gallery-v51--hover-lift .crystal-gallery-v51__item:hover {
    transform: translateY(-4px);
}

.crystal-gallery-v51--hover-grayscale .crystal-gallery-v51__image {
    filter: grayscale(1);
}

.crystal-gallery-v51--hover-grayscale .crystal-gallery-v51__item:hover .crystal-gallery-v51__image {
    filter: grayscale(0);
}

/* ---------- Pagination ---------- */
.crystal-gallery-v51__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    min-width: 0;
    margin: 22px 0 0;
    padding: 0;
}

.crystal-gallery-v51__pagination:empty {
    display: none;
}

.crystal-gallery-v51__page-button {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid #d5d8dc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    box-shadow: none;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.crystal-gallery-v51__page-button:hover:not(:disabled) {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.crystal-gallery-v51__page-button.is-active {
    color: #fff;
    background: #111827;
    border-color: #111827;
}

.crystal-gallery-v51__page-button:disabled {
    opacity: .38;
    cursor: not-allowed;
    transform: none;
}

.crystal-gallery-v51__page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    min-height: 38px;
    color: #6b7280;
    line-height: 1;
}

.crystal-gallery-v51__status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Mobile filter modes ---------- */
@media (max-width: 767px) {
    .crystal-gallery-v51 {
        max-width: 100%;
        overflow-x: clip;
    }

    .crystal-gallery-v51--mobile-scroll .crystal-gallery-v51__filters {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100%;
        padding-bottom: 4px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .crystal-gallery-v51--mobile-scroll .crystal-gallery-v51__filter {
        flex: 0 0 auto;
    }

    .crystal-gallery-v51--mobile-wrap .crystal-gallery-v51__filters {
        flex-wrap: wrap;
    }

    .crystal-gallery-v51--mobile-dropdown .crystal-gallery-v51__filters {
        display: none;
    }

    .crystal-gallery-v51--mobile-dropdown .crystal-gallery-v51__select {
        display: block;
    }

    .crystal-gallery-v51__page-button {
        min-width: 40px;
        min-height: 40px;
    }
}

@media (max-width: 575px) {
    .crystal-gallery-v51__filters-wrap {
        margin-bottom: 14px;
    }

    .crystal-gallery-v51__filter {
        min-height: 34px;
        padding: 7px 11px;
        font-size: 12px;
    }

    .crystal-gallery-v51__content {
        margin-top: 8px;
    }
}

@media (max-width: 420px) {
    .crystal-gallery-v51__pagination {
        gap: 5px;
    }

    .crystal-gallery-v51__page-button {
        min-width: 38px;
        min-height: 38px;
        padding: 7px 10px;
    }
}

@media (max-width: 360px) {
    .crystal-gallery-v51__filter {
        padding-left: 9px;
        padding-right: 9px;
    }
}

/* ---------- Lightbox ---------- */
html.crystal-gallery-v51-lightbox-open,
body.crystal-gallery-v51-lightbox-open {
    overflow: hidden;
}

.crystal-gallery-v51-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: clamp(14px, 3vw, 34px);
    background: var(--cg34-lb-bg, rgba(8,10,14,.96));
    color: var(--cg34-lb-text, #fff);
}

.crystal-gallery-v51-lightbox.is-open {
    display: flex;
}

.crystal-gallery-v51-lightbox__dialog {
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    outline: 0;
}

.crystal-gallery-v51-lightbox__stage {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

.crystal-gallery-v51-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: var(--cg34-lb-max-w, 92vw);
    max-height: var(--cg34-lb-max-h, 88vh);
    object-fit: contain;
}

.crystal-gallery-v51-lightbox__close,
.crystal-gallery-v51-lightbox__prev,
.crystal-gallery-v51-lightbox__next {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--cg34-lb-button, #fff);
    box-shadow: none;
    cursor: pointer;
}

.crystal-gallery-v51-lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: 44px;
    height: 44px;
    font-size: 34px;
    line-height: 1;
}

.crystal-gallery-v51-lightbox__prev,
.crystal-gallery-v51-lightbox__next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 60px;
    font-size: 46px;
    line-height: 1;
}

.crystal-gallery-v51-lightbox__prev { grid-column: 1; grid-row: 1; }
.crystal-gallery-v51-lightbox__next { grid-column: 3; grid-row: 1; }

.crystal-gallery-v51-lightbox__meta {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: min(760px, 100%);
    margin: 10px auto 0;
    text-align: center;
}

.crystal-gallery-v51-lightbox__title {
    font-size: 16px;
    font-weight: 600;
}

.crystal-gallery-v51-lightbox__caption {
    margin-top: 4px;
    opacity: .78;
    font-size: 13px;
}

@media (max-width: 575px) {
    .crystal-gallery-v51-lightbox {
        padding: 10px;
    }

    .crystal-gallery-v51-lightbox__dialog {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
    }

    .crystal-gallery-v51-lightbox__prev,
    .crystal-gallery-v51-lightbox__next {
        width: 38px;
        height: 52px;
        font-size: 38px;
    }

    .crystal-gallery-v51-lightbox__close {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    .crystal-gallery-v51-lightbox__image {
        max-width: min(var(--cg34-lb-max-w, 94vw), 94vw);
        max-height: min(var(--cg34-lb-max-h, 82vh), 82vh);
    }
}

@media (prefers-reduced-motion: reduce) {
    .crystal-gallery-v51__item,
    .crystal-gallery-v51__image,
    .crystal-gallery-v51__media,
    .crystal-gallery-v51__filter,
    .crystal-gallery-v51__page-button,
    .crystal-gallery-v51--masonry.is-layout-ready .crystal-gallery-v51__grid {
        transition-duration: .01ms;
    }
}
