/* ===== 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);
  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);
}

/* CSS multi-column masonry: card heights vary naturally with how many lines
   the job title wraps to (matches Figma's own staggered "brick" layout)
   without hardcoding per-card pixel heights. */
.team-grid__list {
  column-count: 4;
  column-gap: 12px;
}

.team-card {
  display: block;
  break-inside: avoid;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
}

.team-card__photo {
  height: 342px;
  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;
  font-size: 20px;
  line-height: 1.6;
  color: var(--paper-strong);
}

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

.team-card {
  cursor: pointer;
}

/* ---------- Hover drawer (full bio card, matches Figma's Drawer 1:1412 exactly) ---------- */

/* Always the full-size card. Hover shows it click-through with no backdrop
   dimming — so passing the mouse across several cards in a row (completely
   normal while scanning the grid) never reads as the page flashing.
   Clicking/tapping "pins" it: backdrop appears and it becomes interactive,
   closable via the × button, the backdrop, or Escape. */
.team-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.team-drawer.is-pinned {
  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-pinned .team-drawer__backdrop {
  opacity: 1;
}

.team-drawer__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(672px, 100%);
  max-height: min(900px, 100%);
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease), visibility 0s linear 220ms;
}

/* Only the pinned (clicked) drawer is interactive — while merely hovering,
   the panel stays click-through (even though it visually sits on top of the
   grid) so the source card never loses :hover and the preview doesn't close
   the instant it renders. */
.team-drawer.is-pinned .team-drawer__panel,
.team-drawer.is-pinned .team-drawer__close {
  pointer-events: auto;
}

.team-drawer.is-active .team-drawer__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity 220ms var(--ease), transform 220ms 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, cropping the image via
   object-fit:cover further) so name/role/bio stay fully visible without an
   internal scrollbar — the whole point of the fit-without-scrolling ask. */
.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 {
    padding: 0;
    align-items: flex-end;
  }

  .team-drawer__panel {
    width: 100%;
    max-height: 88vh;
  }
}

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

@media (max-width: 980px) {
  .team-grid__list {
    column-count: 2;
  }
}

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

  .team-grid__list {
    column-count: 1;
  }
}
