/* =========================================================================
   TEAM — editorial offset grid + full-bleed profile spread

   Two rules govern the whole file:

   1. Type never sits on the photograph. Names are set below the frame with a
      gold rule, the way a caption sits under a plate in print. There is no
      gradient scrim anywhere.

   2. The card frame and the spread's portrait are both exactly 4:5. The open
      animation flies one into the other, so any ratio mismatch would visibly
      skew the image mid-flight. The spread's portrait is sized by aspect-ratio
      rather than by filling its column, precisely to keep that true.
   ========================================================================= */

.tmx { --e: cubic-bezier(.22, 1, .36, 1); }

/* ------------------------------------------------------------------ Band */
.tmx-band + .tmx-band { margin-top: clamp(4.5rem, 9vw, 8rem); }

.tmx-band__head {
  max-width: 46rem;
  margin-bottom: clamp(2.2rem, 4vw, 3.4rem);
}
.tmx-band__eye {
  display: block;
  font-family: var(--sans); font-size: .58rem; font-weight: 600;
  letter-spacing: .3em; color: var(--gold);
}
.tmx-band__t {
  margin: .7rem 0 0;
  font-family: var(--serif); font-weight: 400; line-height: 1.05;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  color: var(--ivory);
}
.tmx-band__lede {
  margin: .7rem 0 0;
  font-size: .92rem; line-height: 1.6;
  color: rgba(245, 240, 232, .5);
}

/* ------------------------------------------------------------------ Grid
   Fixed column counts, not auto-fill: the staggered baselines below are
   keyed to nth-child, so the number of columns has to be knowable. */
.tmx-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.8rem, 3vw, 3.2rem) clamp(1.4rem, 2.4vw, 2.4rem);
  align-items: start;
}

/* A shallow offset. Enough to break the rigid table-of-headshots rhythm,
   not so much that the row stops reading as a row. */
.tmx-grid > :nth-child(3n + 1) { margin-top: 0; }
.tmx-grid > :nth-child(3n + 2) { margin-top: 1.5rem; }
.tmx-grid > :nth-child(3n + 3) { margin-top: 0.5rem; }

@media (max-width: 1080px) {
  .tmx-grid { grid-template-columns: repeat(2, 1fr); }
  .tmx-grid > :nth-child(n) { margin-top: 0; }
  .tmx-grid > :nth-child(2n) { margin-top: 1.1rem; }
}

/* ------------------------------------------------------------------ Card */
.tmx-card {
  display: block; width: 100%;
  padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer;
  font: inherit; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.tmx-card:focus-visible { outline: 1px solid var(--gold); outline-offset: 6px; }

/* A member whose copy has not been supplied yet: name and role only. Inert,
   so it must not offer a pointer or react to hover like the others do. */
.tmx-card--static { cursor: default; }

.tmx-card__frame {
  position: relative; display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--navy-deep);
}
.tmx-card__frame img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 16%;
  display: block;
  transform: scale(1.02);
  transition: transform 1.2s var(--e);
}

.tmx-card__edge {
  position: absolute; inset: 0; pointer-events: none;
  border: 1px solid rgba(245, 240, 232, .08);
  transition: border-color .6s var(--e);
}

.tmx-card:not(.tmx-card--static):hover .tmx-card__frame img,
.tmx-card:focus-visible .tmx-card__frame img {
  transform: scale(1.055);
}
.tmx-card:not(.tmx-card--static):hover .tmx-card__edge,
.tmx-card:focus-visible .tmx-card__edge { border-color: rgba(201, 168, 76, .55); }

/* ---- Caption, below the frame ---- */
.tmx-card__meta { display: block; padding-top: .95rem; }

.tmx-card__line {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .6rem;
}
.tmx-card__idx {
  font-style: normal;
  font-family: var(--sans); font-size: .55rem; font-weight: 600;
  letter-spacing: .18em; color: var(--gold);
}
.tmx-card__rule {
  display: block; height: 1px; width: 18px;
  background: rgba(201, 168, 76, .55);
  transition: width .7s var(--e), background .5s var(--e);
}
.tmx-card:not(.tmx-card--static):hover .tmx-card__rule { width: 52px; background: var(--gold); }

.tmx-card__n {
  display: block;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.2rem, 1.9vw, 1.7rem); line-height: 1.16;
  color: var(--ivory);
  transition: color .5s var(--e);
}
.tmx-card:not(.tmx-card--static):hover .tmx-card__n { color: var(--gold-light); }
.tmx-card__r {
  display: block; margin-top: .45rem;
  font-family: var(--sans); font-size: .6rem; font-weight: 600;
  letter-spacing: .17em; text-transform: uppercase; line-height: 1.5;
  color: rgba(245, 240, 232, .46);
}

