/* Gallery album (/gallery/<album>/): the big screen for photographs. Adds to site.css and stage.css.
   Desktop: the title, the stage and its caption on the left, the contact strip on the right scrolling on its own.
   Phones: the stage pinned under the header with its controls, the caption and the strip beneath under the thumb.
   A photograph is never upscaled and never cropped on the stage: it sits at no more than its own pixel size,
   centred over a softly blurred, darkened enlargement of its thumbnail. Thumbnails may crop, biased upwards. */

.ga { --strip-w: clamp(300px, 25vw, 372px); --ga-top: clamp(16px, 3.4svh, 30px);
  display: grid; grid-template-columns: minmax(0, 1fr) var(--strip-w); grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: 'head strip' 'stage strip' 'mcap strip'; column-gap: clamp(24px, 2.8vw, 44px);
  height: 100svh; min-height: 600px; max-height: 1100px; padding-top: calc(var(--bar-h) + var(--ga-top)); padding-bottom: 20px; }
.ga-head { grid-area: head; padding-bottom: clamp(10px, 1.8svh, 16px); }
.ga-head h1 { font-size: clamp(1.9rem, 1.4rem + 1.3vw, 2.6rem); max-width: none; }
/* keep a long title clear of the hanging tag in the middle of the header: it wraps, and the screen gives up the height */
@media (min-width: 960px) {
  .ga-head h1 { max-width: calc(50vw - 118px - max(var(--gutter), (100vw - var(--page-max)) / 2)); }
  .ga.has-long-title { --ga-chrome: 230px; }
  .ga.has-long-title .ga-head h1 { font-size: clamp(1.7rem, 1.3rem + 1vw, 2.2rem); line-height: 1.04; }
}
.ga-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1.4rem; margin-top: .3rem; font-size: var(--step--1); }
.ga-meta span { font-weight: 600; color: var(--link); }
.ga-meta a { font-weight: 600; }
.ga-stage { grid-area: stage; min-width: 0; }
.ga-mcap { grid-area: mcap; display: none; }

/* the screen: as tall as the window allows with the title and caption still in view */
.ga-stage .st-screen { width: 100%; height: max(300px, calc(100svh - var(--bar-h) - var(--ga-top) - 20px - var(--ga-chrome, 200px))); }
@media (min-height: 1100px) { .ga-stage .st-screen { height: 860px; } }
.ga-photo { position: absolute; inset: 14px; z-index: 1; margin: auto; width: auto; height: auto; max-width: calc(100% - 28px); max-height: calc(100% - 28px);
  border-radius: 2px; box-shadow: 0 26px 50px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(243, 236, 214, .05); user-select: none; -webkit-user-drag: none; }
.ga-layer.is-loading .ga-photo { opacity: 0; }

/* previous and next at the edges of the screen, for a mouse (keyboard and touch have their own) */
.ga-edge { position: absolute; z-index: 4; top: 50%; display: grid; place-items: center; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%;
  background: rgba(31, 20, 7, .72); color: var(--cream); opacity: .82; transition: opacity .25s var(--ease), background-color .2s var(--ease), transform .15s var(--ease); }
.ga-edge svg { width: 26px; height: 26px; }
.ga-edge-prev { left: 14px; }
.ga-edge-next { right: 14px; }
@media (hover: hover) and (pointer: fine) {
.ga-edge:hover { opacity: 1; background: var(--ink); color: var(--teal-2); }
}
.ga-edge:active { transform: scale(.95); }
.ga-edge[disabled] { opacity: 0; pointer-events: none; }
@media (hover: none), (pointer: coarse) { .ga-edge { display: none; } }

/* under the screen: the caption, and the counter with its controls */
.ga-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 22px; align-items: start; padding-top: 4px; }
.ga-cap { max-width: 68ch; line-height: 1.45; color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ga-ctl { display: flex; align-items: center; gap: 6px; }
.ga-count { min-width: 5.6em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ga-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: var(--radius);
  border: 1.5px solid color-mix(in srgb, var(--ink) 45%, transparent); color: var(--ink); font: 600 var(--step--1)/1 var(--sans);
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease); }
.ga-btn svg { width: 20px; height: 20px; flex: none; }
@media (hover: hover) and (pointer: fine) {
.ga-btn:hover { background: rgba(31, 20, 7, .08); border-color: var(--ink); }
}
.ga-btn:active { transform: scale(.96); }
.ga-btn[disabled] { opacity: .35; pointer-events: none; }
.ga-fs { margin-left: 8px; padding: 0 14px 0 12px; }

