/**
 * WebWizards gallery
 *
 * Neutral defaults with public BEM classes and CSS variables.
 */

.webwizards-gallery {
    --webwizards-gallery-columns: repeat(auto-fit, minmax(160px, 1fr));
    --webwizards-gallery-gap: 12px;
    --webwizards-gallery-ratio: 4 / 3;
    --webwizards-gallery-radius: 0;
    --webwizards-gallery-background: #f3f4f6;

    display: grid;
    grid-template-columns: var(--webwizards-gallery-columns);
    gap: var(--webwizards-gallery-gap);
}

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

.webwizards-gallery__item {
    display: block;
    width: 100%;
    aspect-ratio: var(--webwizards-gallery-ratio);
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--webwizards-gallery-radius);
    background: var(--webwizards-gallery-background);
    cursor: zoom-in;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 320px 240px;
}

.webwizards-gallery__item:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.webwizards-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 180ms ease;
}

@media (hover: hover) {
    .webwizards-gallery__item:hover .webwizards-gallery__image {
        transform: scale(1.025);
    }
}


.webwizards-lightbox-open {
    overflow: hidden !important;
}

.webwizards-lightbox[hidden] {
    display: none !important;
}

.webwizards-lightbox {
    --webwizards-lightbox-backdrop: rgba(7, 10, 16, .94);
    --webwizards-lightbox-control-size: 52px;
    --webwizards-lightbox-control-background: rgba(17, 24, 39, .88);
    --webwizards-lightbox-control-border: rgba(255, 255, 255, .4);
    --webwizards-lightbox-control-color: #fff;

    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;
    display: block;
    visibility: visible;
    opacity: 0;
    isolation: isolate;
    transition: opacity 180ms ease;
}

.webwizards-lightbox.is-open { opacity: 1; }

.webwizards-lightbox__backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 0 !important;
    background: var(--webwizards-lightbox-backdrop) !important;
    cursor: zoom-out;
}

.webwizards-lightbox__panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 72px 92px 54px !important;
    pointer-events: none !important;
}

.webwizards-lightbox__figure {
    display: grid !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    gap: 12px !important;
    justify-items: center !important;
    pointer-events: auto !important;
}

.webwizards-lightbox__image {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: min(1440px, calc(100vw - 184px)) !important;
    max-height: calc(100vh - 146px) !important;
    object-fit: contain !important;
    user-select: none;
    -webkit-user-drag: none;
}

.webwizards-lightbox__counter {
    display: inline-flex !important;
    min-width: 64px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .88);
    color: #fff;
    font-size: 14px;
    line-height: 1;
}

.webwizards-lightbox__control {
    position: fixed !important;
    z-index: 2147483002 !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: var(--webwizards-lightbox-control-size) !important;
    height: var(--webwizards-lightbox-control-size) !important;
    min-width: var(--webwizards-lightbox-control-size) !important;
    min-height: var(--webwizards-lightbox-control-size) !important;
    max-width: var(--webwizards-lightbox-control-size) !important;
    max-height: var(--webwizards-lightbox-control-size) !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--webwizards-lightbox-control-border) !important;
    border-radius: 999px !important;
    background: var(--webwizards-lightbox-control-background) !important;
    color: var(--webwizards-lightbox-control-color) !important;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .3) !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    transform: none;
}

.webwizards-lightbox__control[hidden] { display: none !important; }

.webwizards-lightbox__control svg {
    display: block !important;
    width: 26px !important;
    height: 26px !important;
    overflow: visible !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.25 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    pointer-events: none !important;
}

.webwizards-lightbox__control:hover {
    background: rgba(17, 24, 39, 1) !important;
    border-color: rgba(255, 255, 255, .75) !important;
}

.webwizards-lightbox__control:focus-visible {
    outline: 3px solid rgba(255, 255, 255, .82) !important;
    outline-offset: 3px !important;
}

.webwizards-lightbox__close { top: 20px !important; right: 20px !important; }
.webwizards-lightbox__previous { top: 50% !important; left: 20px !important; transform: translateY(-50%) !important; }
.webwizards-lightbox__next { top: 50% !important; right: 20px !important; transform: translateY(-50%) !important; }

@media (max-width: 768px) {
    .webwizards-lightbox { --webwizards-lightbox-control-size: 46px; }
    .webwizards-lightbox__panel { padding: 64px 12px 74px !important; }
    .webwizards-lightbox__image {
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 150px) !important;
    }
    .webwizards-lightbox__close { top: 12px !important; right: 12px !important; }
    .webwizards-lightbox__previous { top: auto !important; bottom: 14px !important; left: 14px !important; transform: none !important; }
    .webwizards-lightbox__next { top: auto !important; right: 14px !important; bottom: 14px !important; transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .webwizards-gallery__image,
    .webwizards-lightbox { transition: none; }
}


.webwizards-gallery__image {
    backface-visibility: hidden;
}

.webwizards-lightbox__image:not([src]) {
    visibility: hidden;
}
