/* gallery.css
 * Photo layouts for news posts beyond the cover image: .article-photos rows
 * set between paragraphs, and the .photo-gallery slider. Loaded only by the
 * posts that use them, so styles.css and its cache-busting version stay
 * untouched.
 */


/* .article-photos
 * One to three photos in a row right after the paragraph they illustrate,
 * inside .article__body. Each figure grows in proportion to its photo's
 * aspect ratio (--ar = width / height, set inline), so every photo in the row
 * ends up the same height without cropping. Stacks on phones.
 */
.article-photos {
  display: flex;
  align-items: flex-start;
  gap: 0.833rem;
  margin: 2.222rem 0 2.5rem;
}
.article-photos:last-child { margin-bottom: 1.222rem; }   /* same gap to "Back to updates" as a closing paragraph */
.article-photos > .article-photos__item {   /* beats .article__body figure */
  flex: var(--ar, 1) 1 0;
  min-width: 0;
  margin: 0;
}
.article-photos__caption {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.889rem;
  line-height: 1.444rem;
  color: var(--c-accent);
  margin: 0.667rem 0 0;
}
/* Wide row: steps out of the 900px text column into the container's spare
 * width, up to 140px each side, so a row of three photos keeps the height of
 * a pair. 53.333rem = the column plus both container gutters; below that
 * the row simply fits the column. */
.article-photos--wide {
  --out: clamp(0px, (100vw - 53.333rem) / 2, 7.778rem);
  margin-left: calc(-1 * var(--out));
  margin-right: calc(-1 * var(--out));
}

@media (max-width: 543.98px) {
  .article-photos { flex-direction: column; align-items: stretch; gap: 1.667rem; }
  .article-photos > .article-photos__item { flex: none; }
}


/* .photo-gallery
 * Swipeable photo gallery inside a news post (.article). One photo per view
 * in a 3:2 frame (4:5 on phones) so portrait and landscape shots both fit
 * uncropped; caption under the photo; sage round buttons and an "N / M"
 * counter below, matching the homepage Latest Updates carousel. The viewport
 * is a native horizontal scroller with snap points, so touch swipe, trackpad
 * and arrow keys work by themselves. JS lives in /assets/js/gallery.js.
 */
.photo-gallery {
  margin: 2.778rem 0 0;
}
.photo-gallery__viewport {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;                    /* Firefox */
}
.photo-gallery__viewport::-webkit-scrollbar { display: none; }
.photo-gallery__viewport:focus-visible {
  outline: 1px solid var(--c-accent);
  outline-offset: 0.278rem;
}
.photo-gallery__slide {
  flex: 0 0 100%;
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;                 /* one photo per swipe */
}
.photo-gallery__frame {
  aspect-ratio: 3 / 2;
  background: rgba(0, 0, 0, 0.18);
}
.photo-gallery__frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.photo-gallery__caption {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.889rem;
  line-height: 1.444rem;
  color: var(--c-accent);
  margin: 0.833rem 0 0;
}
.photo-gallery__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.111rem;
  margin: 1.667rem 0 0;
}
.photo-gallery__nav {
  appearance: none;
  border: 1px solid var(--c-accent);
  background: transparent;
  color: var(--c-accent);
  width: 2.778rem;
  height: 2.778rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.photo-gallery__nav:hover { color: var(--c-fg-light); background: rgba(136, 161, 154, 0.18); }
.photo-gallery__nav:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
  color: var(--c-accent);
}
.photo-gallery__nav svg { width: 0.778rem; height: 0.778rem; fill: currentColor; }
.photo-gallery__count {
  min-width: 3.889rem;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.833rem;
  letter-spacing: 0.067rem;
  text-align: center;
  color: var(--c-accent);
}

@media (max-width: 543.98px) {
  .photo-gallery__frame { aspect-ratio: 4 / 5; }
}
