/* =========================================================
   TEAM SECTION — FINAL VERSION
   Features:
   - Team-showcase hero block (red rectangle + image)
   - Animated title + intro text
   - Scroll-fade reveal for portrait cards
   - Responsive mosaic grid (4→3→2, mobile bleibt zweispaltig)
   - Glassy label background with accent stripe
   - LinkedIn icon repositioned to top-right
   ========================================================= */


/* ---------- TEAM SHOWCASE ---------- */
.team-showcase {
  --content-max-w: 1160px;
  --rect-h-fallback: clamp(90px, 10vw, 120px);
  --overhang-f: 0.28;
  --img-max-w: min(92vw, 1100px);

  padding-top: calc(var(--nav-height, 68px) + 18px);
  padding-bottom: 2.5rem;
  background: transparent;
  position: relative;
  overflow: visible;
}

/* inner centered wrapper */
.team-inner {
  position: relative;
  max-width: var(--content-max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

/* visual stack (rect + image) */
.team-stack {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  --rect-w: 70%;
  --img-w: 52%;
}

/* red background rectangle */
.team-bg-rect {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: var(--rect-w);
  height: clamp(120px, 12vw, 160px);
  background: var(--accent);
  border-radius: 12px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.12);
  z-index: 1;
}

/* hero image (bottom-aligned) */
.team-image-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: var(--img-w);
  z-index: 2;
  pointer-events: none;
}

.team-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 10px;
}

/* text below hero */
.team-text {
  width: 100%;
  max-width: 720px;
  margin-top: calc(clamp(120px, 12vw, 160px) * 0.18);
}

.team-title {
  font-weight: 900;
  font-size: clamp(2rem, 5.6vw, 3.2rem);
  color: var(--accent);
  margin: 0 0 0.25rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 420ms ease, transform 420ms cubic-bezier(.2, .9, .2, 1);
}
.team-title .sup {
  font-size: 0.52em;
  vertical-align: super;
  color: var(--accent);
}
.team-intro {
  color: var(--muted);
  margin: 0.5rem 0 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 420ms ease, transform 420ms cubic-bezier(.2, .9, .2, 1);
}

.team-title.is-visible,
.team-intro.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- MOBILE OVERRIDES ---------- */
@media (max-width: 640px) {
  .team-inner {
    align-items: center;
    text-align: center;
  }
  .team-stack {
    max-width: none;
    --rect-w: 88vw;
    --img-w: 84vw;
  }
  .team-bg-rect {
    height: clamp(120px, 28vw, 200px);
    border-radius: 12px;
  }
  .team-text {
    max-width: 92vw;
    padding: 0 1rem;
  }
}

/* ---------- TEAM GRID ---------- */
.team-grid {
  padding: 2rem 0 4rem;
  position: relative;
  z-index: 1;
}

.team-sections {
  padding: 2rem 0 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.team-section {
  width: 100%;
}

.team-section__header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.team-section__title {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.team-section .team-grid {
  padding: 0;
}

.cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  will-change: transform;
}

/* ---------- TEAM CARDS ---------- */
.team-card {
  width: 100%;
}

/* the portrait image */
.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}

/* Portrait card: smooth GPU-friendly reveal */
.portrait-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);

  /* Mosaic offset via CSS variable, NOT separate transform rules */
  --mosaic-offset: 0px;

  /* Start state (will be committed via .pre-reveal) */
  opacity: 0;
  transform: translate3d(0, calc(var(--mosaic-offset) + 16px), 0);

  transition:
    transform .56s cubic-bezier(.22,.61,.36,1),
    opacity  .52s ease,
    box-shadow .24s ease .10s; /* shadow ramps slightly after */
}

.portrait-wrap.pre-reveal {
  /* ensures the browser commits start state before .revealed is added */
  will-change: transform, opacity;
}

.portrait-wrap.revealed {
  opacity: 1;
  transform: translate3d(0, var(--mosaic-offset), 0);
}

.portrait-wrap:hover {
  transform: translate3d(0, calc(var(--mosaic-offset) - 6px), 0);
  box-shadow: 0 20px 44px rgba(2, 6, 23, 0.12);
}

/* card label */
.card-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 0.12rem;
  max-width: min(88%, 260px);
  z-index: 8;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.04);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 20px rgba(2,6,23,0.04);
}
.card-label::before {
  content: "";
  width: 4px;
  height: 70%;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 8px;
}
.card-label .name {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--accent);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.card-label .name .sup {
  font-size: 0.56em;
  vertical-align: super;
  color: var(--accent);
}
.card-label .role {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
  padding-left: 0.18rem; /* slight indent to visually balance stripe */
}

/* LinkedIn icon – top-right */
.portrait-wrap .linkedin {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  z-index: 9;

  /* --- Glassy, visible background --- */
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(2,6,23,0.08);

  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.portrait-wrap .linkedin img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.2));
}

.portrait-wrap .linkedin:hover,
.portrait-wrap .linkedin:focus {
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.10));
  box-shadow: 0 10px 26px rgba(2,6,23,0.12);
}

/* Mosaic staggering via CSS variable (no transform conflict) */
.col-1 .portrait-wrap:nth-child(even),
.col-3 .portrait-wrap:nth-child(even) { --mosaic-offset: 8px; }

.col-2 .portrait-wrap:nth-child(odd),
.col-4 .portrait-wrap:nth-child(odd) { --mosaic-offset: 8px; }

/* ---------- RESPONSIVE GRID ---------- */
@media (max-width: 1200px) {
  .cols { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .team-sections { gap: 2rem; }
  .team-section__header { justify-content: center; }
  .cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col { gap: 1.1rem; }
  .portrait-wrap { transform: translateY(0); }
}

/* ---------- Helpers ---------- */
.is-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}
