/**
 * Team page presentation.
 * Data belongs to AIEDI Core; this file only controls layout and interaction.
 */

.team-page .section--team {
  padding-block: clamp(2.5rem, 5vw, 5rem);
}

.team-page .team-groups {
  display: grid;
  gap: clamp(2rem, 4vw, 4rem);
}

.team-page .team-group {
  display: grid;
  grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--aiedi-border);
  border-bottom: 0;
}

.team-page .team-group:first-child {
  border-top: 0;
}

.team-page .team-group__intro {
  min-width: 0;
}

.team-page .team-group__intro h2 {
  margin: 1rem 0 .5rem;
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
}

.team-page .team-group__intro p {
  margin: 1rem 0 0;
  line-height: 1.65;
}

.team-page .team-group__content {
  min-width: 0;
}

/*
 * Desktop rule: every group reserves four equal card slots. A group with one,
 * two or three people does NOT stretch its cards; the remaining slots stay
 * intentionally empty. Five or more people become a carousel with four cards
 * visible at a time.
 */
.team-page .team-group--static .team-scroller {
  display: grid;
  grid-auto-flow: row;
  grid-auto-columns: auto;
  scroll-snap-type: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.9rem, 1.6vw, 1.25rem);
  overflow: visible;
}

.team-page .team-group--carousel .team-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (3 * clamp(.9rem, 1.6vw, 1.25rem))) / 4);
  gap: clamp(.9rem, 1.6vw, 1.25rem);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  padding-block: .1rem .6rem;
}

.team-page .team-card {
  position: relative;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--aiedi-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--aiedi-shadow-soft);
  scroll-snap-align: start;
}

.team-page .team-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #eef3f9;
}

.team-page .team-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--team-focus-x, 50%) var(--team-focus-y, 32%);
}

.team-page .team-card__content {
  flex: 1 1 auto;
  min-height: 8.75rem;
  padding: 1rem 1rem 1.15rem;
}

.team-page .team-card__content h3 {
  margin: 0 0 .35rem;
  color: var(--aiedi-navy);
  font-size: clamp(.96rem, 1.2vw, 1.08rem);
  line-height: 1.28;
}

.team-page .team-card__content p {
  margin: 0;
  color: var(--aiedi-blue);
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: start !important;
  text-align-last: start !important;
  word-spacing: normal !important;
  letter-spacing: normal;
}

.team-page .team-card--no-photo {
  min-height: 20rem;
}

.team-page .team-card--no-photo .team-card__content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Professional contact treatment: controls live on the photograph, not below
 * the biography. They remain keyboard reachable and retain 44px targets. */

/* Country badges are content (from AIEDI Core) but presentation belongs here. */
.team-page .team-card__flags {
  position: absolute;
  z-index: 3;
  top: .75rem;
  left: .75rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .4rem;
  border: 1px solid rgba(7, 24, 69, .16);
  border-radius: .65rem;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 14px rgba(7, 24, 69, .12);
}

.team-page .team-card__flag {
  display: block;
  width: 1.875rem;
  height: 1.25rem;
  object-fit: cover;
  border: 1px solid rgba(7, 24, 69, .18);
  border-radius: .2rem;
}

.team-page .team-card__contact-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

.team-page .team-card__contact-actions {
  position: absolute;
  z-index: 2;
  top: .75rem;
  right: .75rem;
  display: flex;
  gap: .45rem;
}