/* Monogram, for members with no portrait */
.tmx-mono {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 3.2rem; letter-spacing: .08em;
  color: rgba(201, 168, 76, .42);
  background:
    radial-gradient(130% 95% at 50% 0%, rgba(201, 168, 76, .12), transparent 64%),
    var(--navy-deep);
}
.tmx-mono--lg { font-size: clamp(4rem, 8vw, 6.5rem); }

/* =========================================================================
   The spread
   ========================================================================= */
.tmx-spread {
  position: fixed; inset: 0; z-index: 2000;
  --strip: 108px;
}
.tmx-spread[hidden] { display: none; }

.tmx-spread__bg {
  position: absolute; inset: 0;
  background: var(--navy-deep);
  opacity: 0;
}

.tmx-spread__frame {
  position: relative;
  height: 100%; height: 100dvh;
  display: flex; flex-direction: column;
}

.tmx-spread__x {
  position: absolute; top: clamp(1rem, 2.4vw, 2rem); right: clamp(1rem, 2.4vw, 2rem);
  z-index: 8;
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .55rem .85rem;
  background: rgba(9, 20, 32, .6);
  border: 1px solid var(--ink-12);
  color: rgba(245, 240, 232, .7);
  font-family: var(--sans); font-size: .55rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  cursor: pointer;
  transition: color .35s var(--e), border-color .35s var(--e), background .35s var(--e);
}
.tmx-spread__x:hover { color: var(--gold); border-color: var(--gold); background: rgba(9, 20, 32, .95); }
.tmx-spread__x:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

.tmx-spread__stage { flex: 1; min-height: 0; position: relative; }

/* ---- Panel ---- */
/* The portrait and the copy are centred in the viewport as one composition,
   rather than the copy stretching to fill whatever is left over. */
.tmx-panel {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 42rem);
  justify-content: center;
  gap: clamp(1.5rem, 4.5vw, 4.5rem);
  padding: clamp(1.5rem, 3vw, 2.6rem) clamp(1.5rem, 4vw, 4rem) 0;
  align-items: center;
}
.tmx-panel[hidden] { display: none; }

.tmx-panel__mediawrap { display: flex; align-items: center; height: 100%; }

/*
 * Sized by ratio, not by filling the column.
 *
 * Height is whatever fits between the padding and the strip, capped so the
 * portrait never grows wider than half the viewport. Width follows from the
 * 4:5 ratio. Because the box is always exactly 4:5 — the same as the card —
 * the open animation scales uniformly on both axes and nothing skews.
 */
.tmx-panel__media {
  aspect-ratio: 4 / 5;
  height: min(calc(100dvh - var(--strip) - 5rem), 74vh, calc(40vw * 1.25));
  max-width: 40vw;
  overflow: hidden;
  background: var(--navy);
  transform-origin: top left;
  will-change: transform;
}
.tmx-panel__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 16%;
  display: block;
}

/* ---- Copy column ---- */
.tmx-panel__col {
  min-width: 0; min-height: 0;
  height: 100%;
  display: flex; align-items: center;
}
.tmx-panel__scroll {
  width: 100%;
  max-width: 40rem;
  max-height: 100%;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 2rem 1.6rem 2rem 0;
  scrollbar-width: thin;
  /* Soften the top and bottom edges so a mid-sentence cut reads as "scrolls"
     rather than "clipped". */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 34px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 34px), transparent 100%);
}
.tmx-panel__scroll::-webkit-scrollbar { width: 5px; }
.tmx-panel__scroll::-webkit-scrollbar-thumb { background: rgba(201, 168, 76, .3); }

.tmx-panel__eye {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--sans); font-size: .55rem; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase; color: var(--gold);
}
.tmx-panel__eye i {
  font-style: normal;
  padding-right: .7rem;
  border-right: 1px solid rgba(201, 168, 76, .4);
}
.tmx-panel__n {
  margin: .8rem 0 0;
  font-family: var(--serif); font-weight: 400; line-height: 1.02;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  color: var(--ivory);
}
.tmx-panel__r {
  display: block; margin-top: .6rem;
  font-family: var(--sans); font-size: .68rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
  color: rgba(245, 240, 232, .55);
}

.tmx-facts {
  display: grid; gap: .95rem;
  margin: 1.9rem 0 0; padding-left: 1.15rem;
  border-left: 1px solid rgba(201, 168, 76, .4);
}
.tmx-facts dt {
  font-family: var(--sans); font-size: .53rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); margin-bottom: .28rem;
}
.tmx-facts dd {
  margin: 0; font-size: .83rem; line-height: 1.6;
  color: rgba(245, 240, 232, .7);
}

