/* =========================================================
   Team Übersicht – Frontend
   Variablen (am Raster gesetzt):
     --teamu-size          Durchmesser der runden Fotos
     --teamu-card          Breite einer Mitarbeiterkarte
     --teamu-border-width  Strichstärke des Bildrands (0 = kein Rand)
     --teamu-border-color  Farbe des Bildrands
     --teamu-link-color    Linkfarbe im Text (fehlt = vom Theme geerbt)
   Variablen (am Popup gesetzt):
     --teamu-popup-size, --teamu-popup-border-width, --teamu-border-color
   ========================================================= */

/* Raster ------------------------------------------------- */
.teamu-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 40px 30px;
	margin: 0 auto;
	padding: 20px 0 30px;
}

/* Karte -------------------------------------------------- */
.teamu-member {
	flex: 0 0 var(--teamu-card, 260px);
	max-width: var(--teamu-card, 260px);
	text-align: center;
}

/* Rundes Foto mit optionalem Rand ------------------------ */
.teamu-image-wrap {
	display: block;
	box-sizing: border-box;
	width: var(--teamu-size, 200px);
	height: var(--teamu-size, 200px);
	margin: 0 auto 20px;
	border-radius: 50%;
	border: var(--teamu-border-width, 0px) solid var(--teamu-border-color, transparent);
	overflow: hidden;   /* Zoom bleibt innerhalb des Kreises */
	background: transparent;
}

.teamu-image-wrap.has-popup {
	cursor: pointer;
}

.teamu-image-wrap.has-popup:focus-visible {
	outline: 3px solid var(--teamu-border-color, #333);
	outline-offset: 3px;
}

.teamu-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	transform: scale(1);
	transition: filter 0.35s ease, transform 0.35s ease;
}

/* Effekte (per Einstellung zuschaltbar) ------------------ */
.teamu-grayscale .teamu-img {
	filter: grayscale(100%);
}

.teamu-grayscale .teamu-image-wrap:hover .teamu-img,
.teamu-grayscale .teamu-image-wrap:focus-visible .teamu-img {
	filter: grayscale(0%);
}

.teamu-zoom .teamu-image-wrap:hover .teamu-img,
.teamu-zoom .teamu-image-wrap:focus-visible .teamu-img {
	transform: scale(1.1);
}

/* Name und Text ------------------------------------------ */
.teamu-name {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 6px;
	padding: 0;
	line-height: 1.3;
}

.teamu-position {
	font-size: 14px;
	font-weight: 600;
	font-style: italic;
	margin: 0 0 8px;
	padding: 0;
	line-height: 1.3;
}

.teamu-text {
	font-size: 14px;
	line-height: 1.65;
}

.teamu-text p {
	margin: 0 0 3px;
	padding: 0;
}

.teamu-text a {
	color: var(--teamu-link-color, inherit);
	text-decoration: none;
}

.teamu-text a:hover {
	text-decoration: underline;
}

/* =========================================================
   Kacheln (layout="tiles")
   Variablen: --teamu-tile-cols, --teamu-tile-radius, --teamu-tile-bg,
              --teamu-tile-text, --teamu-tile-icon (+ --teamu-size für das Foto)
   ========================================================= */
.teamu-tiles {
	display: grid;
	grid-template-columns: repeat(var(--teamu-tile-cols, 2), minmax(0, 1fr));
	gap: 24px;
	align-items: start;   /* nur die aufgeklappte Kachel wächst */
	margin: 0 auto;
	padding: 10px 0 20px;
}

.teamu-tile {
	box-sizing: border-box;
	background: var(--teamu-tile-bg, #cfe3de);
	color: var(--teamu-tile-text, inherit);
	border-radius: var(--teamu-tile-radius, 12px);
	padding: 28px 32px;
}

.teamu-tile-head {
	display: flex;
	align-items: center;
	gap: 24px;
}

.teamu-tile-meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-height: var(--teamu-size, 120px);   /* Dreieck sitzt unten, Foto bleibt mittig */
}

.teamu-tile .teamu-name,
.teamu-tile .teamu-position {
	color: var(--teamu-tile-text, inherit);
	text-align: left;
}

.teamu-tile .teamu-name {
	font-size: 18px;
	margin-bottom: 4px;
}

.teamu-tile .teamu-position {
	margin-bottom: 0;
}

.teamu-tile .teamu-image-wrap {
	flex: 0 0 auto;
	margin: 0;
}

/* Dreieck */
.teamu-tile-toggle {
	margin: auto 0 0 -6px;
	padding: 6px;
	border: 0;
	background: transparent;
	line-height: 0;
	cursor: pointer;
	border-radius: 4px;
	box-shadow: none;
}

.teamu-tile-toggle:focus-visible {
	outline: 2px solid var(--teamu-tile-text, #333);
	outline-offset: 2px;
}

.teamu-tile-arrow {
	display: block;
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-left: 14px solid var(--teamu-tile-icon, #fff);
	transition: transform 0.25s ease;
}

.teamu-tile.is-open .teamu-tile-arrow {
	transform: rotate(90deg);
}

.teamu-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Aufgeklappter Text */
.teamu-tile-body {
	padding-top: 16px;
	text-align: left;
}

.teamu-tile-body[hidden] {
	display: none;
}

.teamu-tile .teamu-text {
	color: var(--teamu-tile-text, inherit);
}

/* =========================================================
   Popup
   ========================================================= */
.teamu-popup {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.70);
	z-index: 2147483647; /* liegt garantiert über allen Divi-Elementen */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.4s ease, visibility 0.4s ease;
}

.teamu-popup.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.teamu-popup-inner {
	box-sizing: border-box;
	width: min(var(--teamu-popup-size, 520px), 84vw);
	height: min(var(--teamu-popup-size, 520px), 84vw);
	max-height: 84vh;
	max-width: 84vh;
	border-radius: 50%;
	border: var(--teamu-popup-border-width, 0px) solid var(--teamu-border-color, transparent);
	overflow: hidden;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

#teamu-popup-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
	.teamu-member {
		flex: 0 0 calc(var(--teamu-card, 260px) * 0.85);
		max-width: calc(var(--teamu-card, 260px) * 0.85);
	}
	.teamu-image-wrap {
		width: calc(var(--teamu-size, 200px) * 0.8);
		height: calc(var(--teamu-size, 200px) * 0.8);
	}
}

@media (max-width: 900px) {
	.teamu-tiles {
		grid-template-columns: repeat(min(var(--teamu-tile-cols, 2), 2), minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.teamu-member {
		flex: 0 0 100%;
		max-width: 320px;
	}
	.teamu-tiles {
		grid-template-columns: minmax(0, 1fr);
	}
	.teamu-tile {
		padding: 20px 22px;
	}
	.teamu-tile-head {
		gap: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.teamu-img,
	.teamu-tile-arrow,
	.teamu-popup {
		transition: none;
	}
}
