.amg-gallery {
    --amg-gap: 8px;
    --amg-columns: 3;
    --amg-cols-desktop: var(--amg-columns);
    --amg-cols-tablet: 2;
    --amg-cols-mobile: 1;
    --amg-radius: 0px;
    --amg-row-height: 240px;
    width: 100%;
    box-sizing: border-box;
}

.amg-gallery *,
.amg-gallery *::before,
.amg-gallery *::after {
    box-sizing: border-box;
}

.amg-item {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--amg-radius);
}


.amg-link {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.amg-image {
    display: block;
    width: 100%;
    max-width: none;
}

.amg-layout-grid {
    display: grid;
    grid-template-columns: repeat(var(--amg-cols-desktop), minmax(0, 1fr));
    gap: var(--amg-gap);
}

.amg-layout-grid .amg-item,
.amg-layout-grid .amg-link {
    aspect-ratio: 1 / 1;
}

.amg-layout-grid .amg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.amg-layout-masonry {
    display: grid;
    grid-template-columns: repeat(var(--amg-cols-desktop), minmax(0, 1fr));
    gap: var(--amg-gap);
    align-items: start;
    grid-auto-flow: row;
    grid-auto-rows: 8px;
}

.amg-layout-masonry .amg-item {
    margin-bottom: 0;
    align-self: start;
}

.amg-layout-masonry .amg-link {
    height: auto;
}

.amg-layout-masonry .amg-image {
    height: auto;
}

.amg-layout-single {
    display: flex;
    flex-direction: column;
    gap: var(--amg-gap);
}

.amg-layout-single .amg-image {
    height: auto;
    object-fit: contain;
}

.amg-layout-justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--amg-gap);
    align-items: flex-start;
}

.amg-layout-justified .amg-item {
    flex: 0 0 auto;
}

.amg-layout-justified .amg-link {
    display: block;
}

.amg-layout-justified .amg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.amg-caption {
    padding: 6px 2px 2px;
    font-size: 0.875em;
    line-height: 1.35;
}

.amg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.92);
    padding: 42px 56px;
}

.amg-lightbox.is-open {
    display: flex;
}

.amg-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 110px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.amg-lightbox__caption {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    max-width: min(900px, calc(100vw - 120px));
    color: #fff;
    text-align: center;
    font-size: 14px;
}

.amg-lightbox__close,
.amg-lightbox__prev,
.amg-lightbox__next {
    position: absolute;
    border: 0;
    background: rgba(0,0,0,.35);
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.amg-lightbox__close {
    top: 10px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 32px;
}

.amg-lightbox__prev,
.amg-lightbox__next {
    top: 50%;
    width: 46px;
    height: 64px;
    margin-top: -32px;
    font-size: 38px;
}

.amg-lightbox__prev { left: 6px; }
.amg-lightbox__next { right: 6px; }

body.amg-lightbox-open {
    overflow: hidden;
}

@media (max-width: 782px) {
    .amg-lightbox {
        padding: 44px 38px;
    }
}

@media (max-width: 480px) {
    .amg-lightbox {
        padding: 44px 30px;
    }
}


.amg-layout-featured {
    display: grid;
    grid-template-columns: repeat(var(--amg-cols-desktop), minmax(0, 1fr));
    gap: var(--amg-gap);
}
.amg-layout-featured .amg-item,
.amg-layout-featured .amg-link { aspect-ratio: 4 / 3; }
.amg-layout-featured .amg-image { width:100%; height:100%; object-fit:cover; }
.amg-layout-featured .amg-item:first-child { grid-column: span 2; grid-row: span 2; }
.amg-layout-featured .amg-item:first-child,
.amg-layout-featured .amg-item:first-child .amg-link { aspect-ratio:auto; min-height:100%; }

@media (max-width: 782px) {
    .amg-layout-grid, .amg-layout-featured { grid-template-columns: repeat(var(--amg-cols-tablet), minmax(0,1fr)); }
    .amg-layout-masonry { grid-template-columns: repeat(var(--amg-cols-tablet), minmax(0,1fr)); }
}
@media (max-width: 480px) {
    .amg-layout-grid, .amg-layout-featured { grid-template-columns: repeat(var(--amg-cols-mobile), minmax(0,1fr)); }
    .amg-layout-masonry { grid-template-columns: repeat(var(--amg-cols-mobile), minmax(0,1fr)); }
    .amg-layout-featured .amg-item:first-child { grid-column: span min(2, var(--amg-cols-mobile)); }
}


/* Expandable gallery: hide extras initially and place the count on the last preview photo. */
.amg-gallery-container.amg-is-collapsed .amg-item-extra { display: none; }
.amg-gallery-container .amg-item { position: relative; }
.amg-more-overlay {
    appearance: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: rgba(0, 0, 0, .48);
    color: #fff;
    font: inherit;
    font-size: clamp(1.25rem, 4vw, 2.2rem);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.amg-gallery-container:not(.amg-is-collapsed) .amg-more-overlay { display: none; }
