/* ==========================================================================
   Gallery page — filter chips, a photo wall with a few larger "feature"
   photos, and a full-screen viewer (gallery.js).
   ========================================================================== */

.wall { padding-top: clamp(1.25rem, 1rem + 1.5vw, 2rem); }

/* Filter chips */
.wall-filter {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem;
  margin-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
}
.wall-filter__chip {
  min-height: 44px;
  padding: 0 1.1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--navy);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.wall-filter__chip:hover { border-color: var(--royal); }
.wall-filter__chip[aria-pressed="true"] { border-color: var(--royal); background: var(--royal); color: #fff; }

/* Photo wall: rows sized from the column width so every tile keeps a 3:4 shape */
.wall__grid {
  --cols: 2; --gap: 0.75rem;
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 4 / 3);
  grid-auto-flow: dense;
  gap: var(--gap);
  margin: 0;
}
@media (min-width: 700px) { .wall__grid { --cols: 3; --gap: 1rem; } }
@media (min-width: 1100px) { .wall__grid { --cols: 4; --gap: 1.1rem; } }
.wall__item--feature { grid-column: span 2; grid-row: span 2; }
/* a few wide photos keep every row full (some only at 2 and 4 columns, "--wide3" at every size) */
.wall__item--wide { grid-column: span 2; }
@media (min-width: 700px) and (max-width: 1099px) { .wall__item--wide:not(.wall__item--wide3) { grid-column: auto; } }

/* The wall opens with 24 photos; "Show more photos" (or picking a filter) reveals the rest.
   Without JavaScript every photo simply shows. */
.js .wall__grid:not(.is-expanded):not(.is-filtered) > .wall__item:nth-child(n + 25) { display: none; }
.wall__more { display: flex; justify-content: center; margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.25rem); }
.wall__more[hidden] { display: none; }
.wall__item[hidden] { display: none; }

.wall__tile {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--sky-50);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}
.wall__tile img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--pos, 50% 50%);
  transition: transform 600ms var(--ease);
}
.wall__tile:hover img { transform: scale(1.04); }
.wall__cap {
  position: absolute; left: 0.75rem; bottom: 0.75rem;
  max-width: calc(100% - 1.5rem);
  padding: 0.3rem 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px -4px rgba(23, 32, 51, 0.25);
  color: var(--navy);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
}
@media (max-width: 599px) {
  .wall__cap { left: 0.5rem; bottom: 0.5rem; max-width: calc(100% - 1rem); padding-inline: 0.6rem; font-size: 0.75rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .wall__item { animation: wall-in 420ms var(--ease) both; }
}
@keyframes wall-in { from { opacity: 0; transform: translateY(10px); } }

/* Viewer */
.lightbox {
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  margin: 0; padding: 0;
  border: 0;
  background: rgba(17, 23, 38, 0.94);
  color: #fff;
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(17, 23, 38, 0.94); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox__figure {
  display: grid; justify-items: center; gap: 0.9rem;
  margin: 0;
  padding: 4.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  max-width: 100%;
  touch-action: pan-y pinch-zoom;
}
.lightbox__img {
  display: block;
  max-width: min(100%, 1000px);
  max-height: calc(100dvh - 9.5rem);
  width: auto; height: auto;
  border-radius: 18px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  user-select: none;
}
@media (prefers-reduced-motion: no-preference) {
  .lightbox__img.is-new { animation: lightbox-in 260ms var(--ease) both; }
}
@keyframes lightbox-in { from { opacity: 0; transform: scale(0.98); } }
.lightbox__bar { display: flex; align-items: baseline; gap: 0.9rem; font-family: var(--font-ui); text-align: center; }
.lightbox__cap { font-size: 1rem; font-weight: 600; }
.lightbox__count { color: rgba(255, 255, 255, 0.6); font-size: 0.875rem; }
.lightbox__btn {
  position: fixed; z-index: 2;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.26); }
.lightbox__btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.lightbox__btn .icon { width: 24px; height: 24px; }
.lightbox__close { top: calc(1rem + env(safe-area-inset-top)); right: 1rem; }
.lightbox__nav { top: 50%; translate: 0 -50%; }
.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--prev .icon { rotate: 180deg; }
.lightbox__nav--next { right: 1rem; }
/* phones: arrows sit at the bottom corners, clear of the photo; swiping also works */
@media (max-width: 699px) {
  .lightbox__nav { top: auto; bottom: calc(1rem + env(safe-area-inset-bottom)); translate: none; }
  .lightbox__figure { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  .lightbox__img { max-height: calc(100dvh - 12rem); }
}
html.lightbox-open { overflow: hidden; }
