/* components/gallery/Gallery.module.scss (the `explore` slice) */
.mk-gallery {
    padding-top: var(--mk-space-top, var(--segment-padding));
    padding-bottom: var(--mk-space-bottom, var(--segment-padding));
}
.mk-gallery__container {
    padding-left: var(--container-gutter);
    padding-right: var(--container-gutter);
    margin: 0 auto;
    max-width: var(--page-width);
    box-sizing: content-box;
}
.mk-gallery__layout {
    display: grid;
    column-gap: 0;
    row-gap: 5rem;
    grid-template-columns: repeat(10, minmax(0, 1fr));
}
@media (min-width: 720px) {
    .mk-gallery__layout {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        column-gap: 3rem;
        row-gap: clamp(8rem, calc(8rem + 6 * ((100vw - 108rem) / 36)), 14rem);
    }
}

.mk-gallery__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: flex-end;
    gap: 0.8rem;
    margin-bottom: -5rem;
    grid-column: 4 / -1;
}
.mk-gallery__title svg { max-width: none; }
@media (min-width: 720px) {
    .mk-gallery__title { grid-column: 7 / -1; grid-row: 1 / 2; margin-top: -5rem; justify-self: center; }
}

.mk-gallery__signup { grid-row-start: 4; grid-column: 1 / -1; margin-top: -5rem; }
@media (min-width: 720px) {
    .mk-gallery__signup { align-self: center; margin: 0; grid-column: 1 / 7; grid-row: 4 / 6; }
}
@media (min-width: 960px) {
    .mk-gallery__signup { grid-column: 1 / 6; }
}
@media (min-width: 1200px) {
    .mk-gallery__signup { grid-column: 2 / 6; }
}
/* The texts are blocks in design-system styles: title "caption-caps", heading
   "h3-tight", text "body", label "label-fixed". The width in ch of the heading's own
   size sits on the block. */
.mk-gallery__heading { margin: 0; padding: 0; column-span: all; }
.mk-gallery__heading > * { max-width: 15ch; }
.mk-gallery__copy { margin-bottom: 2rem; }
/* RenderCopy's styles never applied here in the original (:when(.copy)) – plain paragraphs. */
:is(.mk-gallery__copy, .mk-gallery__copy .el-richtext) p { margin: 1em 0; }

.mk-gallery__themink { grid-column: 1 / -1; }
@media (min-width: 720px) {
    .mk-gallery__themink { align-self: flex-end; grid-column: 7 / -1; }
}
.mk-gallery__themink svg { max-width: 100%; }
.mk-gallery__themink { color: var(--mk-gallery-wordmark, inherit); }
/* The yellow dots of the arrow and the wordmark (fill="#FFC30F" in the SVGs) */
.mk-gallery[style*="--mk-gallery-accent:"] :is(.mk-gallery__title, .mk-gallery__themink) [fill="#FFC30F"] { fill: var(--mk-gallery-accent); }

.mk-gallery__item { align-self: flex-end; cursor: pointer; }
.mk-gallery__item:focus { outline: none; }
.mk-gallery__item:focus-visible { outline: 0.2rem solid var(--color-accent-primary); outline-offset: 0.3rem; }
.mk-gallery__item img { width: 100%; height: auto; border-radius: var(--mk-gallery-radius, 0); }
.mk-gallery__item:nth-child(2) { grid-column: 1 / 5; }
.mk-gallery__item:nth-child(3) { grid-column: 6 / -1; }
.mk-gallery__item:nth-child(4) { align-self: flex-start; grid-column: 1 / 6; }
.mk-gallery__item:nth-child(5) { grid-column: 7 / -1; }
.mk-gallery__item:nth-child(6) { grid-column: 1 / 6; }
.mk-gallery__item:nth-child(7) { grid-column: 7 / -1; }
.mk-gallery__item:nth-child(8) { grid-column: 1 / -1; }
.mk-gallery__item:nth-child(9) { grid-column: 1 / 5; }
.mk-gallery__item:nth-child(10) { align-self: flex-start; grid-column: 6 / -1; }
@media (min-width: 720px) {
    .mk-gallery__item:nth-child(2) { grid-column: 1 / 6; grid-row: 1 / 3; }
    .mk-gallery__item:nth-child(3) { grid-column: 7 / -1; grid-row: 2 / 3; }
    .mk-gallery__item:nth-child(4) { align-self: flex-end; grid-column: 1 / 7; grid-row: 3 / 4; }
    .mk-gallery__item:nth-child(5) { grid-column: 8 / -1; grid-row: 3 / 5; }
    .mk-gallery__item:nth-child(6) { grid-column: 1 / 7; grid-row: 6 / 7; }
    .mk-gallery__item:nth-child(7) { grid-column: 8 / -1; grid-row: 5 / 7; }
    .mk-gallery__item:nth-child(8) { grid-column: 1 / -1; grid-row: 7 / 8; }
    .mk-gallery__item:nth-child(9) { grid-column: 1 / 6; grid-row: 8 / 10; }
    .mk-gallery__item:nth-child(10) { align-self: flex-start; grid-column: 7 / -1; grid-row: 8 / 9; }
}

/* Scroll-in (react-spring: y 20 → 0, opacity, 200 ms delay) */
.mk-js .mk-gallery__item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out 0.2s, transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}
.mk-js .mk-gallery__item.is-inview { opacity: 1; transform: none; }

/* ---- Lightbox (react-modal) ---- */
.mk-lightbox {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto 1fr auto;
    backdrop-filter: blur(0.7rem);
    -webkit-backdrop-filter: blur(0.7rem);
    z-index: 100;
    transition: background-color 0.3s ease-in-out, backdrop-filter 0.3s ease-in-out;
}
.mk-lightbox[hidden] { display: none; }
.mk-lightbox::after {
    content: '';
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: var(--color-background);
    opacity: 0.5;
}
.mk-lightbox__box {
    position: relative;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: grid;
    align-items: center;
    outline: none;
    pointer-events: none;
    width: min(calc(100vw - 6rem), min(72rem, 75vh));
    z-index: 100;
}
.mk-lightbox__stage { display: grid; }
.mk-lightbox__stage > * {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    width: 100%;
    max-width: min(72rem, 75vh);
    max-height: 100vh;
    pointer-events: auto;
    user-select: none;
    box-shadow: 0 0 4.2rem rgba(0, 0, 0, 0.22);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.mk-lightbox__stage img { width: 100%; max-height: 100vh; margin: auto; }
.mk-lightbox__next,
.mk-lightbox__previous {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    width: 3.2rem;
    height: 3.2rem;
    color: #282323;
    background: var(--mk-gallery-accent, var(--color-accent-primary));
    border: 0;
    border-radius: 50%;
    z-index: 100;
    box-shadow: none;
    cursor: pointer;
    pointer-events: auto;
    appearance: none;
}
.mk-lightbox__next svg, .mk-lightbox__previous svg { display: block; max-width: none; }
.mk-lightbox__next { right: 0; transform: translate(40%, -50%); }
.mk-lightbox__previous { left: 0; transform: translate(-40%, -50%); }
.mk-lightbox__previous svg { transform: rotateY(180deg); }

@media (prefers-reduced-motion: reduce) {
    .mk-js .mk-gallery__item { opacity: 1; transform: none; transition: none; }
    .mk-lightbox__stage > * { transition: none; }
}
