/* full-width background wrapper for the controls */
.spg-controls-wrapper {
  width: 100%;
  border-radius: 20px;
  background: #004c97;
  padding: 30px;          /* adjust vertical padding as you like */
  margin-bottom: 30px;
}

/* inner container to center and constrain width */
.spg-controls {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  gap: 1rem;               /* space between the two controls */
}

/* make each control take up half of the inner width */
.spg-category-filter,
.spg-search {
  width: calc(50% - 0.5rem);  /* subtract half the gap so total is 100% */
  padding: 0.5rem;
  font-size: 1rem;
  box-sizing: border-box;
}

/* optional: style inputs to look good on that dark bg */
.spg-category-filter,
.spg-search {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Base: 4 columns */
.spg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 100%;
  margin: 0 auto;
}

/* List layout overrides */
.spg-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 100%; /* match filter width */
  margin: 0 auto;
}

.spg-list .spg-item {
  border: 1px solid #F4F4F4;
  border-radius: 20px;
  padding: 1rem;
  background: #F4F4F4;
}

/* Use theme styles for post titles; do not override font size */
.spg-list .spg-item .spg-title {
  margin: 0 0 0.5rem;
}

/* Category links */
.spg-category-link {
  color: #0073aa;
  text-decoration: underline;
  cursor: pointer;
  text-align:left;
}

.spg-categories {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: #666;
  text-align:left;
}

.spg-excerpt {
  margin-bottom: 0.5rem;
  text-align:left;
}

.spg-read-more {
  color: #0073aa;
  text-decoration: underline;
  text-align:right;
  display: block;
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
  .spg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Phone: 2 columns */
@media (max-width: 600px) {
  .spg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.spg-item {
  border: 1px solid #eee;
  padding: 1rem;
  text-align: center;
      background: #fff;
}
.spg-thumb {
  /* keep the aspect ratio you like, or set a fixed height */
  padding-bottom: 75%;    /* 4:3 ratio */
  position: relative;     /* if you still want overlay text/labels later */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spg-thumb img {
  /* allow the image to scale down to fit either dimension */
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  /* reset any positioning from before */
  position: static;
}
.spg-thumb img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}
.spg-title {
text-align:left;
  margin: 0.5rem 0 0;
}

/* base state */
.spg-item {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.4s ease;
  will-change: opacity, transform;
}

/* “hidden” state */
.spg-item.is-hidden {
  opacity: 0;
  transform: scale(0.5);
}

/* once we’re fully hidden, this class will knock it out of layout */
.spg-item.out-of-flow {
  display: none;
}