/* Contributor deck ("The people behind the platform")
   team.js renders the people in team-data.js into .tm-track and positions the cards; this file
   styles them. Cards are landscape on wide screens (portrait left, profile right) and stack the
   portrait above the profile on narrow ones. Each portrait is a transparent cutout framed by its
   face (--fx, --fy and --fw from the data), so everyone sits at the same size and eye line, with
   the top of the head rising just out of the backdrop.
   --------------------------------------------------------------------------------------------- */

.team-section .team-intro {
  margin-bottom: 12px;
}

.tm-deck {
  --tm-w: min(860px, 74vw);  /* card width */
  --tm-pad: 14px;            /* card padding around the portrait */
  --tm-pop: 72px;            /* room for a head to rise above its backdrop */
  --tm-face: .27;            /* face width, as a share of the backdrop height */
  --tm-eye: .2;              /* eye line, as a share of the backdrop height */
  position: relative;
}

.tm-viewport {
  position: relative;
  padding: 46px 0 34px;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
  cursor: grab;
}

.tm-deck.is-dragging .tm-viewport {
  cursor: grabbing;
}

.tm-deck.is-single .tm-viewport {
  cursor: auto;
}

.tm-track {
  position: relative;
  height: 480px;
  perspective: 2000px;
}

/* ---- Card ---- */

.tm-card {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--tm-w);
  display: grid;
  grid-template-columns: 38% minmax(0, 1fr);
  padding: var(--tm-pad);
  border-radius: 30px;
  background: linear-gradient(170deg, #fff 0%, #fbfdff 60%, #f4f8fc 100%);
  border: 1px solid rgba(16, 46, 73, .08);
  box-shadow: 0 26px 50px -34px rgba(16, 43, 69, .42), 0 2px 6px rgba(16, 43, 69, .05);
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* Extra depth under the active card, faded in as it reaches the centre */
.tm-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 48px 90px -44px rgba(16, 43, 69, .5), 0 0 0 5px rgba(36, 126, 198, .05);
  opacity: var(--lift, 0);
  pointer-events: none;
}

.tm-card:not(.is-active) {
  cursor: pointer;
}

