.tmg-team {
  --tmg-accent: #2563eb;
  --tmg-success: #16803c;
  --tmg-muted: #64748b;
  width: 100%;
  max-width: var(--tmg-team-max-width);
  color: inherit;
}

.tmg-team.tmg-align-left { margin-right: auto; margin-left: 0; }
.tmg-team.tmg-align-center { margin-right: auto; margin-left: auto; }
.tmg-team.tmg-align-right { margin-right: 0; margin-left: auto; }

.tmg-team > .tmg-grid {
  display: grid;
  grid-template-columns: repeat(var(--tmg-columns), minmax(0, 1fr));
  grid-auto-flow: row;
  align-items: stretch;
  gap: var(--tmg-grid-gap);
}

/* Explizite Spaltenregeln verhindern Überschreibungen durch Theme-Grid-Klassen. */
.tmg-team.tmg-columns-1 > .tmg-grid { grid-template-columns: minmax(0, 1fr) !important; }
.tmg-team.tmg-columns-2 > .tmg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.tmg-team.tmg-columns-3 > .tmg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.tmg-team.tmg-columns-4 > .tmg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.tmg-team.tmg-columns-5 > .tmg-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }

.tmg-team > .tmg-grid > .tmg-card {
  grid-column: auto !important;
  grid-row: auto !important;
  width: auto !important;
  min-width: 0;
  max-width: none;
}

.tmg-card {
  position: relative;
  height: var(--tmg-card-height);
  overflow: hidden;
  border: var(--tmg-border-width) solid var(--tmg-border-color);
  border-radius: var(--tmg-radius);
  background: #111;
  box-shadow: 0 0 var(--tmg-glow-blur) var(--tmg-glow-spread) var(--tmg-glow-color);
  isolation: isolate;
}

.tmg-card-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1f2937;
}

.tmg-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

.tmg-card-image:hover img { transform: scale(1.035); }

.tmg-card::after {
  position: absolute;
  z-index: 1;
  inset: 35% 0 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .7));
}

.tmg-placeholder {
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 4rem;
}

.tmg-image-count {
  position: absolute;
  right: .75rem;
  top: .75rem;
  bottom: auto;
  padding: .3rem .6rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, .78);
  font-size: .8rem;
}

.tmg-card-body {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2rem 1rem 8%;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  pointer-events: none;
}

.tmg-typography-custom .tmg-card-body {
  font-family: var(--tmg-font-family);
  font-size: var(--tmg-font-size);
}

.tmg-name,
.tmg-age {
  max-width: 100%;
  margin: 0;
  color: #fff;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.tmg-typography-custom .tmg-name,
.tmg-typography-custom .tmg-age { font-family: inherit; font-size: inherit; }
.tmg-age { margin-top: .35em; }

.tmg-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin: .8rem 0 0;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
}

.tmg-status span {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .18), 0 0 10px rgba(0, 0, 0, .7);
}

.tmg-status.is-present { color: #fff; }
.tmg-status.is-present span { background: #22c55e; }
.tmg-status.is-absent { color: #fff; }
.tmg-status.is-absent span { background: #ef4444; }
.tmg-status.is-soon { color: #fff; }
.tmg-status.is-soon span { background: #facc15; }

.tmg-lightbox {
  position: fixed;
  z-index: 999999;
  inset: 0;
  display: block;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, .98);
  box-sizing: border-box;
}

.tmg-lightbox[hidden] { display: none; }
.tmg-lightbox-figure {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  padding: 1.5rem 5.5rem 3.5rem;
  box-sizing: border-box;
  text-align: center;
}

.tmg-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.tmg-lightbox-caption {
  position: fixed;
  right: 5rem;
  bottom: 1rem;
  left: 5rem;
  min-height: 1.5rem;
  margin: 0;
  color: #fff;
  text-align: center;
}

.tmg-lightbox button {
  position: fixed !important;
  z-index: 1000001 !important;
  display: grid !important;
  place-items: center;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, .28) !important;
  color: #fff !important;
  background: rgba(0, 0, 0, .55) !important;
  box-shadow: none !important;
  font-family: Arial, sans-serif !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  appearance: none;
  cursor: pointer;
}

.tmg-lightbox button::before,
.tmg-lightbox button::after { display: none !important; content: none !important; }
.tmg-lightbox button[hidden] { display: none !important; }
.tmg-lightbox button span { display: block; line-height: 1; transform: none !important; }
.tmg-lightbox-close { top: 1rem !important; right: 1rem !important; width: 3rem; height: 3rem; border-radius: 50% !important; font-size: 2.2rem !important; }
.tmg-lightbox-prev,
.tmg-lightbox-next { top: 50% !important; width: 3.5rem; height: 5rem; border-radius: .5rem !important; font-size: 2.2rem !important; transform: translateY(-50%) !important; }
.tmg-lightbox-prev { left: 1rem !important; }
.tmg-lightbox-next { right: 1rem !important; }
.tmg-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
body.tmg-lightbox-open { overflow: hidden; }

@media (max-width: 767px) {
  .tmg-team { max-width: var(--tmg-card-max-width); }
  .tmg-team[class*="tmg-columns-"] > .tmg-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-flow: row !important;
  }
  .tmg-team[class*="tmg-columns-"] > .tmg-grid > .tmg-card {
    grid-column: 1 !important;
    width: 100% !important;
  }
  .tmg-lightbox-figure { padding: 4rem .5rem 3.5rem; }
  .tmg-lightbox-caption { right: 1rem; left: 1rem; }
  .tmg-lightbox-prev,
  .tmg-lightbox-next { top: auto !important; bottom: 1rem !important; width: 3rem; height: 3rem; transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tmg-card-image img { transition: none; }
}
