.gallery-page { position:relative; flex:1; min-height:0; }
.gallery-background { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:left center; }
.gallery-wall { position:absolute; left:34%; right:3%; top:17%; bottom:23%; }
.gallery-wall [hidden] { display:none !important; }
.gallery-browser { position:absolute; inset:0; display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:12px; }
.gallery-viewport { height:85%; min-width:0; overflow:hidden; }
.gallery-track { display:flex; height:100%; transition:transform .4s ease; }
.gallery-set { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr)); gap:18px; flex:0 0 100%; min-width:0; height:100%; }
.gallery-thumb { position:relative; display:block; min-width:0; min-height:0; width:100%; height:100%; padding:0; border:0; background:transparent; cursor:pointer; }
.gallery-thumb img,.gallery-thumb video { display:block; width:100%; height:100%; object-fit:cover; }
.gallery-thumb video { pointer-events:none; }
.gallery-play { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); color:#fff; font:28px/1 Arial,sans-serif; text-shadow:0 1px 6px #000; }
.gallery-nav { width:44px; height:44px; display:grid; place-items:center; padding:2px; border:0; background:transparent; color:#8F1D32; cursor:pointer; }
.gallery-nav svg { display:block; width:40px; height:40px; }
.gallery-next svg { transform:scaleX(-1); }
.gallery-nav:disabled { opacity:.3; cursor:default; }
.gallery-wall button:focus-visible { outline:2px solid #8F1D32; outline-offset:4px; }
.gallery-view { position:absolute; left:7.5%; top:7.5%; width:85%; height:85%; display:grid; grid-template-rows:minmax(0,1fr) auto; gap:12px; }
.gallery-view-media { min-width:0; min-height:0; }
.gallery-view-media img,.gallery-view-media video { display:block; width:100%; height:100%; object-fit:contain; }
.gallery-wall .gallery-back { justify-self:end; }
.gallery-status { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); }
@media (min-width:901px) {
    .gallery-wall:has(> .gallery-view:not([hidden])) { left:36.7%; right:4%; top:11%; bottom:calc(50% - max(15.76vw, calc((100dvh - var(--admin-bar-height) - var(--subpage-footer-height)) * .28)) + 12px); }
    .gallery-wall .gallery-view { left:0; top:0; width:100%; height:100%; }
}
@media (max-width:900px) {
    .gallery-background { object-position:16% center; }
    .gallery-wall { left:5%; right:5%; top:24%; bottom:13%; }
    .gallery-browser { grid-template-columns:36px minmax(0,1fr) 36px; gap:8px; }
    .gallery-nav { width:36px; height:40px; padding:0; }
    .gallery-nav svg { width:32px; height:32px; }
    .gallery-set { gap:12px; }
    .gallery-wall .gallery-back { width:190px; height:40px; min-height:40px; padding:0 18px; font-size:13px; }
}
@media (max-width:600px) {
    .gallery-wall { left:3%; right:3%; top:24%; bottom:10%; }
    .gallery-browser { grid-template-columns:28px minmax(0,1fr) 28px; gap:6px; }
    .gallery-nav { width:28px; }
    .gallery-nav svg { width:28px; height:28px; }
    .gallery-set { gap:10px; }
    .gallery-wall .gallery-back { width:180px; height:36px; min-height:36px; padding:0 16px; font-size:12px; }
}
@media (prefers-reduced-motion:reduce) { .gallery-track { transition:none; } }

/* Supplied wall background on phones and tablets. */
@media (max-width:1024px) {
    .gallery-page { background-image:url('../img/gallery-background-mobile.png'); background-size:cover; background-position:center; background-repeat:no-repeat; }
    .gallery-background { visibility:hidden; }
}

@media (min-width:768px) and (max-width:1024px) and (orientation:landscape) {
    .gallery-page .gallery-wall { left:16px; right:16px; top:140px; bottom:16px; }
    .gallery-viewport { height:100%; }
    .gallery-set { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
