/* Photos page: grid and full-screen viewer. Loaded after site.css. */
.gallery-page { padding-top: calc(var(--header-height) + 64px); min-height: 100vh; }
.gallery-page .wrap { gap: 32px; }
.gallery-page h1 { font-size: 112px; line-height: 0.88; }

.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 200px; grid-auto-flow: dense; gap: 8px; }
.photo-tile { display: block; padding: 0; overflow: hidden; border: 1px solid var(--line); background: var(--surface); cursor: zoom-in; }
.photo-tile picture, .photo-tile img { width: 100%; height: 100%; }
.photo-tile img { object-fit: cover; transition: transform 0.3s ease; }
.photo-tile:hover img { transform: scale(1.03); }
.photo-tile.feature { grid-column: span 2; grid-row: span 2; }
.photo-tile.tall { grid-row: span 2; }

.gallery-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line); }
.photo-credit { font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; color: var(--muted); }

.viewer { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 72px 120px 40px; background: rgb(5 5 5 / 0.97); }
.viewer[hidden] { display: none; }
.viewer-open, .viewer-open body { overflow: hidden; }
.viewer-figure { display: flex; flex-direction: column; align-items: center; gap: 18px; max-width: 100%; max-height: 100%; }
.viewer-image img { width: auto; height: auto; max-width: min(1140px, 100%); max-height: calc(100vh - 180px); object-fit: contain; box-shadow: 0 30px 80px rgb(0 0 0 / 0.7); }
.viewer-caption { font-size: 15px; color: var(--muted); text-align: center; }
.viewer-counter { position: absolute; top: 32px; left: 28px; font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.2em; color: var(--muted); }
.viewer-control { position: absolute; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; padding: 0; background: transparent; border: 1px solid rgb(236 231 220 / 0.3); color: var(--text); cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.viewer-control:hover { border-color: var(--red-text); color: var(--red-text); }
.viewer-close { top: 20px; right: 28px; width: 48px; height: 48px; }
.viewer-prev { left: 32px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 32px; top: 50%; transform: translateY(-50%); }

@media (max-width: 760px) {
  .gallery-page { padding-top: calc(var(--header-height) + 32px); }
  .gallery-page h1 { font-size: 72px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 118px; gap: 4px; }
  .viewer { padding: 72px 12px 96px; }
  .viewer-image img { max-height: calc(100vh - 220px); }
  .viewer-prev, .viewer-next { top: auto; bottom: 24px; transform: none; width: 48px; height: 48px; }
  .viewer-prev { left: calc(50% - 60px); }
  .viewer-next { right: calc(50% - 60px); }
}

@media (prefers-reduced-motion: reduce) {
  .photo-tile img, .viewer-control { transition: none; }
  .photo-tile:hover img { transform: none; }
}