.tm-deck.is-dragging .tm-card {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- Portrait ---- */

.tm-stage {
  position: relative;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 30%, transparent 0 31%, rgba(23, 109, 182, .07) 31.2% 31.6%, transparent 31.8% 45%, rgba(23, 109, 182, .05) 45.2% 45.5%, transparent 45.7%),
    radial-gradient(60% 42% at 50% 30%, rgba(255, 255, 255, .92), rgba(255, 255, 255, 0) 70%),
    radial-gradient(95% 60% at 50% 108%, rgba(23, 109, 182, .26), rgba(23, 109, 182, 0) 72%),
    linear-gradient(180deg, #eef5fb 0%, #d7e7f4 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 0 0 1px rgba(23, 109, 182, .06);
}

/* Clips the cutout at the sides and the rounded bottom of the backdrop, but leaves room above it */
.tm-cut {
  position: absolute;
  top: calc(-1 * var(--tm-pop));
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  border-radius: 0 0 22px 22px;
  pointer-events: none;
}

.tm-img {
  position: absolute;
  top: calc(var(--tm-pop) + var(--tm-sh, 420px) * var(--tm-eye));
  left: 50%;
  width: calc(var(--tm-sh, 420px) * var(--tm-face) / var(--fw, .29));
  max-width: none;
  height: auto;
  transform: translate(calc(var(--fx, .5) * -100%), calc(var(--fy, .26) * -100%));
  -webkit-user-drag: none;
}

/* A photo cropped close at the sides (edgeFade in team-data.js) fades out there instead of ending in a straight line */
.tm-img--fade {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

/* Wide cards can use their own framing (wideFace in team-data.js); without it nothing changes. */
@media (min-width: 900px) {
  .tm-img {
    width: calc(var(--tm-sh, 420px) * var(--tm-face) / var(--fw-wide, var(--fw, .29)));
    transform: translate(calc(var(--fx-wide, var(--fx, .5)) * -100%), calc(var(--fy-wide, var(--fy, .26)) * -100%));
  }
}

/* ---- Profile ---- */

.tm-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(20px, 2.6vw, 34px) clamp(18px, 2.8vw, 38px) clamp(4px, 1vw, 10px);
}

.tm-badge {
  align-self: flex-start;
  padding: 6px 11px;
  border-radius: 999px;
  background: #edf3f8;
  color: #4b6478;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}

.tm-badge.is-founder {
  background: linear-gradient(160deg, #2f8fdc, #176db6);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(23, 109, 182, .6);
}

.tm-name {
  margin: 14px 0 5px;
  color: var(--navy);
  font-size: clamp(26px, 1.3vw + 15px, 34px);
  line-height: 1.08;
  letter-spacing: -.03em;
}

.tm-role {
  margin: 0;
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.tm-exp {
  display: flex;
  flex-wrap: wrap;
  margin: 9px 0 0;
  color: #6b7f92;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .01em;
}

.tm-exp span + span::before {
  content: "·";
  margin: 0 8px;
  color: #a7b7c6;
}

.tm-bio {
  margin: 18px 0 22px;
  color: #43586b;
  font-size: 15px;
  line-height: 1.65;
}

.tm-contrib {
  margin-top: auto;
  padding: 13px 16px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f3f8fd, #edf5fb);
  border: 1px solid rgba(23, 109, 182, .12);
}

.tm-contrib-label {
  display: block;
  color: var(--blue);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tm-contrib p {
  margin: 5px 0 0;
  color: #17486c;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

/* ---- Controls ---- */

.tm-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tm-arrow,
.tm-play {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--navy);
  cursor: pointer;
}

.tm-play {
  width: 38px;
  height: 38px;
  margin-left: 6px;
}

.tm-arrow svg,
.tm-play svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tm-play svg {
  width: 15px;
  height: 15px;
}

.tm-play.is-paused path {
  fill: currentColor;
}

.tm-arrow:disabled {
  opacity: .4;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .tm-arrow:hover:not(:disabled) {
    transform: translateY(-1px);
  }
}

.tm-dots {
  display: flex;
  align-items: center;
}

/* Tall, generous hit areas around small bars */
.tm-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: width .45s var(--ease-out);
}

.tm-dot-bar {
  position: relative;
  display: block;
  width: 8px;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #c4d3e0;
  transition: width .45s var(--ease-out), background-color .3s;
}

.tm-dot-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left center;
}

.tm-dot[aria-current="true"] {
  width: 46px;
}

.tm-dot[aria-current="true"] .tm-dot-bar {
  width: 30px;
  background: rgba(23, 109, 182, .22);
}

@media (hover: hover) and (pointer: fine) {
  .tm-dot:hover:not([aria-current="true"]) .tm-dot-bar {
    background: #9fb6ca;
  }
}

.tm-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.tm-note {
  max-width: 560px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
}

/* ---- Narrow screens: portrait above the profile ---- */

@media (max-width: 899px) {
  .tm-deck {
    --tm-w: min(460px, 70vw);
    --tm-pad: 10px;
    --tm-pop: 52px;
    --tm-face: .43;
    --tm-eye: .35;
  }

  .tm-viewport {
    padding-top: 36px;
  }

  .tm-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    border-radius: 26px;
  }

  .tm-stage {
    height: 220px;
    border-radius: 18px;
  }

  .tm-cut {
    border-radius: 0 0 18px 18px;
  }

  .tm-body {
    padding: 18px 10px 4px;
  }
}

@media (max-width: 599px) {
  .tm-deck {
    --tm-w: min(400px, 82vw);
  }

  .tm-stage {
    height: 200px;
  }

  .tm-badge {
    font-size: 10px;
  }

  .tm-name {
    margin-top: 12px;
    font-size: 24px;
  }

  .tm-role {
    font-size: 14px;
  }

  .tm-exp {
    font-size: 12px;
  }

  .tm-bio {
    margin: 12px 0 16px;
    font-size: 14px;
    line-height: 1.55;
  }

  .tm-contrib {
    padding: 11px 13px 12px;
    border-radius: 14px;
  }

  .tm-contrib p {
    font-size: 13.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tm-dot,
  .tm-dot-bar {
    transition: none;
  }
}
