/* Team Grid — responsive member gallery for the "Team Grid" CMS plugin.
   Replaces the old Slick carousel so every member (up to 50) is visible at
   any viewport width. Scoped under .team-grid / .team-member. */

.team-grid {
  --tg-gap: clamp(1.25rem, 2.5vw, 2rem);
  --tg-radius: var(--radius, 0.5rem);
  --tg-card-offset: 3rem;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: var(--tg-gap);
  margin: 0 0 3rem;
  padding: 0;
  list-style: none;
}

.team-grid__cell {
  display: flex;
  min-width: 0;
}

.team-member {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.team-member__media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--tg-radius);
  background-color: #f2f2f2;
}

.team-member__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.team-member__card {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  margin: calc(var(--tg-card-offset) * -1) 1rem 0;
  text-align: center;
}

.team-member__card .card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 1.25rem 1rem;
}

.team-member__card h4,
.team-member__card p {
  overflow-wrap: anywhere;
}

.team-member__link {
  text-decoration: none;
}

.team-member__link:hover,
.team-member__link:focus {
  text-decoration: underline;
}

.team-member__link:focus-visible {
  outline: 2px solid var(--accent, #ff2a42);
  outline-offset: 2px;
}

/* Narrow phones: loosen the overlap so the card keeps breathing room. */
@media (max-width: 575.98px) {
  .team-grid {
    --tg-gap: 1.25rem;
    --tg-card-offset: 2rem;
  }

  .team-member__card {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }
}

/* Browsers without aspect-ratio support keep a 4:3 box via padding. */
@supports not (aspect-ratio: 4 / 3) {
  .team-member__media {
    height: 0;
    padding-bottom: 75%;
  }

  .team-member__media img {
    position: absolute;
    inset: 0;
  }
}
