/* Gallery album detail — grid + lightbox. Page-specific (self-contained component,
   the one place page-scoped CSS is allowed per the batch plan). Uses shared tokens. */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 20px; }
.gallery-item { position: relative; display: block; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
    background: var(--pub-soft); cursor: zoom-in; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item__ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--pub-line); }
.gallery-item__ph svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.gallery-item--video { cursor: pointer; }
.gallery-item__play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; color: #fff; }
.gallery-item__play svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.gallery-item__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 8px; color: #fff;
    font-size: 0.78rem; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .2s; }
.gallery-item:hover .gallery-item__cap { opacity: 1; }

/* Shared photo & video viewer (js/public/lightbox.js, rebuilt 16 Nov 2026). Dark photo chrome is an
   intentional rgba-black backdrop; controls are white-on-dark with a white focus ring. Layout, top to
   bottom: progress bar · counter + tools · stage (prev / media / next) · thumbnail strip. */
.gallery-lightbox { position: fixed; inset: 0; z-index: 1300;  /* above the cookie banner (1200) */ background: rgba(0,0,0,.97);
    display: flex; flex-direction: column; padding: 0 0 12px; opacity: 0; transition: opacity .25s ease;
    /* pan-y: a vertical scroll still works while a horizontal drag goes to the swipe handler. */
    touch-action: pan-y; }
.gallery-lightbox.is-open { opacity: 1; }
.gallery-lightbox.is-closing { background: rgba(0,0,0,0); transition: background .3s ease; }
.gallery-lightbox.is-closing .gallery-lightbox__top,
.gallery-lightbox.is-closing .gallery-lightbox__strip,
.gallery-lightbox.is-closing .gallery-lightbox__nav,
.gallery-lightbox.is-closing .gallery-lightbox__cap,
.gallery-lightbox.is-closing .gallery-lightbox__progress { opacity: 0; transition: opacity .2s; }
.gallery-lightbox[hidden] { display: none; }
.gallery-lightbox.is-fullscreen { background: #000; }

/* Progress bar along the very top (slideshow only). */
.gallery-lightbox__progress { height: 3px; background: rgba(255,255,255,.18); flex-shrink: 0; }
.gallery-lightbox__progress[hidden] { display: none; }
.gallery-lightbox__progress span { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: 0 50%; }

.gallery-lightbox__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 4px; flex-shrink: 0; }
.gallery-lightbox__counter { color: #fff; font-size: 0.85rem; font-variant-numeric: tabular-nums; min-width: 3em; }
.gallery-lightbox__tools { display: flex; gap: 8px; }

.gallery-lightbox__main { flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 0 clamp(8px, 2vw, 24px); }
.gallery-lightbox__stage { flex: 1; min-width: 0; min-height: 0; height: 100%; margin: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.gallery-lightbox__img, .gallery-lightbox__video { max-width: 100%; max-height: calc(100% - 40px); min-height: 0;
    border-radius: 6px; object-fit: contain; -webkit-user-drag: none; user-select: none; will-change: transform; }
.gallery-lightbox__img[hidden], .gallery-lightbox__video[hidden] { display: none; }
.gallery-lightbox__video { background: #000; width: min(100%, 1100px); }
.gallery-lightbox__cap { color: #fff; font-size: 0.9rem; text-align: center; max-width: 760px; margin: 0; }
.gallery-lightbox__cap[hidden] { display: none; }

/* Buttons — shared chrome */
.gallery-lightbox button { border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
    display: grid; place-items: center; border-radius: 50%; transition: background .2s; padding: 0; }
.gallery-lightbox button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.gallery-lightbox button[hidden] { display: none; }
.gallery-lightbox__tools button { width: 40px; height: 40px; }
.gallery-lightbox__tools button svg { width: 19px; height: 19px; }
.gallery-lightbox__tools button[aria-pressed="false"] { background: rgba(255,255,255,.05); color: rgba(255,255,255,.7); }
.gallery-lightbox__nav { width: 48px; height: 48px; flex-shrink: 0; }
.gallery-lightbox__nav svg { width: 24px; height: 24px; }

/* Thumbnail strip: one row, small, scrolls sideways inside itself. */
.gallery-lightbox__strip { display: flex; gap: 8px; justify-content: safe center; overflow-x: auto; padding: 10px 16px 2px;
    flex-shrink: 0; scrollbar-width: none; }
.gallery-lightbox__strip::-webkit-scrollbar { display: none; }
.gallery-lightbox__strip[hidden] { display: none; }
.gallery-lightbox button.gallery-lightbox__thumb { position: relative; flex: 0 0 64px; height: 44px; border-radius: 6px; overflow: hidden;
    background: rgba(255,255,255,.1); border: 1px solid transparent; opacity: .55; transition: opacity .15s, border-color .15s; }   /* thin edge, as Key Moments */
.gallery-lightbox__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-lightbox__thumb.is-video::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0;
    border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.gallery-lightbox button.gallery-lightbox__thumb[aria-current="true"] { opacity: 1; border-color: #fff; }

@media (hover: hover) {
    .gallery-lightbox button:hover { background: rgba(255,255,255,.26); }
    .gallery-lightbox button.gallery-lightbox__thumb:hover { opacity: .9; }
}

@media (max-width: 560px) {
    .gallery-lightbox__main { position: relative; padding: 0 6px; }
    .gallery-lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 40px; height: 40px; background: rgba(0,0,0,.45); }
    .gallery-lightbox__nav[data-lb="prev"] { left: 6px; }
    .gallery-lightbox__nav[data-lb="next"] { right: 6px; }
    .gallery-lightbox button.gallery-lightbox__thumb { flex-basis: 52px; height: 38px; }
    .gallery-lightbox__tools button { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-item img, .gallery-item__cap, .gallery-lightbox, .gallery-lightbox button { transition: none; }
}
