#container.factory-scene {
    min-height: 100vh;
    color: #fff;
    background: radial-gradient(ellipse at 85% 0%, #34363a 0%, #17181b 38%, #0d0e10 75%);
}



.gallery {
    --gap: clamp(10px, 1.6vw, 24px);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: clamp(8px, 1.5svh, 14px) var(--gap);
    width: min(100%, 1280px);
    height: clamp(260px, calc(100svh - 220px), 680px);
    padding: 0;
    margin: 0 auto;
    list-style: none;
}
.scene {
    min-width: 0;
    min-height: 0;
    container-type: size;
    display: grid;
    place-items: center;
}
.scene a {
    display: grid;
    place-items: center;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    width: min(100cqw, calc(100cqh * 1500 / 844));
    aspect-ratio: 1500 / 844;
    border: 1px solid #fff;
    border-radius: 50%;
    background: #080909;
}
.scene img {
    display: block;
    width: 70%;
    height: 70%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}
.scene a:focus-visible { outline-offset: 2px; }

@media (min-width: 801px) {
    .gallery {
        display: block;
        position: relative;
        container-type: size;
        width: 100%;
        height: min(720px, calc(100svh - 67px - 2 * clamp(12px, 2.7svh, 34px) - clamp(38px, min(6vw, 8svh), 84px) - clamp(10px, 2.3svh, 26px)));
    }
    .scene {
        --ratio: calc(1500 / 844);
        --original-height: clamp(260px, calc(100svh - 220px), 680px);
        --original-main-width: min(50cqw, 640px, calc(var(--original-height) * 7 / 15 * var(--ratio)));
        --outer-width: calc(var(--original-main-width) * .68);
        --edge-gap: clamp(8px, 1.15cqh, 13px);
        --side-cos: cos(18deg);
        --bottom-sin: sin(54deg);
        --main-width: min(
                var(--original-main-width),
                calc((100cqw - var(--outer-width) * (1 + var(--side-cos)) - 2 * var(--edge-gap)) / var(--side-cos)),
                calc(((100cqh - 2 * var(--edge-gap)) * var(--ratio) * 2 - (3 + var(--bottom-sin)) * var(--outer-width)) / (1 + var(--bottom-sin)))
        );
        --photo-width: var(--outer-width);
        --top-clearance: calc((var(--main-width) / 2 + var(--outer-width)) / var(--ratio) + var(--edge-gap));
        --bottom-clearance: calc((var(--bottom-sin) * (var(--main-width) + var(--outer-width)) + var(--outer-width)) / (2 * var(--ratio)) + var(--edge-gap));
        --center-y: clamp(var(--top-clearance), 50%, calc(100% - var(--bottom-clearance)));
        position: absolute;
        width: var(--photo-width);
        aspect-ratio: 1500 / 844;
        container-type: normal;
        translate: -50% -50%;
    }
    .scene:first-child {
        --photo-width: var(--main-width);
        left: 50%;
        top: var(--center-y);
    }
    .scene:not(:first-child) {
        /* Offset the tangent point along its outward normal for an even edge gap. */
        --combined-radius: calc((var(--main-width) + var(--photo-width)) / 2);
        --normal-angle: atan2(calc(sin(var(--angle)) * var(--ratio)), cos(var(--angle)));
        left: calc(50% + cos(var(--angle)) * var(--combined-radius) + cos(var(--normal-angle)) * var(--edge-gap));
        top: calc(var(--center-y) + sin(var(--angle)) * var(--combined-radius) / var(--ratio) + sin(var(--normal-angle)) * var(--edge-gap));
    }
    .scene:nth-child(2) { --angle: -90deg; }
    .scene:nth-child(3) { --angle: -18deg; }
    .scene:nth-child(4) { --angle: 54deg; }
    .scene:nth-child(5) { --angle: 126deg; }
    .scene:nth-child(6) { --angle: 198deg; }
    .scene a { width: 100%; }
}
@media (max-width: 800px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(3, minmax(0, 1fr));
        gap: 4px var(--gap);
        height: clamp(280px, calc(100svh - 225px), 610px);
    }
}
