/* ==========================================================================
   Guiding team — homepage strip + full team page
   ========================================================================== */

.ne-team {
  margin-top: 56px;
}

/* Flex with a fixed basis rather than a 4-column grid. A grid pins cards to
   the left of their tracks, so a team of two sat in the first two slots with
   the right half of the row empty. This keeps the card width identical at four
   and centres any smaller number. */
.ne-team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ne-team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Four across: the basis subtracts the three gaps between them. */
  flex: 0 1 calc((100% - 66px) / 4);
  /* A flex item's default min-width is auto, so a long single-word name
     would floor the item and blow the row out sideways. */
  min-width: 0;
  padding: 26px 16px 22px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(36, 49, 39, 0.04);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.ne-team-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* ── The circle ── */

.ne-team-avatar {
  display: block;
  width: 100%;
  max-width: 132px;
  /* height: auto is load-bearing. wp_get_attachment_image() writes a height
     attribute, which counts as a specified height and stops aspect-ratio
     resolving — without this the circle renders as a tall oval. */
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  /* Faces sit in the upper third of a portrait crop; centring the cover box
     would slice the top of the head off on anything not shot square. */
  object-position: center 28%;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 0 0 6px var(--tint);
}

/* Shown until a portrait is uploaded — deliberate, not a broken frame. */
.ne-team-avatar.is-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(36, 49, 39, 0.34);
  background:
    radial-gradient(70% 60% at 50% 24%, rgba(var(--gold-rgb), 0.34), rgba(var(--gold-rgb), 0) 62%),
    linear-gradient(160deg, var(--tint) 0%, var(--surface) 100%);
}

/* ── Name, role, experience ── */

.ne-team-name {
  margin: 0 0 3px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--text);
  /* Long names wrap rather than pushing the card wide. */
  overflow-wrap: anywhere;
}

.ne-team-role {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--accent-dark);
}

.ne-team-exp {
  margin: 0;
  padding: 5px 13px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--gold-ink);
  background: rgba(var(--gold-rgb), 0.2);
  border-radius: 999px;
}

/* A card with no role still needs air between the name and the pill. */
.ne-team-name + .ne-team-exp {
  margin-top: 9px;
}

/* ── Full team page ── */

.team-page {
  max-width: 1180px;
}

.team-intro {
  margin-bottom: 26px;
  padding: 34px;
  background:
    radial-gradient(74% 58% at 86% 8%, rgba(var(--gold-rgb), 0.26), rgba(var(--gold-rgb), 0) 60%),
    linear-gradient(158deg, var(--tint) 0%, var(--tint-2) 56%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
}

.team-title {
  margin: 0;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
  text-wrap: balance;
}

.team-intro-body {
  max-width: 68ch;
  margin-top: 14px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--body);
}

/* Same reasoning as .ne-team-grid: centre whatever number there is. */
.team-page-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 calc((100% - 36px) / 3);
  min-width: 0;
  padding: 30px 22px 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.team-member .ne-team-avatar {
  max-width: 148px;
}

.team-member .ne-team-name {
  font-size: 19px;
}

.team-member-bio {
  margin: 16px 0 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--body);
}

.team-member-meta {
  width: 100%;
  margin: 18px 0 0;
  padding: 16px 0 0;
  text-align: left;
  border-top: 1px solid var(--border);
}

.team-member-meta > div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
}

.team-member-meta dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-member-meta dd {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--body);
  overflow-wrap: anywhere;
}

.team-cta-card {
  margin-top: 18px;
}

.team-cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 6px;
}

/* ── Responsive ── */

@media (max-width: 1000px) {
  .team-member {
    flex-basis: calc((100% - 18px) / 2);
  }
}

@media (max-width: 780px) {
  /* Two up rather than four. Four 150px cards need ~700px before the circles
     shrink below the point where a face is recognisable. */
  .ne-team-grid {
    gap: 14px;
  }

  .ne-team-card {
    flex-basis: calc((100% - 14px) / 2);
    padding: 22px 12px 18px;
  }

  .ne-team-avatar {
    max-width: 112px;
  }
}

@media (max-width: 700px) {
  .team-member {
    flex-basis: 100%;
  }

  .team-member-meta > div {
    /* The 108px label column leaves too little for "Basic Mountaineering
       Course, ABVIMAS" on a phone; stack instead. */
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

@media (max-width: 600px) {
  .ne-team {
    margin-top: 40px;
  }

  .team-intro {
    padding: 24px 18px;
    border-radius: 20px;
  }

  .team-member {
    padding: 24px 18px 20px;
  }

  .ne-team-avatar {
    max-width: 96px;
    box-shadow: 0 0 0 1px var(--border), 0 0 0 4px var(--tint);
  }

  .ne-team-avatar.is-initial {
    font-size: 27px;
  }

  .ne-team-name {
    font-size: 15.5px;
  }

  .ne-team-role {
    margin-bottom: 10px;
    font-size: 12.5px;
  }

  .ne-team-exp {
    padding: 4px 11px;
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ne-team-card {
    transition: none;
  }

  .ne-team-card:hover {
    transform: none;
  }
}
