/* ===== Team page ===== */

.team-head {
  position: relative;
  overflow: clip;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  color: var(--paper-strong);
  border-bottom: 1px solid var(--line);
}

/* Figma's top-of-page accent (Ellipse 1): a huge circle, fixed 1440x1441,
   horizontally centered and sitting almost entirely above the frame (top:
   -1270px) — only its bottom ~171px peeks into view. Figma's mobile frame
   uses this exact same fixed 1440x1441 circle, just re-centered for the
   narrower frame (not scaled down to it) — a fixed size here matches both
   breakpoints at once instead of needing a separate mobile override. Its
   fill is near-black (indistinguishable from the section background), so
   what actually reads is its inner shadow: a blue glow traced along the
   inside of that curve, peeking through as a soft glowing dome across the
   very top of the page, behind the nav. */
.team-head__glow {
  position: absolute;
  z-index: 0;
  top: -1270px;
  left: 50%;
  transform: translateX(-50%);
  width: 1440px;
  height: 1441px;
  border-radius: 50%;
  box-shadow: inset 0 12px 246.5px -85px rgba(53, 177, 211, 0.9);
  pointer-events: none;
}

.team-head__frame {
  position: relative;
  z-index: 1;
  width: var(--frame);
  max-width: 1440px;
  margin-inline: auto;
  padding: 34px 0 40px;
}

.team-head__title {
  margin: 74px 0 0;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.13;
  font-weight: 400;
  text-align: center;
  text-transform: uppercase;
}

.team-head__lede {
  max-width: 710px;
  margin: 32px auto 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.6;
  text-align: center;
}

/* ---------- Grid ---------- */

.team-grid {
  padding: 32px 0 96px;
  background: var(--bg-0);
}

/* Uniform CSS grid: every card is the same width and, within each row, the
   same height — no masonry stagger. Name/role get a reserved min-height so
   cards stay the same size even when job titles wrap to different line
   counts. */
.team-grid__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.team-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--line);
}

.team-card__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 311 / 342;
  overflow: hidden;
  background: var(--bg-2);
}

/* Each photo is framed with a per-person crop (width/height/left/top)
   matching Figma's manually-tuned image fill for that photo, so every head
   reads at the same scale despite the source photos being shot at
   different distances/crops. Values are derived from Figma's imageTransform
   matrix for each "Vincent Vuong" fill (team page, node 1:1502):
   width = 100/sx, height = 100/sy, left = -100*tx/sx, top = -100*ty/sy. */
.team-card__photo img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
}

.team-grid__list .team-card:nth-child(1) .team-card__photo img {
  width: 131.8%;
  height: 179.75%;
  left: -20.77%;
  top: -15.43%;
}

.team-grid__list .team-card:nth-child(2) .team-card__photo img {
  width: 128.99%;
  height: 175.92%;
  left: -14.49%;
  top: -4.9%;
}

.team-grid__list .team-card:nth-child(3) .team-card__photo img {
  width: 100%;
  height: 136.38%;
  left: 0;
  top: 0.03%;
}

.team-grid__list .team-card:nth-child(4) .team-card__photo img {
  width: 164.43%;
  height: 224.24%;
  left: -36.11%;
  top: -17.46%;
}

.team-grid__list .team-card:nth-child(5) .team-card__photo img {
  width: 99.98%;
  height: 123.35%;
  left: 0.33%;
  /* Figma's crop for this photo pans slightly past the source image's own
     top edge — a positive top here (the raw computed value) would leave
     that sliver of the container unfilled, showing the card's background
     colour through as a visible seam. Clamped to 0 so the image's real top
     edge sits flush with the container instead. */
  top: 0%;
}

.team-grid__list .team-card:nth-child(6) .team-card__photo img {
  width: 106%;
  height: 144.55%;
  left: -2.69%;
  top: 0.15%;
}

.team-grid__list .team-card:nth-child(7) .team-card__photo img {
  width: 99.89%;
  height: 136.23%;
  left: 0.83%;
  top: 0.03%;
}

