/* ===== Team section (between "Who we are" and the 3D card) ===== */
.team {
  position: relative; z-index: 61; /* sits over the top of the 3D section that's tucked under it */
  background: var(--charcoal);
  color: var(--plaster);
  padding: 140px var(--margin) 40px; /* small gap down to the 3D section */
}
.team-inner { max-width: 1600px; margin: 0 auto; }

.team-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 64px;
}
.team-title {
  margin: 0;
  font: 600 40px/1 var(--display); letter-spacing: 0; text-transform: uppercase;
}
.team-lead {
  margin: 0; max-width: 30ch;
  font: 300 16px/1.1 var(--sans); letter-spacing: .02em;
  color: rgba(239,235,225,.6);
}

.team-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 16px;
  list-style: none; margin: 0; padding: 0;
}
.team-photo {
  position: relative; aspect-ratio: 1 / 1.1; overflow: hidden;
  background: #22211c; /* shows while a photo is missing/loading */
  clip-path: inset(100% 0 0 0); /* masked: team.js wipes it open from the bottom */
}
.team-photo img {
  position: absolute; left: 0; top: -10%; /* taller than the frame: drifts inside it (parallax, team.js) */
  display: block; width: 100%; height: 120%; object-fit: cover;
  transform-origin: 50% 60%;
}
/* hover zoom only after GSAP's reveal is done (one animation system per property) */
/* `scale`, not `transform`: GSAP owns the img's transform (reveal + parallax) */
.team-grid.is-revealed .team-photo img { transition: scale 1.2s cubic-bezier(.17,.84,.44,1); }
.team-grid.is-revealed .team-card:hover .team-photo img { scale: 1.04; }

.team-meta { display: flex; gap: 16px; align-items: baseline; padding-top: 16px; border-top: 1px solid rgba(239,235,225,.14); margin-top: 16px; }
.team-name { margin: 0 0 8px; font: 600 22px/1 var(--display); letter-spacing: 0; } /* sentence case: "Serhii" */
.team-role { margin: 0; font: 300 14px/1.15 var(--sans); letter-spacing: .02em; color: rgba(239,235,225,.6); }

@media (min-width: 800px) {
  .team { padding: 180px var(--margin) 50px; }
  .team-title { font-size: 76px; }
  .team-lead { font-size: 20px; }
  .team-grid { grid-template-columns: repeat(5, 1fr); gap: var(--gap); }
  .team-head { margin-bottom: 88px; }
}
@media (min-width: 1200px) {
  .team-name { font-size: 28px; }
  .team-role { font-size: 16px; }
}

/* ===== desktop: horizontal accordion =====
   Five tall panels side by side; the open one widens to show the portrait, name and role,
   the others stay narrow with a vertical name (team.js sets .is-open). */
.team-vname { display: none; }
@media (min-width: 900px) {
  .team-grid { display: flex; gap: 12px; height: min(72vh, 700px); }
  .team-card {
    position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; cursor: pointer; outline: none;
    transition: flex-grow .9s cubic-bezier(.65, 0, .35, 1);
  }
  .team-card.is-open { flex-grow: 3.6; cursor: default; }
  .team-card .team-photo { position: absolute; inset: 0; aspect-ratio: auto; }
  .team-card .team-photo img { filter: grayscale(1) brightness(.78); transition: filter .9s ease, scale 1.2s cubic-bezier(.17,.84,.44,1); }
  .team-card.is-open .team-photo img { filter: grayscale(1) brightness(1); }
  .team-card .team-photo::after { /* floor for the type */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to top, rgba(25,24,20,.82), rgba(25,24,20,0) 45%);
  }

  /* collapsed: name runs up the panel */
  .team-vname {
    display: block; position: absolute; left: 18px; bottom: 22px; z-index: 2;
    writing-mode: vertical-rl; rotate: 180deg; white-space: nowrap;
    font: 600 clamp(22px, 2vw, 32px)/1 var(--display); letter-spacing: -.01em; color: var(--plaster);
    transition: opacity .45s ease .35s, translate .7s cubic-bezier(.17,.84,.44,1) .35s;
  }
  .team-card.is-open .team-vname { opacity: 0; translate: 0 16px; transition-delay: 0s; }

  /* open: name + role over the photo */
  .team-card .team-meta {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0; padding: 0 28px 26px; border: 0;
    opacity: 0; translate: 0 18px; transition: opacity .35s ease, translate .5s ease;
  }
  .team-card.is-open .team-meta { opacity: 1; translate: none; transition: opacity .6s ease .45s, translate .9s cubic-bezier(.17,.84,.44,1) .45s; }
  .team-card .team-meta > div { min-width: 320px; } /* no re-wrapping while the panel widens */
  .team-card .team-name { font-size: clamp(34px, 3vw, 52px); margin-bottom: 10px; }
  .team-card .team-role { color: rgba(239,235,225,.75); max-width: 30ch; }
}
