/* ===== Meet the Team — Flip Cards ===== */

.team {
  width: 100%;
  box-sizing: border-box;
  /* Mobile-first: mobile top/bottom padding + shared side padding.
     Desktop top/bottom is applied at >=768px below. */
  padding: var(--team-pad-top-m, 80px) var(--team-pad-right, 20px) var(--team-pad-bottom-m, 80px) var(--team-pad-left, 20px);
}
@media (min-width: 768px) {
  .team {
    padding-top: var(--team-pad-top, 135px);
    padding-bottom: var(--team-pad-bottom, 135px);
  }
}
.team *,
.team *::before,
.team *::after { box-sizing: border-box; }

.team__inner {
  max-width: 1170px;
  margin: 0 auto;
}

/* ---- Header ---- */
.team__header { margin: 0 0 44px; }

.team__heading {
  margin: 0;
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 34px);
  line-height: 1.14;
  color: var(--team-heading, #ffffff);
}

.team__subtext {
  margin: 12px 0 0;
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--team-heading, #ffffff);
  opacity: 0.9;
}

/* ---- Layout (mobile-first: swipe carousel) ---- */
.team__grid {
  list-style: none;
  /* Bleed the track to the right screen edge so the next card peeks fully
     (negative margin cancels the section's right padding). */
  margin: 0 calc(var(--team-pad-x, 24px) * -1) 0 0;
  padding: 0 0 10px;
  display: flex;
  gap: 25px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;      /* Firefox */
}
.team__grid::-webkit-scrollbar { display: none; } /* Safari/Chrome */

/* Trailing spacer: lets the LAST card scroll-snap to the left like the others
   (visible width - one card - gap). Removed on tablet+ (see media query). */
.team__grid::after {
  content: "";
  flex: 0 0 max(0px, calc(100vw - var(--team-pad-left, 24px) - 273.75px - 25px));
}

.team__cell {
  perspective: 1400px;
  display: flex;
  justify-content: center;
  flex: 0 0 273.75px;         /* fixed card width per design (273.75 x 357) */
  scroll-snap-align: start;
}

/* ---- Card + flip ---- */
.team__card {
  position: relative;
  width: 273.75px;
  height: 357px;
  cursor: pointer;
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
}

