.team-page {
  background: var(--soft);
}

.team-main {
  --team-group-gap: clamp(48px, 4vw, 64px);
  --team-title-gap: 24px;
  --team-card-gap: 24px;
  padding: 58px 0 84px;
}

.team-hero {
  text-align: center;
}

.team-title {
  margin: 0 0 10px;
  color: var(--navy);
  font-family: 'Poppins', sans-serif;
  font-size: clamp(38px, 5vw, 50px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.team-subtitle {
  max-width: 560px;
  margin: 0 auto;
  color: #64748b;
  font-size: 15px;
  line-height: 1.6;
}

.team-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 32px auto 56px;
}

.team-filter {
  padding: 12px 21px;
  border: 0;
  border-radius: 999px;
  background: #475569;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.team-filter:hover {
  background: #334155;
  transform: translateY(-1px);
}

.team-filter.is-active {
  background: var(--blue-ink);
  box-shadow: 0 8px 20px rgba(0, 159, 227, 0.28);
}

.team-group {
  margin-top: 0;
  scroll-margin-top: 100px;
}

.team-group:not([hidden]) ~ .team-group:not([hidden]) {
  margin-top: var(--team-group-gap);
}

.team-group[hidden] {
  display: none !important;
}

.team-group-title {
  margin: 0 0 var(--team-title-gap);
  color: var(--navy);
  font-family: 'Poppins', sans-serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-align: center;
}

.team-lead {
  display: flex;
  justify-content: center;
  margin-bottom: var(--team-card-gap);
}

.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--team-card-gap);
}

.team-group.is-filtering {
  animation: team-filter-in 420ms cubic-bezier(0.22, 1, 0.36, 1) var(--filter-delay, 0ms) both;
}

@keyframes team-filter-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.team-card {
  width: 300px;
  max-width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  transition:
    translate 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.32s ease;
}

.team-card.reveal {
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    translate 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.32s ease;
  transition-delay:
    var(--reveal-delay, 0ms),
    var(--reveal-delay, 0ms),
    0ms,
    0ms;
}

.team-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 610 / 512;
  background: #e2e8f0;
  object-fit: cover;
  transform-origin: 50% 35%;
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.35s ease;
}

@media (hover: hover) and (pointer: fine) {
  .team-card:hover {
    translate: 0 -6px;
    box-shadow:
      0 20px 42px rgba(15, 23, 42, 0.18),
      0 0 0 1px rgba(0, 159, 227, 0.14);
  }

  .team-card:hover .team-photo {
    transform: scale(1.045);
  }

  .team-card .team-photo:hover {
    transform: scale(1.08);
    filter: saturate(1.05) contrast(1.02);
  }
}

.team-card-body {
  padding: 16px 20px 19px;
}

.team-name {
  margin: 0 0 4px;
  color: var(--navy);
  font-family: 'Poppins', sans-serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
}

.team-role {
  margin: 0 0 5px;
  color: var(--blue-ink);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-transform: uppercase;
}

.team-major {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .team-main {
    --team-group-gap: 44px;
    --team-title-gap: 20px;
    --team-card-gap: 20px;
    padding: 42px 0 64px;
  }

  .team-filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 26px -20px 48px;
    padding: 0 20px 6px;
    scrollbar-width: none;
  }

  .team-filters::-webkit-scrollbar {
    display: none;
  }

  .team-filter {
    padding: 11px 18px;
  }

  .team-card {
    width: min(100%, 320px);
  }

  .team-name {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .team-group.is-filtering {
    animation: none;
  }

  .team-card,
  .team-photo {
    transition: none;
  }

  .team-card:hover {
    translate: none;
  }

  .team-card:hover .team-photo,
  .team-card .team-photo:hover {
    transform: none;
    filter: none;
  }
}
