/* ==========================================================================
   17-gallery.css — Editorial photo essay / gallery section
   "A year on the land" — mosaic grid with captions
   Sits between #our-mob (menagerie) and #visit
   ========================================================================== */

/* --------------------------------------------------------------------------
   Section wrapper — alternates to --color-paper (menagerie is --color-bone)
   -------------------------------------------------------------------------- */
.gallery {
  background-color: var(--color-paper);
  padding-block: var(--space-120);
}

/* --------------------------------------------------------------------------
   Section intro
   -------------------------------------------------------------------------- */
.gallery__intro {
  max-width: 720px;
  margin-bottom: var(--space-80);
}

.gallery__intro .caps-label {
  display: block;
  margin-bottom: var(--space-16);
}

.gallery__headline {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 400;
  font-variation-settings: 'opsz' 72, 'SOFT' 20, 'wght' 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--color-ink);
  margin-bottom: var(--space-16);
}

.gallery__lead {
  font-size: 18px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--color-ink-60);
  max-width: 580px;
}

/* --------------------------------------------------------------------------
   Mosaic grid — editorial layout, three visual rows
   Row 1: full | third  third  (2 cols: 2fr 1fr 1fr doesn't work cleanly so
                                  we use a 3-col grid: item 1 spans 2, items 2-3 span 1)
   Row 2: half  half
   Row 3: third  third  full
   -------------------------------------------------------------------------- */
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-24);
}

/* --------------------------------------------------------------------------
   Size modifiers
   -------------------------------------------------------------------------- */

/* Spans all 3 columns — full width row */
.gallery__item--full {
  grid-column: 1 / -1;
}

/* Spans 2 of 3 columns */
.gallery__item--two-thirds {
  grid-column: span 2;
}

/* Spans 1 of 3 columns (default — no modifier needed but explicit for clarity) */
.gallery__item--third {
  grid-column: span 1;
}

/* Spans 1.5 of 3 columns — half width (requires 2-column sub-grid; use span 1 on a 2-col row) */
.gallery__item--half {
  grid-column: span 1;
}

/* --------------------------------------------------------------------------
   Figure and photo frame
   -------------------------------------------------------------------------- */
.gallery__item {
  /* Reset figure default margins */
  margin: 0;
  display: flex;
  flex-direction: column;
}

.gallery__photo-frame {
  overflow: hidden;
  border-radius: var(--radius-card);
  flex: 1;
}

/* Landscape frames (default) — 16:9-ish */
.gallery__photo-frame img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-base);
  display: block;
}

/* Hover scale per motion budget — photo scales, frame stays put */
.gallery__item:hover .gallery__photo-frame img {
  transform: scale(1.03);
}

/* --------------------------------------------------------------------------
   Height overrides per size role
   Taller frames for full-bleed and portrait items
   -------------------------------------------------------------------------- */
.gallery__item--full .gallery__photo-frame {
  height: 520px;
}

.gallery__item--full .gallery__photo-frame img {
  min-height: 520px;
}

.gallery__item--two-thirds .gallery__photo-frame {
  height: 400px;
}

.gallery__item--two-thirds .gallery__photo-frame img {
  min-height: 400px;
}

.gallery__item--third .gallery__photo-frame {
  height: 320px;
}

.gallery__item--third .gallery__photo-frame img {
  min-height: 320px;
}

.gallery__item--half .gallery__photo-frame {
  height: 380px;
}

.gallery__item--half .gallery__photo-frame img {
  min-height: 380px;
}

/* Portrait orientation override — taller crop for portrait-format photos */
.gallery__item--portrait .gallery__photo-frame img {
  object-position: center top;
}

/* --------------------------------------------------------------------------
   Captions — Lora italic per design system, hanging below frame
   -------------------------------------------------------------------------- */
.gallery__caption {
  font-family: var(--font-caption);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--color-dust);
  margin-top: var(--space-12);
  /* Match frame width — no wider than the image above */
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Row layout helpers — two items at half width sit in a 2-column sub-section
   achieved by wrapping a pair in a 2-col sub-grid row
   -------------------------------------------------------------------------- */
.gallery__row--halves {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
}

.gallery__row--halves .gallery__item {
  grid-column: auto;
}

/* --------------------------------------------------------------------------
   Tablet: compress to 2-column grid, preserve halves row
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery__item--full {
    grid-column: 1 / -1;
  }

  .gallery__item--two-thirds {
    grid-column: 1 / -1;
  }

  .gallery__item--third {
    grid-column: span 1;
  }

  .gallery__item--full .gallery__photo-frame {
    height: 420px;
  }

  .gallery__item--full .gallery__photo-frame img {
    min-height: 420px;
  }
}

/* --------------------------------------------------------------------------
   Mobile: single column, all items full width
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .gallery {
    padding-block: var(--space-80);
  }

  .gallery__headline {
    font-size: 28px;
  }

  .gallery__grid {
    grid-template-columns: 1fr;
    gap: var(--space-32);
  }

  .gallery__row--halves {
    grid-template-columns: 1fr;
    gap: var(--space-32);
  }

  .gallery__item--full,
  .gallery__item--two-thirds,
  .gallery__item--third,
  .gallery__item--half {
    grid-column: auto;
  }

  .gallery__item--full .gallery__photo-frame,
  .gallery__item--two-thirds .gallery__photo-frame,
  .gallery__item--third .gallery__photo-frame,
  .gallery__item--half .gallery__photo-frame {
    height: 260px;
  }

  .gallery__item--full .gallery__photo-frame img,
  .gallery__item--two-thirds .gallery__photo-frame img,
  .gallery__item--third .gallery__photo-frame img,
  .gallery__item--half .gallery__photo-frame img {
    min-height: 260px;
  }

  .gallery__intro {
    margin-bottom: var(--space-48);
  }
}
