/* Gallery Page Styles
   Rebuilt 30 Sep 2026 (js/gallery.js). The picture sits in a FIXED 16:9
   frame - it never takes its size from the picture any more, so a tall or
   odd-shaped picture no longer makes the whole box (and the page under it)
   jump. The picture is shown whole, over a blurred copy of itself that
   fills the edges. The controls moved out of the picture into a bar under
   it, using the site's standard 40px buttons. */

.gallery-wrapper {
    max-width: 1400px;
    margin: 1.5rem auto 2rem;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

.gal-viewer {
    /* As wide as the page allows, but never so tall that the frame and its
       controls don't fit on the screen together. */
    width: min(100%, calc((100vh - 15rem) * 16 / 9));
    min-width: min(100%, 320px);
    margin: 0 auto;
}

@supports (height: 100svh) {
    .gal-viewer {
        width: min(100%, calc((100svh - 15rem) * 16 / 9));
    }
}

.gal-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--background-dark);
    border: 1px solid var(--border-colour);
    border-radius: var(--radius1);
    box-shadow: 0 0 14px var(--glow-colour);
}

.gal-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.gal-frame .gal-blur {
    object-fit: cover;
    filter: blur(24px) brightness(0.45);
    transform: scale(1.12);
}

.gal-frame .gal-img {
    object-fit: contain;
    transition: opacity 0.25s ease;
}

.gal-frame.is-loading .gal-img {
    opacity: 0.35;
}

.gal-frame.is-empty img {
    display: none;
}

.gal-none {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    color: var(--muted);
}

.gal-none[hidden] {
    display: none;
}

/* Previous / next, on the picture's sides */
.gal-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    border: 0.125rem solid var(--highlight-colour);
    border-radius: var(--radius1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.gal-nav:hover:not(:disabled),
.gal-nav:focus-visible {
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px var(--glow-colour);
    outline: none;
}

.gal-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.gal-nav.prev {
    left: 10px;
}

.gal-nav.next {
    right: 10px;
}

/* The bar under the picture */
.gal-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1rem;
    margin-top: 0.75rem;
}

.gal-counter {
    display: inline-flex;
    align-items: center;
    height: var(--control-h);
    padding: 0 1rem;
    box-sizing: border-box;
    background: var(--background-mid);
    border: 1px solid var(--border-colour);
    border-radius: var(--radius1);
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.gal-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.gal-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.gal-jump input {
    width: 5.5rem;
    height: var(--control-h);
    padding: 0 0.6rem;
    box-sizing: border-box;
    background: var(--background-dark);
    color: #fff;
    border: 0.125rem solid var(--border-colour);
    border-radius: var(--radius1);
    font: 0.92rem var(--font-body);
    color-scheme: dark;
}

.gal-jump input:focus {
    outline: none;
    border-color: var(--highlight-colour);
    box-shadow: 0 0 8px var(--glow-colour);
}

/* The site's standard 40px button */
.gal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: var(--control-h);
    min-width: 4.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
    background: var(--gradient-main);
    color: #fff;
    border: 0.125rem solid var(--highlight-colour);
    border-radius: var(--radius1);
    font-family: var(--font-display);
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gal-btn:hover:not(:disabled),
.gal-btn:focus-visible {
    transform: scale(1.03);
    box-shadow: 0 0 10px var(--glow-colour);
}

.gal-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gal-btn[hidden] {
    display: none;
}

#playBtn {
    min-width: 6.5rem;
}

.gal-hint {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
}

/* Admins */
.gal-admin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    margin: 1.5rem auto 0;
    padding: 1rem;
    max-width: 900px;
    background: var(--background-mid);
    border: 1px dashed var(--border-colour);
    border-radius: var(--radius1);
}

.gal-admin p {
    margin: 0;
    text-align: center;
}

@media (max-width: 640px) {
    .gallery-wrapper {
        padding: 0 1rem;
    }

    .gal-bar,
    .gal-controls {
        justify-content: center;
    }

    .gal-controls {
        display: grid;
        grid-template-columns: auto auto;
    }

    .gal-jump input {
        width: 4.5rem;
    }

    .gal-nav {
        width: 38px;
        height: 38px;
    }
}
