/* ==========================================================================
   Why Somerset County — captioned photography blocks
   The Set for Fun sub-pages are built from three arrangements of one figure:
   a full-bleed-of-the-column band, a half column beside a run of text, and a
   two-up grid. Loaded after css/styles.css; relies on the --ws-* tokens there.
   Design reference: WhySomerset_Website_2026_Fun.pdf, pages 3-5
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. The figure
   Comp geometry, all inside the 1040 content column at 1440:
     band  1040 x 340   split  520 x 340   grid  496 x 340
   Corner radius measured off the placed frames at 21.5, hence 1.49vw.
   -------------------------------------------------------------------------- */
.media { margin: 0; }

.media__img {
  width: 100%;
  object-fit: cover;
  border-radius: clamp(12px, 1.49vw, 22px);
  background: rgba(0, 0, 0, .04);
}

.media--band  .media__img { aspect-ratio: 1040 / 340; }
.media--split .media__img { aspect-ratio:  520 / 340; }
.media--grid  .media__img { aspect-ratio:  496 / 340; }

.media__caption {
  margin-top: clamp(8px, .83vw, 12px);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ws-ink);
  text-align: center;
}

/* --------------------------------------------------------------------------
   2. Blocks
   Each arrangement is a top-level block in the page stack, so its own padding
   plus the neighbouring .prose padding makes the gap the comp draws.
   -------------------------------------------------------------------------- */
/* Split: photo in one half, heading + copy in the other. The comp gives the
   photo a true half (520) and insets the text by a 40 gutter, leaving 480 —
   the columns are deliberately unequal, not a 50/50 with a gap. */
.media-row {
  display: grid;
  grid-template-columns: 50% 1fr;
  column-gap: 3.846%;
  align-items: start;
}
.media-row--text-first { grid-template-columns: 1fr 50%; }
.media-row--text-first .media { order: 2; }

/* Life splits its rows down the middle instead — 496 / 48 / 496, the same
   track as .media-grid — so the two arrangements sit side by side on a page
   without the columns shifting under the reader. */
.media-row--even,
.media-row--even.media-row--text-first {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 4.615%;
}

/* The heading opens the text column, so its usual top margin would push it off
   the top of the photo it is meant to sit beside. */
.media-row__text > .subhead:first-child { margin-top: 0; }

/* Two-up: 496 columns with a 48 gutter, and enough room under a caption for
   the next row's photo. */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 4.615%;
  row-gap: clamp(30px, 4.06vw, 58px);
}

/* --------------------------------------------------------------------------
   3. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  /* One column: the photo leads, the copy follows, whichever side it sat on.
     --even carries two classes' worth of specificity, so it has to be named
     here or its 50/50 track survives into the phone layout. */
  .media-row,
  .media-row--text-first,
  .media-row--even,
  .media-row--even.media-row--text-first,
  .media-grid { grid-template-columns: minmax(0, 1fr); }

  .media-row { row-gap: clamp(16px, 4vw, 24px); }
  .media-row--text-first .media { order: -1; }

  /* The comp's crops are drawn for a 1040 column. Squeezed into a phone width
     they turn into slivers - the band worst of all, at 3:1 - so each one opens
     up and object-fit takes the difference out of the sides. */
  .media--split .media__img,
  .media--grid  .media__img { aspect-ratio: 3 / 2; }
  .media--band  .media__img { aspect-ratio: 2 / 1; }
}

/* Photo credits run inline at the end of a caption, set back so the caption
   still reads as one sentence with its source attached. Matches .gallery__credit. */
.media__credit { color: #6c7478; }
