.com-gallery-block .com-gallery-grid-thumb,
.com-gallery-block .com-gallery-masonry-thumb {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.com-gallery-block .com-gallery-grid-thumb img,
.com-gallery-block .com-gallery-masonry-thumb img {
    display: block;
    transition: transform .22s ease, filter .22s ease;
}
.com-gallery-block .com-gallery-thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.com-gallery-block .com-gallery-thumb-icon {
    font-size: 1.6rem;
    line-height: 1;
    opacity: .58;
    text-shadow: 0 2px 10px rgba(0,0,0,.7);
    transition: opacity .2s ease;
}
.com-gallery-block a:hover .com-gallery-thumb-overlay,
.com-gallery-block a:focus-visible .com-gallery-thumb-overlay,
.com-gallery-block a:focus .com-gallery-thumb-overlay {
    opacity: 1;
}
.com-gallery-block a:hover .com-gallery-grid-thumb img,
.com-gallery-block a:focus-visible .com-gallery-grid-thumb img,
.com-gallery-block a:focus .com-gallery-grid-thumb img,
.com-gallery-block a:hover .com-gallery-masonry-thumb img,
.com-gallery-block a:focus-visible .com-gallery-masonry-thumb img,
.com-gallery-block a:focus .com-gallery-masonry-thumb img {
    transform: scale(1.02);
    filter: brightness(.82);
}
.com-gallery-block a:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
.com-gallery-block .com-gallery-grid-thumb,
.com-gallery-block .com-gallery-grid-thumb img {
    aspect-ratio: 3 / 2;
}
.com-gallery-block .com-gallery-grid-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}
.com-gallery-block .com-gallery-masonry {
    column-gap: 1rem;
}
.com-gallery-block .com-gallery-masonry-item {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1rem;
}
.com-gallery-lightbox {
    --com-gallery-overlay: rgba(0,0,0,.82);
    --com-gallery-surface-strong: rgba(0,0,0,.64);
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--com-gallery-overlay);
}
.com-gallery-lightbox.is-active { display: flex; }
.com-gallery-lightbox__stage {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: min(96vw, 1600px);
    max-height: 92vh;
}
.com-gallery-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
}
.com-gallery-lightbox__meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: .875rem 1rem;
    color: #fff;
    background: linear-gradient(to top, var(--com-gallery-surface-strong), rgba(0,0,0,.52));
}
.com-gallery-lightbox__title {
    margin: 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.4;
}
.com-gallery-lightbox__caption {
    margin-top: .25rem;
    color: #fff;
    font-size: .9375rem;
    line-height: 1.4;
}
.com-gallery-lightbox__control,
.com-gallery-lightbox__close {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    text-shadow: 0 2px 8px rgba(0,0,0,.72);
    transition: opacity .18s ease, transform .18s ease;
}
.com-gallery-lightbox__control:hover,
.com-gallery-lightbox__control:focus-visible,
.com-gallery-lightbox__close:hover,
.com-gallery-lightbox__close:focus-visible {
    background: transparent;
    color: #fff;
    outline: none;
    box-shadow: none;
    text-decoration: none;
    opacity: 1;
}
.com-gallery-lightbox__control {
    top: 50%;
    transform: translateY(-50%);
    width: 4rem;
    height: 4rem;
    font-size: 2rem;
    opacity: .82;
}
.com-gallery-lightbox__control:hover,
.com-gallery-lightbox__control:focus-visible {
    transform: translateY(-50%) scale(1.06);
}
.com-gallery-lightbox__control--prev { left: .25rem; }
.com-gallery-lightbox__control--next { right: .25rem; }
.com-gallery-lightbox__close {
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
    opacity: .82;
}
.com-gallery-lightbox__caption:empty,
.com-gallery-lightbox__title:empty { display: none; }
.com-gallery-lightbox__meta.is-empty { display: none; }
@media (max-width: 767.98px) {
    .com-gallery-lightbox { padding: 0; }
    .com-gallery-lightbox__stage,
    .com-gallery-lightbox__image { max-width: 100vw; max-height: 100vh; }
    .com-gallery-lightbox__control { width: 3rem; height: 3rem; }
    .com-gallery-lightbox__close { top: .5rem; right: .5rem; }
}

.plg-content-gallery-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0 0 .5rem 0;
    color: var(--body-color, currentColor);
    opacity: .75;
    font-size: .95rem;
    line-height: 1;
    vertical-align: middle;
}

.plg-content-gallery-badge__count {
    font-size: .85em;
}

/* Context gallery spacing used by med_suite/medunits frontends. */
.com-gallery-block.com-gallery-context,
.medsuite-gallery.com-gallery-block {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.com-gallery-block.com-gallery-context + .com-gallery-block.com-gallery-context,
.medsuite-gallery.com-gallery-block + .medsuite-gallery.com-gallery-block {
    margin-top: 1.5rem;
}

/* Admin fallback for image/resource thumbnails.
   The component list must not depend on med_suite admin.css being loaded. */
.com-gallery-admin-list .medsuite-resource-thumb,
.com-gallery-context-manager .medsuite-resource-thumb,
.com-gallery-admin-thumb {
    width: 96px;
    height: 72px;
    max-width: none;
    object-fit: cover;
    border-radius: .25rem;
    border: 1px solid var(--border-color, #ddd);
    flex: 0 0 auto;
}

.com-gallery-admin-list .medsuite-resource-thumb--sm,
.com-gallery-context-manager .medsuite-resource-thumb--sm,
.com-gallery-admin-thumb--sm {
    width: 48px;
    height: 48px;
}

.com-gallery-admin-list .medsuite-resource-thumb--md,
.com-gallery-context-manager .medsuite-resource-thumb--md,
.com-gallery-admin-thumb--md {
    width: 72px;
    height: 54px;
}