.team__flipper {
  position: absolute;
  inset: 0;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.team__card.is-flipped .team__flipper {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.team__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: var(--team-card-bg, #ffffff);
  border: 1px solid var(--team-border, #cbd4e1);
  border-radius: 10px;
  overflow: hidden;
  -webkit-transform: rotateY(0deg); 
  transform: rotateY(0deg);
  
}

.team__face--back {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Right padding is small so the bio's scrollbar sits near the card edge;
     the text keeps its 23px inset via padding on .team__meta / .team__bio. */
  padding: 38px 4px 72px 23px;
}

.team__face--back .team__meta { padding-right: 19px; }

/* 32px fade between the bio and the toggle button, instead of a hard cut.
   Stops short of the scrollbar (4px gap + 6px bar). */
.team__face--back::after {
  content: "";
  position: absolute;
  left: 0;
  right: 10px;
  bottom: 72px;
  height: 32px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--team-card-bg, #ffffff));
  pointer-events: none;
}

/* ---- Meta (name + role) ---- */
.team__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team__face--front .team__meta {
  position: absolute;
  top: 38px;
  left: 23px;
  right: 23px;
  z-index: 2;
}

.team__name {
  margin: 0;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.35;
  color: var(--team-name, #0a3e72);
}

.team__role {
  margin: 0;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--team-role, #0a3e72);
}

/* ---- Front photo ----
   Figma 17063:4562: photo box is 249px tall (card is 357), full card width,
   pinned to the card's bottom edge. Inside it the photo is 94.2% wide,
   centred, bottom-aligned, with any overflow cropped from the top. */
.team__photo {
  overflow: hidden;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 248px;              /* 249px in Figma, less the 1px card border it sits inside */
  z-index: 1;
  border-radius: 0 0 9px 9px; /* follows the card's inner corner */
}

.team__photo-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 94.2%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.team__photo-img--placeholder {
  background: linear-gradient(160deg, #e2e8f0 0%, #cbd4e1 100%);
}

/* ---- Back bio ---- */
.team__bio {
  color: var(--team-bio, #0a3e72);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* 13px + 6px scrollbar + 4px face padding = the 23px text inset.
     Bottom padding lets the last line scroll clear of the fade. */
  padding: 0 13px 32px 0;
}
.team__bio > :first-child { margin-top: 0; }
.team__bio > :last-child { margin-bottom: 0; }

/* Slim rounded scrollbar (Chrome, Edge, Safari) */
.team__bio::-webkit-scrollbar { width: 6px; }
.team__bio::-webkit-scrollbar-track { background: transparent; }
.team__bio::-webkit-scrollbar-thumb {
  background: var(--team-border, #cbd4e1);
  border-radius: 999px;
}
.team__bio::-webkit-scrollbar-thumb:hover { background: var(--team-toggle, #0048c6); }

/* Firefox has no ::-webkit-scrollbar; use the standard properties there only
   (setting them in Chrome would override the custom bar above). */
@supports not selector(::-webkit-scrollbar) {
  .team__bio {
    scrollbar-width: thin;
    scrollbar-color: var(--team-border, #cbd4e1) transparent;
  }
}

/* ---- Toggle button ---- */
.team__toggle {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  margin: 0;
  background: var(--team-toggle-bg, #ffffff);
  border: 1px solid var(--team-border, #cbd4e1);
  border-radius: 10px;
  color: var(--team-toggle, #0048c6);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.team__toggle-icon {
  display: inline-flex;
  line-height: 0;
}

.team__toggle-icon[hidden] { display: none; }

.team__card:hover .team__toggle,
.team__toggle:focus-visible {
  background: var(--team-toggle, #0048c6);
  color: var(--team-toggle-bg, #ffffff);
}

.team__toggle:focus-visible {
  outline: 3px solid var(--team-toggle, #0048c6);
  outline-offset: 3px;
}

.team__card:hover .team__flipper {
  /* subtle lift cue on hover, kept flat so it doesn't fight the flip */
  box-shadow: 0 10px 24px rgba(10, 62, 114, 0.18);
  border-radius: 10px;
}

/* ---- Tablet: always 2 columns ---- */
@media (min-width: 768px) {
  .team__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 25px;
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .team__cell { scroll-snap-align: none; }  /* cell keeps its fixed 273.75px width */
  .team__grid::after { display: none; }
  /* .team__card stays fixed 273.75 x 357 (base rule) at every breakpoint */
}

/* ---- Desktop: author-chosen columns ---- */
@media (min-width: 1025px) {
  /* Cap the row to N fixed cards (N*273.75 + (N-1)*25); narrower screens wrap. */
  .team--cols-2 .team__grid { max-width: 572.5px; }
  .team--cols-3 .team__grid { max-width: 871.25px; }
  .team--cols-4 .team__grid { max-width: 1170px; }
}

/* ---- Reduced motion: no spin, instant swap ---- */
@media (prefers-reduced-motion: reduce) {
  .team__flipper { transition: none; }
}

/* ===== Carousel controls (mobile only) ===== */
.team__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.team__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  max-width: 220px;
}

.team__dot {
  flex: 1 1 0;
  min-width: 18px;
  max-width: 46px;
  height: 3px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--team-border, #cbd4e1);
  cursor: pointer;
  transition: background-color 0.25s ease;
}
.team__dot.is-active { background: var(--team-accent, #f9550f); }
.team__dot:focus-visible { outline: 3px solid var(--team-accent, #f9550f); outline-offset: 4px; }

.team__nav {
  display: flex;
  gap: 16px;
  flex: 0 0 auto;
}

.team__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background-color: var(--team-toggle-bg, #ffffff);
  color: var(--team-name, #0a3e72);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.team__arrow:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); }
.team__arrow:focus-visible { outline: 3px solid #ffffff; outline-offset: 3px; }
.team__arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.team__arrow svg { display: block; }

/* Mobile heading is centred (per the mobile design) */
.team__heading,
.team__subtext { text-align: center;}

/* Tablet + desktop: static grid, no carousel controls, left-aligned heading */
@media (min-width: 768px) {
  .team__controls { display: none; }
  .team__heading,
  .team__subtext { text-align: left; }
}

@media(max-width:767px){
  .team__controls{margin-top:38px;}
}