.team-page .team-card__contact-button {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(7, 24, 69, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  color: var(--aiedi-blue);
  box-shadow: 0 4px 14px rgba(7, 24, 69, .12);
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.team-page .team-card__contact-button .aiedi-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.team-page .team-card__contact-button:hover {
  border-color: currentColor;
  background: #fff;
  color: var(--aiedi-navy);
  box-shadow: 0 6px 18px rgba(7, 24, 69, .18);
}

.team-page .team-card__contact-button:focus-visible {
  outline: 3px solid #111;
  outline-offset: 4px;
  box-shadow: 0 0 0 3px #fff;
}

/* AIEDI_POST_PHASE3_TEAM_EMAIL_20260906: keep each structured address visible
 * while the same link opens a pre-addressed Gmail web compose window. */
.team-page .team-card__email {
  margin-top: .75rem;
}

.team-page .team-card__email-link {
  display: inline-flex;
  align-items: flex-start;
  gap: .45rem;
  max-width: 100%;
  color: var(--aiedi-blue-dark);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

.team-page .team-card__email-link .team-card__contact-icon {
  flex: 0 0 1.25rem;
  margin-top: .05rem;
}

.team-page .team-card__email-link span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.team-page .team-card__email-link:focus-visible {
  outline: 3px solid #111;
  outline-offset: 4px;
  box-shadow: 0 0 0 3px #fff;
}

.team-page .scroller-controls {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid #dfe6ef;
}

.team-page .scroller-controls::before {
  content: '';
  position: absolute;
  top: -2px;
  left: var(--team-progress-left, 0%);
  width: 20%;
  height: 3px;
  background: var(--aiedi-orange);
  transition: left .25s ease;
}

.team-page .scroller-button {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--aiedi-border);
  border-radius: 999px;
  background: #fff;
  color: var(--aiedi-blue);
}

.team-page .scroller-button:hover:not(:disabled),
.team-page .scroller-button:focus-visible {
  border-color: currentColor;
}

.team-page .scroller-button:focus-visible {
  outline: 3px solid #111;
  outline-offset: 4px;
  box-shadow: 0 0 0 3px #fff;
}

.team-page .scroller-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .team-page .team-group {
    grid-template-columns: minmax(170px, 200px) minmax(0, 1fr);
  }

  .team-page .team-group--static .team-scroller {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-page .team-group--carousel .team-scroller {
    grid-auto-columns: calc((100% - clamp(.9rem, 1.6vw, 1.25rem)) / 2);
  }
}

@media (max-width: 760px) {
  .team-page .team-group {
    grid-template-columns: 1fr;
  }

  .team-page .team-group__intro {
    max-width: 38rem;
  }

  .team-page .team-group--static .team-scroller {
    grid-template-columns: 1fr;
  }

  .team-page .team-group--carousel .team-scroller {
    grid-auto-columns: 86%;
  }

  .team-page .team-card__content {
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .team-page .team-group--carousel .team-scroller {
    grid-auto-columns: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .team-page .team-card__contact-button,
  .team-page .team-card__email-link,
  .team-page .scroller-controls::before {
    transition: none;
  }
}

/* High-contrast/forced-colors compatibility. */
@media (forced-colors: active) {
  .team-page .team-card,
  .team-page .team-card__contact-button,
  .team-page .scroller-button {
    border: 1px solid CanvasText;
  }

  .team-page .team-card__contact-button:focus-visible,
  .team-page .scroller-button:focus-visible {
    outline-color: Highlight;
  }
}

/* Final architectural cleanup: the content column must not clip card shadows or
 * the contact controls that sit over the photograph. */
.team-page .team-group__content {
  overflow: visible;
}

.team-page .team-card--no-photo .team-card__content {
  padding-top: 4.5rem;
}


/* Informational images and contact icons keep their normal rendering without
 * forcing visibility. This lets accessibility tools intentionally hide images
 * using visibility/opacity/display while preserving the unchanged default UI. */

/* Linked research profile: only the photograph becomes the navigation target,
 * leaving e-mail/LinkedIn controls independent and avoiding nested links. */
.team-page .team-card__research-link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.team-page .team-card__research-link .team-card__image {
  transition: transform .2s ease, filter .2s ease;
}
.team-page .team-card__research-link:hover .team-card__image {
  transform: scale(1.025);
  filter: saturate(1.03);
}
.team-page .team-card__research-link:focus-visible {
  outline: 3px solid #111;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}
@media (prefers-reduced-motion: reduce) {
  .team-page .team-card__research-link .team-card__image { transition: none; }
  .team-page .team-card__research-link:hover .team-card__image { transform: none; }
}

/* 1.3.00 — WCAG AA: meaningful carousel-position indicator >= 3:1. */
.team-page .scroller-controls::before {
  background: #b45a00;
}
