/* WSPC 2026 photo gallery (gallery.js). Uses the palette in css/styles.css. */

body { overflow-x: clip; }                     /* keeps the sticky header/album strip working (see results.css) */
.gal-section { padding-top: clamp(1.2rem, .8rem + 2vw, 2.4rem); }
@media (max-width: 900px) {
    .page-hero { padding: 1rem 0 .9rem; }
    .page-hero .breadcrumb { margin-bottom: .3rem; font-size: .8rem; }
    .page-hero__title { font-size: 1.6rem; margin: 0; }
    .page-hero__sub { display: none; }
}
.gallery [hidden] { display: none !important; }
.gal-status { text-align: center; color: var(--ink-soft); padding: 2rem 0; }

/* credit + Drive link */
.gal-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.gal-credit { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.gal-drive { font-size: .92rem; font-weight: 600; color: var(--green-dark); }

/* album strip, pinned under the site header */
.gal-bar { position: sticky; top: var(--header-h); z-index: 20; margin: 0 -1rem 1rem; padding: .55rem 1rem;
           background: rgba(251, 246, 236, .96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.gal-strip { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gal-strip::-webkit-scrollbar { display: none; }
.gal-chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: .05rem;
            min-height: 2.9rem; padding: .35rem .8rem; font: inherit; text-align: left; cursor: pointer;
            color: var(--green-dark); background: var(--white); border: 1px solid var(--line);
            border-bottom: 3px solid var(--green); border-radius: var(--radius-sm); }
.gal-chip__title { font-weight: 700; font-size: .92rem; white-space: nowrap; }
.gal-chip__meta { font-size: .74rem; color: var(--ink-soft); white-space: nowrap; }
.gal-chip:hover, .gal-chip:focus-visible { border-color: var(--green); }
.gal-chip.is-active { color: var(--white); background: var(--green); border-color: var(--green-dark); }
.gal-chip.is-active .gal-chip__meta { color: rgba(255, 255, 255, .85); }

.gal-heading { margin: 0 0 .7rem; font-family: var(--font-display); font-size: 1.15rem; color: var(--green-dark); }

/* thumbnail grid */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
@media (max-width: 640px) { .gal-grid { grid-template-columns: repeat(3, 1fr); gap: .25rem; } }
@media (max-width: 380px) { .gal-grid { grid-template-columns: repeat(2, 1fr); } }
.gal-tile { display: block; aspect-ratio: 3 / 2; padding: 0; border: 0; overflow: hidden; cursor: zoom-in;
            background: var(--cream-2); border-radius: 6px; }
.gal-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.gal-tile:hover img, .gal-tile:focus-visible img { transform: scale(1.04); }
.gal-tile:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.gal-more { height: 1px; }

/* viewer: the photo uses the whole browser window; controls float over it and
   fade out after a few idle seconds (gallery.js toggles .is-idle) */
.gal-noscroll, .gal-noscroll body { overflow: hidden; }
.gal-box { position: fixed; inset: 0; z-index: 1000; background: #000; }
.gal-box.is-idle { cursor: none; }
.gal-box__stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.gal-box__img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s ease; user-select: none; }
.gal-box__img.is-loaded { opacity: 1; }
.gal-box__spin { position: absolute; width: 2.2rem; height: 2.2rem; border: 3px solid rgba(255, 255, 255, .25);
                 border-top-color: #fff; border-radius: 50%; animation: gal-spin .8s linear infinite; }
.gal-box__img.is-loaded + .gal-box__spin, .gal-box__img.is-loaded ~ .gal-box__spin { display: none; }
@keyframes gal-spin { to { transform: rotate(360deg); } }
.gal-box__btn, .gal-box__cap { transition: opacity .3s ease; }
.gal-box.is-idle .gal-box__btn, .gal-box.is-idle .gal-box__cap { opacity: 0; pointer-events: none; }
.gal-box__btn { position: absolute; width: 2.9rem; height: 2.9rem; border: 0; border-radius: 50%; cursor: pointer;
                color: #fff; background: rgba(0, 0, 0, .45); font-size: 1.15rem; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.gal-box__btn:hover, .gal-box__btn:focus-visible { background: rgba(0, 0, 0, .7); }
.gal-box__prev { left: .6rem; top: 50%; transform: translateY(-50%); }
.gal-box__next { right: .6rem; top: 50%; transform: translateY(-50%); }
.gal-box__close { right: .6rem; top: .6rem; }
.gal-box__share { right: 4rem; top: .6rem; }
.gal-box__share.is-done { background: var(--green); }
.gal-box__orig { right: 7.4rem; top: .6rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.gal-box__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem 4rem .8rem; text-align: center;
                color: rgba(255, 255, 255, .9); font-size: .9rem; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.gal-box__cap strong { color: #fff; }
@media (max-width: 640px) {
    .gal-box__prev, .gal-box__next { top: auto; bottom: .4rem; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .gal-tile img, .gal-box__img { transition: none; } .gal-box__spin { animation: none; } }
