/* Documentary photographs: a quiet contact sheet, full detail on demand. */
.photo-gallery { margin-top: 28px; }
.article-section .photo-gallery-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
  text-align: left;
}
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 20px;
}
.photo-gallery-grid.is-carousel {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.photo-gallery-grid.is-carousel::-webkit-scrollbar { display: none; }
.photo-gallery-grid.is-carousel:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 5px;
}
.photo-gallery-page {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
  align-content: start;
  flex: 0 0 100%;
  min-width: 0;
  gap: 28px 20px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.article-section .photo-gallery-item {
  min-width: 0;
  margin: 0;
  align-self: start;
}
.photo-gallery-link {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--soft);
  border-radius: 2px;
}
.article-section .photo-gallery-link img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  transition: transform .45s ease;
}
.photo-gallery-zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 2px 12px #30303012;
  transition: background .2s ease, color .2s ease;
}
.photo-gallery-zoom svg { width: 18px; height: 18px; }
.photo-gallery-link:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.photo-gallery-link:focus-visible .photo-gallery-zoom { background: var(--red); color: var(--white); }
.article-section .photo-gallery-item figcaption {
  margin: 10px 0 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
  hyphens: none;
}
.photo-gallery-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 24px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: .82rem;
  color: var(--muted);
}
.photo-gallery-navigation { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.photo-gallery-navigation span { min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.photo-gallery-navigation button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  transition: color .2s, border-color .2s;
  cursor: pointer;
}
.photo-gallery-navigation button svg { width: 20px; height: 20px; }
.photo-gallery-navigation button:disabled { opacity: .35; cursor: default; }
.photo-gallery-navigation button:not(:disabled):hover { color: var(--red); border-color: var(--red); }
.photo-gallery-navigation button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.photo-lightbox {
  position: fixed;
  inset: 0;
  width: min(1100px, calc(100vw - 48px));
  height: min(920px, calc(100dvh - 48px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 100px #0004;
  overflow: hidden;
}
.photo-lightbox::backdrop { background: #202320dc; }
.photo-lightbox-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}
.photo-lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.photo-lightbox-header p { margin: 0; font-size: .9rem; }
.photo-lightbox button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
}
.photo-lightbox button svg { width: 20px; height: 20px; }
.photo-lightbox button:hover { border-color: var(--red); color: var(--red); }
.photo-lightbox button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.photo-lightbox-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  padding: 22px;
  background: var(--soft);
}
.photo-lightbox-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.photo-lightbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
}
.photo-lightbox-caption { margin: 0; max-width: 65ch; font-size: .94rem; line-height: 1.5; }
.photo-lightbox-controls { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.photo-lightbox-counter { min-width: 50px; font-size: .82rem; text-align: center; font-variant-numeric: tabular-nums; }
@media (hover: hover) {
  .photo-gallery-link:hover img { transform: scale(1.035); }
  .photo-gallery-link:hover .photo-gallery-zoom { background: var(--red); color: var(--white); }
}
/* Hover reveals the caption; touch layouts keep it permanently available. */
@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
  .article-section .photo-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
  }
  .article-section .photo-gallery-item figcaption {
    position: absolute;
    inset: auto 0 0;
    z-index: 1;
    margin: 0;
    padding: 16px;
    max-height: 100%;
    background: #303030f2;
    color: var(--white);
    font-size: .83rem;
    line-height: 1.5;
    transform: translateY(102%);
    transition: transform .3s cubic-bezier(.2,.65,.3,1);
    pointer-events: none;
  }
  .photo-gallery-item:hover figcaption,
  .photo-gallery-item:focus-within figcaption { transform: translateY(0); }
  .photo-gallery-item .photo-gallery-zoom { top: 10px; bottom: auto; }
  .photo-gallery-link:focus-visible { outline-offset: -3px; }
}
@media (max-width: 600px) {
  .photo-gallery-grid, .photo-gallery-page { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  .article-section .photo-gallery-item figcaption { font-size: .78rem; }
  .photo-gallery-footer { font-size: .78rem; gap: 10px; }
  .photo-gallery-navigation { gap: 8px; }
  .photo-lightbox { width: calc(100vw - 20px); height: calc(100dvh - 20px); }
  .photo-lightbox-header { padding: 10px 14px; }
  .photo-lightbox-header p { font-size: .8rem; line-height: 1.4; }
  .photo-lightbox-stage { padding: 12px; }
  .photo-lightbox-footer { flex-direction: column; align-items: stretch; gap: 14px; padding: 14px; }
  .photo-lightbox-caption { font-size: .85rem; }
  .photo-lightbox-controls { justify-content: center; }
}
@media (max-width: 359px) {
  .photo-gallery-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .photo-gallery-link img, .photo-gallery-zoom, .photo-gallery-item figcaption { transition: none; }
}
