/**
 * DevMuse Gallery structural styles.
 *
 * Themes may override these low-specificity rules or disable this stylesheet
 * with the devmuse_gallery_enqueue_default_styles filter.
 */

:where(.dm-gallery) {
    --dm-gallery-columns: 3;
    --dm-gallery-gap: clamp(0.5rem, 1.5vw, 1.25rem);
    --dm-gallery-radius: 0;
    --dm-gallery-item-ratio: 4 / 3;
    --dm-gallery-caption-color: currentColor;
    --dm-gallery-overlay-color: rgb(5 8 14 / 96%);
    display: block;
}

:where(.dm-gallery__header) {
    margin-block-end: clamp(1.5rem, 4vw, 3rem);
    max-width: 48rem;
}

:where(.dm-gallery__title, .dm-gallery__section-title) {
    margin-block: 0 0.5rem;
}

:where(.dm-gallery__introduction, .dm-gallery__section-description) > :first-child {
    margin-block-start: 0;
}

:where(.dm-gallery__introduction, .dm-gallery__section-description) > :last-child {
    margin-block-end: 0;
}

:where(.dm-gallery__sections) {
    display: grid;
    gap: clamp(2.5rem, 6vw, 5rem);
}

:where(.dm-gallery__section-header) {
    margin-block-end: clamp(1rem, 2vw, 1.5rem);
    max-width: 48rem;
}

:where(.dm-gallery__grid) {
    display: grid;
    grid-template-columns: repeat(var(--dm-gallery-columns), minmax(0, 1fr));
    gap: var(--dm-gallery-gap);
}

:where(.dm-gallery__item) {
    min-width: 0;
    margin: 0;
}

:where(.dm-gallery__open) {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: var(--dm-gallery-radius);
    cursor: zoom-in;
}

:where(.dm-gallery__open:focus-visible) {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

:where(.dm-gallery__image) {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--dm-gallery-radius);
}

:where(.dm-gallery__section--grid .dm-gallery__image, .dm-gallery__section--editorial .dm-gallery__image) {
    aspect-ratio: var(--dm-gallery-item-ratio);
    object-fit: cover;
}

:where(.dm-gallery__section--editorial .dm-gallery__item:first-child) {
    grid-column: span 2;
    grid-row: span 2;
}

:where(.dm-gallery__section--editorial .dm-gallery__item:first-child .dm-gallery__image) {
    height: 100%;
}

:where(.dm-gallery__caption) {
    margin-block-start: 0.55rem;
    color: var(--dm-gallery-caption-color);
    font-size: 0.875em;
    line-height: 1.45;
}

:where(.dm-gallery-lightbox) {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
}

:where(.dm-gallery-lightbox[open]) {
    display: grid;
    place-items: center;
}

:where(.dm-gallery-lightbox::backdrop) {
    background: var(--dm-gallery-overlay-color, rgb(5 8 14 / 96%));
}

:where(.dm-gallery-lightbox__frame) {
    position: relative;
    display: grid;
    grid-template-columns: minmax(2.75rem, 5vw) minmax(0, 1fr) minmax(2.75rem, 5vw);
    align-items: center;
    width: 100%;
    height: 100%;
    padding: clamp(1rem, 3vw, 2rem);
    background: var(--dm-gallery-overlay-color, rgb(5 8 14 / 96%));
}

:where(.dm-gallery-lightbox__figure) {
    display: grid;
    place-items: center;
    align-content: center;
    max-width: min(86vw, 100rem);
    height: calc(100vh - 5rem);
    margin: auto;
}

:where(.dm-gallery-lightbox__image) {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    object-fit: contain;
}

:where(.dm-gallery-lightbox__caption) {
    max-width: 52rem;
    margin-block-start: 0.85rem;
    color: rgb(255 255 255 / 82%);
    text-align: center;
}

:where(.dm-gallery-lightbox__close, .dm-gallery-lightbox__previous, .dm-gallery-lightbox__next) {
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    color: #fff;
    background: rgb(255 255 255 / 10%);
    border: 1px solid rgb(255 255 255 / 28%);
    border-radius: 50%;
    font: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}

:where(.dm-gallery-lightbox__close:hover, .dm-gallery-lightbox__previous:hover, .dm-gallery-lightbox__next:hover) {
    background: rgb(255 255 255 / 20%);
}

:where(.dm-gallery-lightbox__close:focus-visible, .dm-gallery-lightbox__previous:focus-visible, .dm-gallery-lightbox__next:focus-visible) {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

:where(.dm-gallery-lightbox__close) {
    position: absolute;
    inset-block-start: clamp(1rem, 3vw, 2rem);
    inset-inline-end: clamp(1rem, 3vw, 2rem);
    font-size: 1.75rem;
}

:where(.dm-gallery-lightbox__counter) {
    position: absolute;
    inset-block-end: 1rem;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    color: rgb(255 255 255 / 72%);
    font-variant-numeric: tabular-nums;
}

:where(.dm-gallery-lightbox-open) {
    overflow: hidden;
}

@media (max-width: 760px) {
    :where(.dm-gallery__grid) {
        grid-template-columns: repeat(min(var(--dm-gallery-columns), 2), minmax(0, 1fr));
    }

    :where(.dm-gallery__section--editorial .dm-gallery__item:first-child) {
        grid-column: span 2;
        grid-row: auto;
    }

    :where(.dm-gallery-lightbox__frame) {
        grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
        padding-inline: 0.25rem;
    }
}

@media (max-width: 480px) {
    :where(.dm-gallery__grid) {
        grid-template-columns: 1fr;
    }

    :where(.dm-gallery__section--editorial .dm-gallery__item:first-child) {
        grid-column: auto;
    }
}

@media (prefers-reduced-motion: no-preference) {
    :where(.dm-gallery__open .dm-gallery__image) {
        transition: transform 180ms ease, filter 180ms ease;
    }

    :where(.dm-gallery__open:hover .dm-gallery__image) {
        transform: scale(1.015);
        filter: brightness(0.92);
    }
}

