/* ===== Team page ===== */

.team-head {
  position: relative;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  color: var(--paper-strong);
  border-bottom: 1px solid var(--line);
}

.team-head__frame {
  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-transform: uppercase;
}

/* ---------- 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 {
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--bg-2);
}

.team-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.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;
  }
}
