.gallery-anaplast-1 {
    width: 100%;
    padding: var(--apl-space-7) 0;
    background-color: var(--apl-surface);
    container-type: inline-size;
}
.gallery-anaplast-1 .content-wrapper {
    max-width: var(--apl-container);
    margin: 0 auto;
    padding-inline: var(--apl-gutter);
}
.gallery-anaplast-1__title {
    margin: 0 0 var(--apl-space-4);
    font-size: var(--apl-text-2xl);
    font-weight: 800;
    line-height: var(--apl-leading-tight);
    color: var(--heading-color);
}
.gallery-anaplast-1__grid {
    display: grid;
    gap: var(--apl-space-2);
}
.gallery-anaplast-1__grid--cols-2 {
    grid-template-columns: repeat(2, 1fr);
}
.gallery-anaplast-1__grid--cols-3 {
    grid-template-columns: repeat(3, 1fr);
}
.gallery-anaplast-1__grid--cols-4 {
    grid-template-columns: repeat(4, 1fr);
}
.gallery-anaplast-1__item {
    padding: 0;
    border: 1px solid var(--apl-border);
    background: var(--apl-surface-alt);
    cursor: pointer;
    border-radius: var(--apl-radius-md);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    transition:
        border-color var(--apl-transition),
        box-shadow var(--apl-transition);
}
.gallery-anaplast-1__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-anaplast-1__item:hover {
    border-color: var(--apl-accent);
    box-shadow: var(--apl-shadow-md);
}
.gallery-anaplast-1__item:focus-visible {
    outline: var(--apl-focus);
    outline-offset: var(--apl-focus-offset);
}

/* --- Lightbox --- */
.gallery-anaplast-1__lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--apl-space-4);
    background: var(--apl-overlay-strong);
}
.gallery-anaplast-1__lightbox[hidden] {
    display: none;
}
.gallery-anaplast-1__lb-figure {
    margin: 0;
    max-width: min(100%, 70rem);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--apl-space-2);
}
.gallery-anaplast-1__lb-figure img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--apl-radius-sm);
    box-shadow: var(--apl-shadow-lg);
}
.gallery-anaplast-1__lb-figure figcaption {
    color: rgba(255, 255, 255, 0.88);
    font-size: var(--apl-text-sm);
    text-align: center;
}
.gallery-anaplast-1__lb-figure figcaption:empty {
    display: none;
}
.gallery-anaplast-1__lb-close,
.gallery-anaplast-1__lb-prev,
.gallery-anaplast-1__lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--apl-control-min);
    height: var(--apl-control-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--apl-radius-pill);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--apl-transition);
}
.gallery-anaplast-1__lb-close:hover,
.gallery-anaplast-1__lb-prev:hover,
.gallery-anaplast-1__lb-next:hover {
    background: rgba(255, 255, 255, 0.28);
}
.gallery-anaplast-1__lb-close:focus-visible,
.gallery-anaplast-1__lb-prev:focus-visible,
.gallery-anaplast-1__lb-next:focus-visible {
    outline: 3px solid var(--apl-amber);
    outline-offset: var(--apl-focus-offset);
}
.gallery-anaplast-1__lb-close {
    top: var(--apl-space-3);
    right: var(--apl-space-3);
    transform: none;
    font-size: 1.25rem;
}
.gallery-anaplast-1__lb-prev {
    left: var(--apl-space-3);
}
.gallery-anaplast-1__lb-next {
    right: var(--apl-space-3);
}

@container (width < 60rem) {
    .gallery-anaplast-1__grid--cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}
@container (width < 40rem) {
    .gallery-anaplast-1 {
        padding: var(--apl-space-5) 0;
    }
    .gallery-anaplast-1__grid--cols-3,
    .gallery-anaplast-1__grid--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}
