/* Our core team with contour heads (marzex-team-heads.js). The photo slot holds a poster of the head and, over it,
   the live canvas, which fades in once its head has drawn. */
/* on black, the cards take the site's dark card fill */
[data-team-heads] .person { background: color-mix(in srgb, var(--fg) 7%, transparent); }
.person__media { position: relative; aspect-ratio: 1; margin-bottom: .5rem; border-radius: var(--r-media); overflow: hidden; background: var(--ink); }
.person > .person__media { margin-inline: 0; }
.person__media .media { filter: none; }
.person__media .person__photo { margin: 0; }
.person__head { position: absolute; inset: 0; opacity: 0; transition: opacity .6s var(--s-power2-out); }
.person.is-live .person__head { opacity: 1; }

@media (max-width: 768px) {
  .person__media { grid-row: 1 / span 2; margin: 0; }
}

/* ---------- Poster cards (team-heads-poster.html), after Case studies V4 in variations.html: each head fills a tall
   card with the name set on it, and the card's last row opens the bio over the head. The head is drawn on the card's
   own colour; the whole card is the button. ---------- */
.tp__top { display: grid; justify-items: center; gap: 1.25rem; max-width: 52rem; margin: 0 auto 4rem; padding-inline: var(--margin); text-align: center; }
.tp__title { font-size: clamp(2.571rem, 4.6vw, 4.5rem); line-height: 1; letter-spacing: -.03em; text-wrap: balance; }
.tp__lede { max-width: 40rem; font-size: 1.25rem; line-height: 1.4; letter-spacing: -.01em; text-wrap: balance; opacity: var(--dim); }
.tp__grid { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
/* five or six: three to a row, on six tracks so a short last row sits in the middle */
@media (min-width: 1081px) {
  .tp__grid:has(> :nth-child(5)) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tp__grid:has(> :nth-child(5)) > * { grid-column: span 2; }
  .tp__grid:has(> :nth-child(5):last-child) > :nth-child(4) { grid-column: 2 / span 2; }
}
.tp__card {
  position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr); align-items: end;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-3xl); background: #121212; color: var(--paper);
}
.tp__card > .media { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; border-radius: 0; filter: none; transition: transform .7s var(--s-power2-out), opacity .6s var(--s-power2-out); }
.tp__poster { object-fit: cover; object-position: 50% 0; }   /* the head is at the top in any portrait shape */
.tp__live { opacity: 0; }
.tp__card.is-live .tp__live { opacity: 1; }
.tp__card:hover > .media { transform: scale(1.03); }
/* the scrim under the name, and a deeper shade over the head while the bio is open */
.tp__card::before, .tp__card::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.tp__card::after { background: linear-gradient(rgba(1, 1, 1, 0) 40%, rgba(1, 1, 1, .8)); }
.tp__card::before { background: rgba(1, 1, 1, .74); opacity: 0; transition: opacity .45s var(--s-power2-out); }
.tp__card:has([aria-expanded="true"])::before { opacity: 1; }

/* a long bio fills the card and scrolls inside it rather than pushing the name off the top */
.tp__over { z-index: 2; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: .625rem; max-height: 100%; padding: 1.75rem 1.75rem 1.5rem; }
.tp__role { opacity: .75; }
.tp__over .t-h5 { text-wrap: balance; }
/* the bio sits over the card-wide button, so it can be read, selected and scrolled */
.tp__bio { position: relative; z-index: 4; display: grid; grid-template-rows: 0fr; min-height: 0; visibility: hidden; transition: grid-template-rows .5s var(--s-power2-out), visibility 0s .5s; }
.tp__bio > div {
  min-height: 0; overflow: auto; scrollbar-width: none;
  -webkit-mask: linear-gradient(#000 calc(100% - 1.5rem), transparent); mask: linear-gradient(#000 calc(100% - 1.5rem), transparent);
}
.tp__bio p { padding: .25rem 0 1.25rem; line-height: 1.45; opacity: .85; }   /* the last line clears the fade */
.tp__card:has([aria-expanded="true"]) .tp__bio { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .5s var(--s-power2-out); }
.tp__more {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .375rem; padding: 1rem 0 0;
  border: 0; border-top: 1px solid rgba(255, 255, 255, .25); background: none; color: inherit; text-align: start; cursor: pointer;
}
.tp__more::after { content: ""; position: absolute; inset: 0; z-index: 3; }   /* the whole card answers the click */
.tp__more:focus-visible { outline: none; }
.tp__card:has(.tp__more:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.tp__more .icon { transition: rotate .35s var(--s-ease); }
.tp__more[aria-expanded="true"] .icon { rotate: 45deg; }
.tp__card:hover .go::before, .tp__more:focus-visible .go::before { scale: 1 1; }

@media (max-width: 1080px) {
  .tp__grid { grid-template-columns: 1fr 1fr; }
}
/* two to a row with an odd card out: centre it */
@media (min-width: 769px) and (max-width: 1080px) {
  .tp__grid:has(> :nth-child(odd):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tp__grid:has(> :nth-child(odd):last-child) > * { grid-column: span 2; }
  .tp__grid:has(> :nth-child(odd):last-child) > :last-child { grid-column: 2 / span 2; }
}
@media (max-width: 768px) {
  .tp__top { margin-bottom: 2.75rem; }
  .tp__lede { font-size: 1.125rem; }
  .tp__grid { grid-template-columns: minmax(0, 1fr); }
  .tp__card { aspect-ratio: 4 / 5; }
  .tp__over { padding: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tp__card > .media, .tp__card::before, .tp__bio, .tp__more .icon { transition: none; }
  .tp__card:hover > .media { transform: none; }
}
