/* refont: source-sans-3 */
/* Gallery page: theme filters, the photo grid and the lightbox. */

/* filter bar (shown by js/pages/gallery.js) */
.g-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 32px; }
.g-bar[hidden] { display: none; }
.g-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.g-years { padding-top: 12px; border-top: 1px solid rgba(221, 232, 244, 0.2); }
.g-years .g-filter { min-height: 40px; font-size: 15px; }
.g-filter { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 2px solid rgba(221, 232, 244, 0.35); border-radius: 3px; background: transparent; color: var(--white); font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; transition: background-color 0.18s ease, border-color 0.18s ease; }
.g-filter span { font-weight: 600; color: var(--muted); }
.g-filter:hover { border-color: var(--white); }
.g-filter[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.g-filter[aria-pressed="true"] span { color: var(--navy); opacity: 0.7; }
.g-count { font-size: 15px; color: var(--muted); }

/* photo grid: even 3:2 cells, captions underneath */
.g-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 12px; }
.g-grid > li[hidden] { display: none; }
.g-grid figure { display: flex; flex-direction: column; gap: 8px; }
.g-grid figcaption { font-size: 14px; line-height: 1.35; color: var(--muted); }
.g-link { display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: var(--navy); cursor: zoom-in; }
.g-link img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.g-link:hover img { transform: scale(1.04); }
/* the first photo shown (moved by the script when filtering) is twice the size, which also evens out the last row */
.g-grid > li.g-feature { grid-column: span 2; grid-row: span 2; }
.g-feature figure { height: 100%; }
.g-feature .g-link { position: relative; flex: 1 1 auto; aspect-ratio: auto; min-height: 200px; }
.g-feature .g-link img { position: absolute; inset: 0; }
@media (max-width: 1100px) { .g-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 8px; } .g-filter { padding: 0 12px; font-size: 15px; } }

/* lightbox: a full-screen native <dialog> */
.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--deep); color: var(--white); overflow: hidden; touch-action: pan-y pinch-zoom; overscroll-behavior: contain; }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lightbox::backdrop { background: rgba(8, 23, 44, 0.7); }
html:has(.lightbox[open]) { overflow: hidden; }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 3vw, 32px); }
.lb-count { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.lb-figure { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; padding: 0 clamp(16px, 8vw, 120px) 28px; }
.lb-img { width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); border-radius: 4px; object-fit: contain; }
.lb-cap { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.1; letter-spacing: 0.04em; text-transform: uppercase; text-align: center; }
.lb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 52px; min-height: 52px; padding: 0 14px; border: 2px solid rgba(255, 255, 255, 0.6); border-radius: 3px; background: rgba(8, 23, 44, 0.7); color: var(--white); font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.lb-btn:hover { background: var(--navy-2); border-color: var(--white); }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); padding: 0; }
.lb-prev { left: clamp(12px, 2vw, 32px); }
.lb-next { right: clamp(12px, 2vw, 32px); }
.lightbox[open] .lb-figure { animation: lb-in 0.22s ease-out; }
@keyframes lb-in { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) {
  .lb-figure { justify-content: center; padding: 0 0 100px; }
  .lb-img { max-height: calc(100vh - 240px); max-height: calc(100dvh - 240px); border-radius: 0; }
  .lb-cap { padding: 0 16px; font-size: 19px; }
  .lb-prev, .lb-next { top: auto; bottom: max(20px, env(safe-area-inset-bottom)); transform: none; min-width: 64px; min-height: 56px; }
  .lb-prev { left: 16px; }
  .lb-next { right: 16px; }
}
@media (prefers-reduced-motion: reduce) { .g-link img, .g-filter { transition: none; } .lightbox[open] .lb-figure { animation: none; } }
