/* mod_filtergallery */
.mod-filtergallery { display: block; }

.mod-filtergallery--filter-left {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  gap: 2rem;
  align-items: start;
}

.mod-filtergallery__filter {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
}
.mod-filtergallery--filter-left .mod-filtergallery__filter {
  flex-direction: column;
  gap: 0;
  /* Continuous white rail down the right edge of the filter, between it and
     the grid. Each active button repaints its own segment green. */
  border-right: 2px solid var(--reformed-white-2, #f1f1f1);
}

.mod-filtergallery__filter-btn {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: .35rem 0;
  font-size: 1.1rem;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.mod-filtergallery__filter-btn.is-active {
  border-bottom-color: currentColor;
}

/* Left rail: swap the underline indicator for a right-edge segment. The button's
   own right border overlaps the rail (negative margin), so it shows white by
   default and green when active. */
.mod-filtergallery--filter-left .mod-filtergallery__filter-btn {
  border-bottom: 0;
  border-right: 2px solid transparent;
  margin-right: -2px;
  padding: .5rem 1.25rem .5rem 0;
}
.mod-filtergallery--filter-left .mod-filtergallery__filter-btn.is-active {
  border-bottom-color: transparent;
  border-right-color: var(--reformed-green, #86c533);
}

.mod-filtergallery__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols-d, 4), 1fr);
  gap: 1rem;
}

/* Transitions during filtering are driven inline by the script (FLIP reflow). */
.mod-filtergallery__item { margin: 0; }
.mod-filtergallery__item.is-hidden { display: none; }

.mod-filtergallery__link {
  position: relative;
  display: block;
  overflow: hidden;
}
.mod-filtergallery__img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.mod-filtergallery__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .25rem;
  padding: 1rem;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .3s ease;
}
.mod-filtergallery__link:hover .mod-filtergallery__overlay,
.mod-filtergallery__link:focus-visible .mod-filtergallery__overlay {
  opacity: 1;
}
.mod-filtergallery__title { font-size: 1.05rem; font-weight: 700; }
.mod-filtergallery__meta { font-size: .85rem; opacity: .85; }

@media (max-width: 1024px) {
  .mod-filtergallery__grid { grid-template-columns: repeat(var(--cols-t, 3), 1fr); }
}
@media (max-width: 640px) {
  .mod-filtergallery--filter-left { grid-template-columns: 1fr; }
  /* Stack to a horizontal filter row; the vertical rail makes no sense here,
     so fall back to the green underline indicator. */
  .mod-filtergallery--filter-left .mod-filtergallery__filter {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    border-right: 0;
  }
  .mod-filtergallery--filter-left .mod-filtergallery__filter-btn {
    border-right: 0;
    margin-right: 0;
    border-bottom: 2px solid transparent;
    padding: .35rem 0;
  }
  .mod-filtergallery--filter-left .mod-filtergallery__filter-btn.is-active {
    border-right-color: transparent;
    border-bottom-color: var(--reformed-green, #86c533);
  }
  .mod-filtergallery__grid { grid-template-columns: repeat(var(--cols-p, 1), 1fr); }
}

/* GLightbox caption: its default white panel hides our light caption text on the
   dark lightbox backdrop. Make the panel transparent and keep the text light. */
.glightbox-container .gslide-description {
  background: transparent;
}
.glightbox-container .gslide-title,
.glightbox-container .gslide-desc {
  color: var(--reformed-white-2, #f1f1f1);
}
