/* Team member profile popup — cream card language matching project modals */
.team-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 11, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  display: grid;
  place-items: center;
  padding: 24px;
}
.team-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

body.showing-team .stage,
body.showing-team .foot {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.35s ease;
}

@media (min-width: 901px) {
  body.showing-team .brand-stack {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.35s ease;
  }
}

@media (max-width: 900px) {
  body.showing-team .mobile-team-reel {
    filter: blur(8px) saturate(0.7);
    opacity: 0.45;
    pointer-events: none;
    transition: filter 0.35s ease, opacity 0.35s ease;
  }
  body.showing-team .mobile-scroll-hint {
    opacity: 0 !important;
  }
  body.showing-team .team-overlay {
    background: rgba(8, 9, 11, 0.45);
    z-index: 42; /* below mobile chrome (44–47) and menu sheet (43) */
  }
}

.team-card {
  --bezel: 14px;
  width: min(920px, 94vw);
  max-height: min(92vh, 720px);
  background: var(--tile);
  color: var(--tile-ink);
  border-radius: 22px;
  padding: var(--bezel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 28px 56px -14px rgba(0, 0, 0, 0.55),
    0 48px 100px -40px rgba(0, 0, 0, 0.7);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.team-overlay.open .team-card {
  transform: translateY(0) scale(1);
}

.team-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #666;
  background: transparent;
}
.team-chrome .file-name {
  color: #222;
}
.team-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.team-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.team-media {
  position: relative;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #2a2a2a;
  aspect-ratio: 1 / 1;
  align-self: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.team-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0;
  transition: opacity 0.85s ease;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.team-media img.is-active {
  opacity: 1;
}

.team-body {
  padding: 4px 4px 6px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.team-name {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.25;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
  color: var(--tile-ink);
}
.team-role {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(15px, 2.2vw, 18px);
  color: #666;
  margin: 8px 0 0;
}
.team-bio-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 6px;
}
.team-bio {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: #333;
  margin: 0;
}
.team-bio p {
  margin: 0 0 0.85em;
}
.team-bio p:last-child {
  margin-bottom: 0;
}

.team-actions {
  display: flex;
  gap: 8px;
  padding: 14px 2px 4px;
  flex: 0 0 auto;
}
.team-actions a,
.team-actions button {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: transparent;
  color: #141414;
  cursor: pointer;
  padding: 11px 12px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.team-actions a.primary {
  background: #141414;
  color: #f2f0ea;
  border-color: #141414;
}
.team-actions a.primary:hover {
  background: #000;
}
.team-actions button:hover {
  background: #141414;
  color: #f2f0ea;
}

/* Mobile portrait */
@media (max-width: 900px) and (orientation: portrait) {
  .team-overlay {
    padding:
      calc(var(--mobile-topbar-h, 44px) + env(safe-area-inset-top, 0px) + 8px)
      max(16px, calc(env(safe-area-inset-right, 0px) + 12px))
      max(16px, calc(env(safe-area-inset-bottom, 0px) + 12px))
      max(16px, calc(env(safe-area-inset-left, 0px) + 12px));
    place-items: center;
    overflow: hidden;
  }
  .team-card {
    --bezel: 10px;
    width: 100%;
    max-width: min(400px, 100%);
    max-height: min(
      calc(100dvh - var(--mobile-topbar-h, 44px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px),
      92dvh
    );
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .team-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
  }
  .team-media {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
  }
  .team-name {
    font-size: 13px;
  }
  .team-role {
    font-size: 14px;
    margin-top: 4px;
  }
  .team-bio-scroll {
    margin-top: 10px;
  }
  .team-bio {
    font-size: 13px;
    line-height: 1.5;
  }
  .team-actions {
    padding: 10px 2px 2px;
    gap: 6px;
  }
  .team-actions a,
  .team-actions button {
    padding: 9px 10px;
    font-size: 8px;
  }
}

/* Mobile landscape — side-by-side like project modal */
@media (max-width: 900px) and (orientation: landscape) {
  .team-overlay {
    padding:
      calc(var(--mobile-topbar-h, 44px) + env(safe-area-inset-top, 0px) + 8px)
      max(16px, calc(env(safe-area-inset-right, 0px) + 12px))
      max(10px, calc(env(safe-area-inset-bottom, 0px) + 6px))
      max(16px, calc(env(safe-area-inset-left, 0px) + 12px));
    place-items: center;
    overflow: hidden;
  }
  .team-card {
    --bezel: 10px;
    width: 100%;
    max-width: min(640px, 100%);
    max-height: min(
      88dvh,
      calc(
        100dvh
        - var(--mobile-topbar-h, 44px)
        - env(safe-area-inset-top, 0px)
        - env(safe-area-inset-bottom, 0px)
        - 20px
      )
    );
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "chrome"
      "layout"
      "actions";
    gap: 8px;
    overflow: hidden;
  }
  .team-chrome {
    grid-area: chrome;
    padding-bottom: 4px;
  }
  .team-layout {
    grid-area: layout;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
  }
  .team-media {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
    align-self: center;
  }
  .team-body {
    padding: 0 2px;
    overflow: hidden;
  }
  .team-name {
    font-size: 11px;
  }
  .team-role {
    font-size: 13px;
    margin-top: 4px;
  }
  .team-bio-scroll {
    margin-top: 8px;
  }
  .team-bio {
    font-size: 12px;
    line-height: 1.5;
  }
  .team-actions {
    grid-area: actions;
    padding: 4px 2px 2px;
    gap: 6px;
  }
  .team-actions a,
  .team-actions button {
    padding: 8px 10px;
    font-size: 8px;
  }
}
