/**
 * JoomTheme Gallery module frontend styles.
 * Scoped to the module and intentionally independent from a site template.
 */

.mod-jtgallery {
    --mod-jtgallery-columns: 4;
    --mod-jtgallery-gap: 1rem;
    --mod-jtgallery-radius: .5rem;
    --mod-jtgallery-border: color-mix(in srgb, currentColor 18%, transparent);
    --mod-jtgallery-muted: color-mix(in srgb, currentColor 68%, transparent);
}

.mod-jtgallery-columns-2 {
    --mod-jtgallery-columns: 2;
}

.mod-jtgallery-columns-3 {
    --mod-jtgallery-columns: 3;
}

.mod-jtgallery-columns-4 {
    --mod-jtgallery-columns: 4;
}

.mod-jtgallery-columns-5 {
    --mod-jtgallery-columns: 5;
}

.mod-jtgallery-columns-6 {
    --mod-jtgallery-columns: 6;
}

.mod-jtgallery-header {
    margin-block-end: 1rem;
}

.mod-jtgallery-title,
.mod-jtgallery-description,
.mod-jtgallery-footer,
.mod-jtgallery-empty {
    margin-block-start: 0;
}

.mod-jtgallery-title {
    margin-block-end: .35rem;
    font-size: 1.35rem;
}

.mod-jtgallery-title a {
    color: inherit;
    text-decoration-thickness: .08em;
    text-underline-offset: .16em;
}

.mod-jtgallery-description {
    margin-block-end: 0;
    color: var(--mod-jtgallery-muted);
}

.mod-jtgallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--mod-jtgallery-columns), minmax(0, 1fr));
    gap: var(--mod-jtgallery-gap);
}

.mod-jtgallery-item {
    min-width: 0;
    margin: 0;
}

.mod-jtgallery-image-link {
    display: block;
    overflow: hidden;
    border: 1px solid var(--mod-jtgallery-border);
    border-radius: var(--mod-jtgallery-radius);
    background: color-mix(in srgb, currentColor 5%, transparent);
}

.mod-jtgallery-image {
    display: block;
    width: 100%;
    height: auto;
}

.mod-jtgallery-ratio-4-3 .mod-jtgallery-image {
    aspect-ratio: 4 / 3;
}

.mod-jtgallery-ratio-3-2 .mod-jtgallery-image {
    aspect-ratio: 3 / 2;
}

.mod-jtgallery-ratio-1-1 .mod-jtgallery-image {
    aspect-ratio: 1 / 1;
}

.mod-jtgallery-fit-cover .mod-jtgallery-image {
    object-fit: cover;
}

.mod-jtgallery-fit-contain .mod-jtgallery-image {
    object-fit: contain;
}

.mod-jtgallery-caption {
    padding-block-start: .45rem;
    color: var(--mod-jtgallery-muted);
    font-size: .875rem;
    line-height: 1.4;
}

.mod-jtgallery-footer {
    margin-block: 1rem 0;
}

.mod-jtgallery-view-link {
    font-weight: 600;
    text-underline-offset: .16em;
}

.mod-jtgallery-empty {
    margin-block-end: 0;
    color: var(--mod-jtgallery-muted);
}

.mod-jtgallery-lightbox {
    width: min(94vw, 96rem);
    height: min(92dvh, 64rem);
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--mod-jtgallery-radius);
    color: #fff;
    background: #20252b;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 24%);
}

.mod-jtgallery-lightbox::backdrop {
    background: rgb(0 0 0 / 50%);
    backdrop-filter: blur(1.5px);
}

.mod-jtgallery-lightbox-shell {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.mod-jtgallery-lightbox-stage {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 3.75rem 4.75rem 1rem;
    touch-action: pan-y;
    user-select: none;
    place-items: center;
}

.mod-jtgallery-lightbox-image {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}

.mod-jtgallery-lightbox-toolbar {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.25rem;
    padding: .8rem 1.1rem;
    border-top: 1px solid rgb(255 255 255 / 14%);
    background: rgb(31 35 40 / 97%);
}

.mod-jtgallery-lightbox-caption {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: rgb(255 255 255 / 88%);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mod-jtgallery-lightbox-counter {
    flex: 0 0 auto;
    color: rgb(255 255 255 / 72%);
    font-variant-numeric: tabular-nums;
}

.mod-jtgallery-lightbox-button {
    position: absolute;
    z-index: 4;
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 22%);
    border-radius: 999px;
    color: #fff;
    background: rgb(0 0 0 / 36%);
    cursor: pointer;
    place-items: center;
}

.mod-jtgallery-lightbox-button svg {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    pointer-events: none;
}

.mod-jtgallery-lightbox-button:hover,
.mod-jtgallery-lightbox-button:focus-visible {
    background: rgb(0 0 0 / 64%);
}

.mod-jtgallery-lightbox-button:focus-visible {
    outline: .2rem solid #fff;
    outline-offset: .15rem;
}

.mod-jtgallery-lightbox-close {
    top: .75rem;
    right: .75rem;
}

.mod-jtgallery-lightbox-close svg {
    width: 1.15rem;
    height: 1.15rem;
}

.mod-jtgallery-lightbox-previous,
.mod-jtgallery-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
}

.mod-jtgallery-lightbox-previous {
    left: .75rem;
}

.mod-jtgallery-lightbox-next {
    right: .75rem;
}

@media (max-width: 991.98px) {
    .mod-jtgallery-columns-4,
    .mod-jtgallery-columns-5,
    .mod-jtgallery-columns-6 {
        --mod-jtgallery-columns: 3;
    }
}

@media (max-width: 575.98px) {
    .mod-jtgallery {
        --mod-jtgallery-columns: 2;
        --mod-jtgallery-gap: .65rem;
    }

    .mod-jtgallery-lightbox {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .mod-jtgallery-lightbox-stage {
        padding: 3.75rem 3.25rem .75rem;
    }

    .mod-jtgallery-lightbox-toolbar {
        align-items: flex-start;
        min-height: 4.5rem;
    }

    .mod-jtgallery-lightbox-caption {
        white-space: normal;
    }

    .mod-jtgallery-lightbox-previous {
        left: .4rem;
    }

    .mod-jtgallery-lightbox-next {
        right: .4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mod-jtgallery * {
        scroll-behavior: auto !important;
    }
}
