/*
  Firewatch Staggered Grid
  Turns a summary block into alternating image/text rows, one item per row.
  Even rows flip the image to the right on desktop. Stacks on mobile.

  Usage: add -grid-staggered to the section ID.
    stories-grid-staggered
*/

body .page-section[id*="-grid-staggered"] .summary-item-list {
  display: grid !important;
  gap: 40px;
  grid-template-columns: 1fr !important;
}

body .page-section[id*="-grid-staggered"] .summary-item {
  width: 100% !important;
}

/* Items without a clickable wrap link */
body .page-section[id*="-grid-staggered"] .summary-item:not(:has(.summary-wrap-link)) {
  display: grid !important;
  gap: 40px;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr;
  align-items: center;
}

/* Items wrapped in a clickable link (Squarespace adds a.summary-wrap-link) */
body .page-section[id*="-grid-staggered"] .summary-item .summary-wrap-link {
  display: grid !important;
  gap: 20px;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr;
  align-items: center;
}

@media screen and (max-width: 768px) {
  body .page-section[id*="-grid-staggered"] .summary-item:not(:has(.summary-wrap-link)),
  body .page-section[id*="-grid-staggered"] .summary-item .summary-wrap-link {
    grid-template-columns: 1fr !important;
  }
}

/* Even rows: image on the right */
@media screen and (min-width: 769px) {
  body .page-section[id*="-grid-staggered"] .summary-item:nth-child(even) .summary-wrap-link .summary-thumbnail-outer-container,
  body .page-section[id*="-grid-staggered"] .summary-item:nth-child(even):not(:has(.summary-wrap-link)) .summary-thumbnail-outer-container {
    order: 2 !important;
  }
  body .page-section[id*="-grid-staggered"] .summary-item:nth-child(even) .summary-wrap-link .summary-content,
  body .page-section[id*="-grid-staggered"] .summary-item:nth-child(even):not(:has(.summary-wrap-link)) .summary-content {
    order: 1 !important;
  }
}

body .page-section[id*="-grid-staggered"] .summary-item:nth-child(even) .summary-wrap-link .summary-metadata,
body .page-section[id*="-grid-staggered"] .summary-item:nth-child(even):not(:has(.summary-wrap-link)) .summary-metadata {
  left: unset;
  right: 20px;
}