.tmx-prose { margin-top: 1.9rem; }
.tmx-prose p {
  margin: 0 0 1.05rem;
  font-size: .94rem; line-height: 1.8;
  color: rgba(245, 240, 232, .82);
}
.tmx-prose p:first-child {
  /* Lead paragraph, set a touch larger — an editorial standfirst. */
  font-size: 1.04rem; line-height: 1.68; color: var(--ivory);
}
.tmx-prose p:last-child { margin-bottom: 0; }

.tmx-lists {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1.6rem 2.2rem;
  margin-top: 2.2rem; padding-top: 1.8rem;
  border-top: 1px solid var(--ink-08);
}
.tmx-list h3 {
  margin: 0 0 .8rem;
  font-family: var(--sans); font-size: .53rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
}
.tmx-list ul { margin: 0; padding: 0; list-style: none; }
.tmx-list li {
  position: relative; padding-left: .95rem; margin-bottom: .5rem;
  font-size: .81rem; line-height: 1.55;
  color: rgba(245, 240, 232, .62);
}
.tmx-list li::before {
  content: ""; position: absolute; left: 0; top: .6em;
  width: 5px; height: 1px; background: var(--gold); opacity: .7;
}

.tmx-panel__cta { margin-top: 2.2rem; }
.tmx-panel__btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.5rem;
  border: 1px solid var(--gold); color: var(--gold);
  font-family: var(--sans); font-size: .6rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
  transition: background .4s var(--e), color .4s var(--e);
}
.tmx-panel__btn:hover { background: var(--gold); color: var(--navy-deep); }

/* ---- Colleague strip ---- */
.tmx-strip {
  flex: none;
  height: var(--strip);
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0 clamp(1rem, 4vw, 4rem);
  border-top: 1px solid var(--ink-08);
  background: rgba(6, 13, 21, .6);
}
.tmx-strip__label {
  flex: none;
  font-family: var(--sans); font-size: .52rem; font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase;
  color: rgba(245, 240, 232, .32);
}
.tmx-strip__list {
  list-style: none; margin: 0; padding: .5rem 0;
  display: flex; gap: .55rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tmx-strip__list::-webkit-scrollbar { display: none; }

.tmx-thumb {
  position: relative; display: block; flex: none;
  width: 48px; aspect-ratio: 4 / 5;
  padding: 0; border: 0; background: var(--navy);
  cursor: pointer; overflow: hidden;
  opacity: .42;
  transition: opacity .45s var(--e), transform .45s var(--e);
}
.tmx-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 16%; display: block; }
.tmx-thumb__mono {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-size: .9rem; color: rgba(201, 168, 76, .55);
}
.tmx-thumb__name { display: none; }
.tmx-thumb:hover { opacity: .85; transform: translateY(-3px); }
.tmx-thumb:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; opacity: 1; }
.tmx-thumb.is-current {
  opacity: 1;
  box-shadow: inset 0 0 0 1px var(--gold), 0 0 0 1px var(--gold);
}

/* ------------------------------------------------------------- Responsive
   Below 900px the spread stacks: a band of portrait, then the copy. The
   portrait is no longer 4:5 here, so the open animation falls back to a fade
   (handled in team.js) rather than skewing the image. */
@media (max-width: 900px), (orientation: portrait) and (max-width: 1100px) {
  .tmx-spread { --strip: 88px; }
  .tmx-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    padding: 0;
    align-items: stretch;
  }
  .tmx-panel__mediawrap { height: auto; }
  .tmx-panel__media {
    height: 34vh; min-height: 180px;
    aspect-ratio: auto; width: 100%; max-width: none;
  }
  .tmx-panel__col { align-items: stretch; padding: 0; }
  .tmx-panel__scroll {
    max-width: none;
    padding: 1.6rem clamp(1.2rem, 5vw, 2rem) 1.6rem;
  }
  .tmx-panel__n { font-size: clamp(1.75rem, 7vw, 2.4rem); }
  .tmx-spread__x span { display: none; }
  .tmx-spread__x { padding: .6rem; }
  .tmx-strip__label { display: none; }
  .tmx-thumb { width: 42px; }
}

@media (max-width: 520px) {
  .tmx-grid { gap: 1.5rem .9rem; }
  .tmx-card__n { font-size: 1rem; }
  .tmx-card__r { font-size: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tmx-card__frame img,
  .tmx-card__rule,
  .tmx-card__edge,
  .tmx-thumb { transition-duration: .01ms !important; }
}

/* Link out to the full team, used where only one band is shown. */
.tmx-more { margin-top: clamp(2.4rem, 5vw, 3.6rem); }
.tmx-more__link {
  display: inline-flex; align-items: center; gap: .55rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid rgba(201, 168, 76, .45);
  color: var(--gold);
  font-family: var(--sans); font-size: .62rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
  transition: border-color .4s var(--e), color .4s var(--e), gap .4s var(--e);
}
.tmx-more__link:hover { color: var(--gold-light); border-color: var(--gold-light); gap: .95rem; }
