/* Each archive row sizes to its tallest card; stretch through Elementor's item wrapper. */
body:is(.page-id-87, .page-id-88) .e-collection-loop-layout-base {
  grid-auto-rows: auto;
  align-items: stretch;
}
body:is(.page-id-87, .page-id-88) .e-collection-loop-layout-base > [data-element_type="e-collection-loop-item"] {
  display: flex;
  align-items: stretch;
}
body:is(.page-id-87, .page-id-88) .e-collection-loop-layout-base > [data-element_type="e-collection-loop-item"] > a.sbm-news-card {
  flex: 1;
}

/* Gallery index cards: full-bleed covers with a light background behind their text. */
body.page-id-88 a.sbm-news-card { background: #f5f5f5; }
body.page-id-88 a.sbm-news-card > .sbm-kicker {
  margin: 0;
  padding: .25rem 1.25rem 0;
}
body.page-id-88 a.sbm-news-card > .sbm-card-title {
  margin: 0;
  padding: 0 1.25rem 1.25rem;
}

body .sbm-gallery-media-count > span:first-child,
body .sbm-gallery-media-count > em:first-child {
  display: block;
  flex: none;
  width: 1rem;
  height: 1rem;
  background: url("icon-gallery-photo.svg") center / contain no-repeat;
}
body .sbm-gallery-media-count > em:first-child { background-image: url("icon-gallery-video.svg"); }
body .sbm-gallery-media-count > span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Matching year and category navigation across the gallery and news indexes. */
body .sbm-gallery-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
}
body .sbm-gallery-filter-list a.sbm-year-link,
body.page-id-87 a.sbm-gallery-filter {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .625rem 1rem;
  border: 1px solid #e5e5e5;
  background: #f5f5f5;
  color: #181818;
  font: 500 .82rem/1.5 "Poppins", system-ui, sans-serif;
  text-transform: none;
  letter-spacing: normal;
  border-radius: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .18s, border-color .18s, color .18s;
}
body .sbm-gallery-filter-list a.sbm-year-link:is(:hover, :focus-visible),
body .sbm-gallery-filter-list a.sbm-year-current,
body.page-id-87 a.sbm-gallery-filter:is(:hover, :focus-visible),
body.page-id-87 a.sbm-gallery-filter.sbm-year-current {
  background: var(--sbm-orange, #ff6600);
  border-color: var(--sbm-orange, #ff6600);
  color: #fff;
}
body .sbm-gallery-filter-list a.sbm-year-current:is(:hover, :focus-visible),
body.page-id-87 a.sbm-gallery-filter.sbm-year-current:is(:hover, :focus-visible) {
  background: #e65c00;
  border-color: #e65c00;
}

/* Preserve each photograph's orientation within its thumbnail frame. */
body .elementor-widget-theme-post-content .wp-block-gallery img {
  object-fit: cover;
  object-position: center top;
}
body.single-sbm_gallery .wp-block-gallery.has-nested-images figure.wp-block-image {
  flex-grow: 0;
  aspect-ratio: 1 / 1;
}
body.single-sbm_gallery .wp-block-gallery.has-nested-images figure.wp-block-image > a {
  display: block;
  width: 100%;
  height: 100%;
}
body.single-sbm_gallery .elementor-widget-theme-post-content .wp-block-gallery img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}

.sbm-lightbox {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4rem 4.5rem 1rem;
  border: 0;
  background: #111;
  color: #fff;
  overflow: hidden;
}
.sbm-lightbox[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
}
.sbm-lightbox::backdrop { background: #000e; }
.sbm-lightbox-stage { min-width: 0; min-height: 0; }
.sbm-lightbox-stage img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.sbm-lightbox-footer {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 1.25rem;
  font-size: .75rem;
  line-height: 1.5;
}
.sbm-lightbox-caption { padding: 0; margin: 0; color: #ccc; font-size: inherit; }
.sbm-lightbox-counter { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sbm-lightbox .sbm-lightbox-close,
.sbm-lightbox .sbm-lightbox-nav {
  box-sizing: border-box;
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff55;
  border-radius: 50%;
  background: #ffffff12;
  color: #fff;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.sbm-lightbox .sbm-lightbox-close { top: 1rem; right: 1rem; font: 30px/1 Arial, sans-serif; }
.sbm-lightbox-nav { top: 50%; transform: translateY(-50%); }
.sbm-lightbox-previous { left: 1rem; }
.sbm-lightbox-next { right: 1rem; }
.sbm-lightbox-nav::before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateX(-2px) rotate(-45deg);
}
.sbm-lightbox-previous::before { transform: translateX(2px) rotate(135deg); }
.sbm-lightbox .sbm-lightbox-nav[hidden] { display: none; }
.sbm-lightbox button:is(:hover, :focus-visible) { background: #ff6600; border-color: #ff6600; color: #fff; }
.sbm-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (max-width: 767px) {
  .sbm-lightbox { padding: 4rem .5rem 4.5rem; }
  .sbm-lightbox-footer { display: block; text-align: center; font-size: .625rem; }
  .sbm-lightbox-caption { margin-top: .25rem; }
  .sbm-lightbox .sbm-lightbox-nav { top: auto; bottom: .75rem; transform: none; background: #292929; }
  .sbm-lightbox-previous { left: calc(50% - 54px); }
  .sbm-lightbox-next { right: calc(50% - 54px); }
}
@media (prefers-reduced-motion: reduce) {
  .sbm-lightbox button { transition: none; }
}