/* the contact strip: every photograph, the current one marked and kept in view */
.ga-strip { grid-area: strip; align-self: start; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  background: var(--cream); border-radius: var(--radius); padding: 12px 8px 12px 12px; }
.ga-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.ga-thumb { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius-sm); background: #d9c99c; scroll-margin: 10px; }
.ga-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transition: transform .5s var(--ease), filter .3s var(--ease); }
.ga-thumb::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgba(41, 30, 12, .14); pointer-events: none; transition: box-shadow .25s var(--ease); }
@media (hover: hover) and (pointer: fine) {
.ga-thumb:hover img { transform: scale(1.04); }
}
.ga-thumb:active img { filter: brightness(.9); }
.ga-thumb.is-on::after, .ga-thumb[aria-current="true"]::after { box-shadow: inset 0 0 0 3px var(--teal-ink), inset 0 0 0 5px var(--cream); }
.ga-thumb:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ one column: tablets and phones */
@media (max-width: 959px) {
  .ga { display: block; height: auto; min-height: 0; max-height: none; padding-top: calc(var(--bar-h) + 26px); padding-bottom: 0; }
  .ga-stage { position: sticky; top: calc(var(--bar-h) - 8px); z-index: 20; margin-inline: calc(-1 * var(--gutter)); background: var(--brown); color: var(--cream);
    box-shadow: var(--media-pin-shadow); }
  .ga-stage .st-screen { height: min(calc(100vw * 2 / 3), 54svh); border-radius: 0; box-shadow: none; }
  .ga-photo { inset: 0; max-width: 100%; max-height: 100%; border-radius: 0; }
  .ga-stage .st-track { display: none; }
  .ga-info { display: block; padding: 6px var(--gutter) 8px; }
  .ga-cap { display: none; }
  .ga-ctl { justify-content: flex-start; gap: 4px; }
  .ga-btn { color: var(--cream); border-color: rgba(243, 236, 214, .35); }
@media (hover: hover) and (pointer: fine) {
.ga-btn:hover { background: rgba(243, 236, 214, .08); border-color: var(--cream); }
}
  .ga-fs { margin-left: auto; }
  .ga-count { color: var(--cream); }
  .ga-stage :focus-visible { outline-color: var(--teal-2); }
  .ga-mcap { display: block; padding: 12px 0 2px; font-size: 16px; line-height: 1.45; color: var(--text-soft); min-height: 4.4em; }
  .ga-strip { overflow: visible; margin-top: 12px; padding: 8px; }
  .ga-list { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 5px; }
  .ga-thumb { scroll-margin: 0; }
}

/* full screen: the photograph still never larger than itself, the caption and controls along the bottom */
.ga-stage:fullscreen .st-screen, .ga-stage.is-fullscreen .st-screen { height: 100%; }
.ga-stage:fullscreen .ga-photo, .ga-stage.is-fullscreen .ga-photo { inset: 18px; max-width: calc(100% - 36px); max-height: calc(100% - 36px); }
.ga-stage:fullscreen .ga-info, .ga-stage.is-fullscreen .ga-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 8px clamp(14px, 3vw, 32px) 12px; color: var(--cream); }
.ga-stage:fullscreen .ga-cap, .ga-stage.is-fullscreen .ga-cap { display: -webkit-box; -webkit-line-clamp: 1; color: rgba(243, 236, 214, .82); }
.ga-stage:fullscreen .ga-btn, .ga-stage.is-fullscreen .ga-btn { color: var(--cream); border-color: rgba(243, 236, 214, .35); }
.ga-stage:fullscreen .ga-count, .ga-stage.is-fullscreen .ga-count { color: var(--cream); }
@media (max-width: 700px) {
  .ga-stage.is-fullscreen .ga-info, .ga-stage:fullscreen .ga-info { grid-template-columns: minmax(0, 1fr); }
  .ga-stage.is-fullscreen .ga-cap, .ga-stage:fullscreen .ga-cap { -webkit-line-clamp: 2; font-size: 16px; }
  .ga-stage.is-fullscreen .ga-fs-l, .ga-stage:fullscreen .ga-fs-l { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ga-stage.is-fullscreen .ga-fs, .ga-stage:fullscreen .ga-fs { padding-inline: 10px; }
  .ga-stage:fullscreen .ga-photo, .ga-stage.is-fullscreen .ga-photo { inset: 0; max-width: 100%; max-height: 100%; }
}

/* ------------------------------------------------------------------ without JavaScript: every photograph in order, with its caption */
@media (scripting: none) {
  .ga { display: block; height: auto; max-height: none; }
  .ga-stage, .ga-strip, .ga-mcap { display: none; }
}
.ga-seq { display: grid; gap: clamp(28px, 4vw, 48px); margin: var(--s2) 0 0; }
.ga-seq figure { margin: 0 auto; width: fit-content; max-width: min(100%, 900px); }
.ga-seq img { display: block; max-width: 100%; max-height: 82vh; width: auto; height: auto; margin-inline: auto; border: 6px solid var(--cream); border-radius: var(--radius-sm);
  box-shadow: 0 22px 40px -26px rgba(41, 30, 12, .8); }
.ga-seq figcaption { max-width: 62ch; margin-top: .7rem; font-size: var(--step--1); line-height: 1.5; color: var(--text-soft); }
.ga-seq-n { font-weight: 650; color: var(--link); }

@media (prefers-reduced-motion: reduce) {
  .ga-thumb img, .ga-edge, .ga-btn { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .ga-edge { background: var(--ink); }
}
@media (prefers-contrast: more) {
  .ga-stage:fullscreen .ga-cap, .ga-stage.is-fullscreen .ga-cap { color: var(--cream); }
}
