/* ---------- Layout & spacing ---------- */
.team-masonry-section {
  --gap: 16px;
}
.team-masonry-wrapper {
  width: 100%;
}

.team-term-desc {
  margin: 0 0 16px;
  color: #555;
}
.team-term-title{
  margin-bottom: calc(0.8rem + 0.8vw);
}
.team-masonry-grid {
  position: relative; /* Masonry positions children absolutely */
  margin: 0 auto calc(2rem + 1.25vw);
  overflow: hidden; /* smooth container height animation */
}

/* toggled by JS only during FLIP height animation */
.team-masonry-grid.grid-animating {
  transition: height 320ms ease;
}

/* ---------- Card (4 per row desktop, responsive down) ---------- */
.masonry-item {
  font-family: "Gotham";
  box-sizing: border-box;
  width: calc((100% - (var(--gap) * 3)) / 4); /* 4 cols */
  margin-bottom: var(--gap); /* vertical gutter */
}

/* 3 / 2 / 1 columns responsively */
@media (max-width: 1200px) {
  .masonry-item {
    width: calc((100% - (var(--gap) * 2)) / 3);
  }
}
@media (max-width: 900px) {
  .masonry-item {
    width: calc((100% - var(--gap)) / 2);
  }
}
@media (max-width: 560px) {
  .masonry-item {
    width: 100%;
  }
}

/* ---------- Card visuals ---------- */
.team-card {
  background: var(--wp--preset--color--alter-bg, #fff9f4);
  padding: 18px;
  box-sizing: border-box;
  overflow: hidden;
}

.team-card-media {
  width: 100%; /* fills parent container width */
  aspect-ratio: 1 / 1; /* square box */
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  overflow: hidden;
}

/* Header button (accordion toggle) */
.team-card-head {
  font-family: "Gotham";
}
.team-card-title {
  margin-top: 1rem;
  text-align: left;
  margin-bottom: 2.5rem;
}
.team-name {
  margin: 0;
  line-height: 1.25;
  color: var(--wp--preset--color--accent-1);
  font-weight: 500;
  font-size: 1.6rem;
}
.team-position {
  font-size: 1rem;
  color: var(--wp--preset--color--contrast, #444);
  font-weight: 500;
}

.team-content-top {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.team-text {
  font-weight: 400;
  text-align: left;
}

.team-content-top .btn {
  cursor: pointer;
  padding: 20px 25px 20px 15px; /* extra right space for arrow */
  font-weight: 500;
  max-width: 100%;
  width: max-content;
  color: var(--wp--preset--color--base, #fff);
  background-color: var(--wp--preset--color--accent-2, #49bfb5);
  background-image: none;
  position: relative; /* needed for pseudo element positioning */
  flex-basis: 44%;
}

/* arrow as pseudo-element */
.team-content-top .btn::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;
  width: 7px;
  height: 12px;
  background: url("../img/whtArrowRight.svg") no-repeat center / contain;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.3s ease;
}

/* rotate arrow only */
.team-card-head.btn[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(90deg);
}

/* email button variant */
.team-content-top .btn.team-email {
  font-weight: 500;
  background-color: var(--wp--preset--color--accent-1, #9f1115); 
  flex-basis: 56%;
}

.team-lnkdn {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  width: 30px;
  height: 30px;
  background-image: url(../img/lnkdn.svg);
}
.team-lnkdn a {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Smooth accordion ---------- */
.team-card-body {
}

/* inner wrapper keeps padding from affecting the max-height animation */
.team-card-body-inner {
  margin-top: 35px;
  color: #444444;
  font-weight: 500;
}

/* Smooth accordion: height + a little fade */
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 320ms ease, opacity 240ms ease;
  opacity: 0;
  will-change: max-height, opacity;
}

/* When open, we flip to max-height:none in JS; opacity should be 1 */
.accordion-panel[aria-hidden="false"] {
  opacity: 1;
}

/* Container height easing you already have */
.team-masonry-grid.grid-animating {
  transition: height 320ms ease;
}

.team-card-media {
  width: 100%;
  aspect-ratio: 1 / 1; /* square */
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover; /* crop nicely */
  overflow: hidden;
}

/* Sidebar: 2 per row variant */
.team-masonry-grid--2col .masonry-item {
  width: calc((100% - var(--gap)) / 2);
}

.team-masonry-grid--2col .team-card{
  background-color: #fff;
}
@media (max-width: 650px) {
  .team-masonry-grid--2col .masonry-item {
    width: 100%;
  }
}
/* Optional: prefer-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .accordion-panel {
    transition: none;
  }
  .team-masonry-grid.grid-animating {
    transition: none;
  }
}

@media (max-width: 1600px) {
  .team-content-top .btn {
    font-size: 0.9rem;
  }
}
@media (max-width: 1400px) {
  .team-content-top .btn {
    font-size: 0.8rem;
  }
}