.team-grid__list .team-card:nth-child(8) .team-card__photo img {
  width: 116.33%;
  height: 164.35%;
  left: -7.85%;
  top: 0.05%;
}

.team-grid__list .team-card:nth-child(9) .team-card__photo img {
  width: 112.81%;
  height: 153.85%;
  left: -6.16%;
  top: -5.56%;
}

.team-grid__list .team-card:nth-child(10) .team-card__photo img {
  width: 100%;
  height: 136.38%;
  left: 0;
  top: 0.03%;
}

.team-grid__list .team-card:nth-child(11) .team-card__photo img {
  width: 117.28%;
  height: 160.23%;
  left: -8.33%;
  top: -8.07%;
}

.team-grid__list .team-card:nth-child(12) .team-card__photo img {
  width: 109.49%;
  height: 149.31%;
  left: -6.66%;
  top: -5.91%;
}

.team-card__name {
  margin: 12px 0 0;
  min-height: 64px;
  font-size: 20px;
  line-height: 1.6;
  color: var(--paper-strong);
}

.team-card__role {
  margin: 20px 0 0;
  min-height: 68px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--accent);
}

.team-card {
  cursor: pointer;
}

/* ---------- Drawer (full bio panel, matches the Figma team animation file: node
   1:1557 in "CAMS - Teams - Animation") ---------- */

/* Click/tap only — no hover preview. Opens as a fixed backdrop + a panel
   docked to the right edge, closable via the × button, the backdrop, or
   Escape. */
.team-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.team-drawer.is-active {
  pointer-events: auto;
}

.team-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 14, 14, 0.78);
  opacity: 0;
  transition: opacity 220ms var(--ease);
}

.team-drawer.is-active .team-drawer__backdrop {
  opacity: 1;
}

.team-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(672px, 100%);
  height: 100%;
  overflow: hidden;
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  visibility: hidden;
  transform: translateX(100%);
  transition: transform 280ms var(--ease), visibility 0s linear 280ms;
}

.team-drawer.is-active .team-drawer__panel {
  visibility: visible;
  transform: translateX(0);
  transition: transform 280ms var(--ease), visibility 0s linear 0s;
}

.team-drawer__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: transparent;
  color: var(--paper-strong);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* Photo absorbs the shrinking on short viewports (min-height:0 lets a flex
   item shrink below its aspect-ratio-implied size) so name/role/bio stay
   fully visible above the fold before the bio's own scroll region kicks in. */
.team-drawer__photo {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: 311 / 327;
  background: #000;
  padding: 24px;
}

.team-drawer__photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.team-drawer__name {
  flex-shrink: 0;
  margin: 24px 24px 0;
  font-size: 24px;
  line-height: 1.6;
  color: var(--paper-strong);
}

.team-drawer__role {
  flex-shrink: 0;
  margin: 10px 24px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--accent);
}

.team-drawer__bio {
  flex-shrink: 0;
  margin: 24px 0 0;
  padding: 24px;
  border-top: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.6;
  color: var(--paper-strong);
  max-height: 40vh;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .team-drawer__backdrop {
    background: rgba(0, 0, 0, 0.4);
  }

  .team-drawer__panel {
    width: 100%;
    overflow-y: auto;
  }

  .team-drawer__photo {
    flex: 0 0 auto;
    width: 210px;
    height: 231px;
    aspect-ratio: auto;
    margin: 24px auto 0;
    padding: 0;
    background: #000;
  }

  .team-drawer__photo img {
    object-fit: cover;
    object-position: top center;
  }

  .team-drawer__name {
    margin: 0;
    padding: 32px 24px 0;
    background: #000;
    font-size: 18px;
  }

  .team-drawer__role {
    margin: 0;
    padding: 10px 24px 24px;
    background: #000;
  }

  .team-drawer__bio {
    margin: 0;
    max-height: none;
    overflow-y: visible;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .team-grid__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .team-head__title {
    margin-top: 32px;
    font-size: 32px;
  }

  .team-grid__list {
    grid-template-columns: 1fr;
  }
}
