/*
 * Team grid (block magnet/team-grid, /chi-siamo/ and /en/about/).
 * Plain file outside the Vite build, enqueued by magnet_render_team_grid_markup().
 * Overrides the legacy .magnet-team-layout rules still compiled into main.css.
 */

.magnet-team-layout {
	--team-line: var(--svc-card-line, #3f3f46);
	--team-card: var(--svc-card, #141417);
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
}

.magnet-team-card {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	min-width: 0;
	border: 2px solid var(--team-line);
	background: var(--team-card);
	color: var(--svc-ink, #fff);
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.magnet-team-card__photo {
	position: relative;
	margin: 0;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-block-end: 2px solid var(--team-line);
	background: #0a0a0a;
}

.magnet-team-card__photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 30%;
	transition:
		filter 0.5s ease,
		transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.magnet-team-card__body {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	gap: 0.625rem;
	min-width: 0;
	padding: 1.125rem 1.125rem 1.25rem;
}

.magnet-team-card__name {
	margin: 0;
	font-family: "Space Grotesk", sans-serif;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	text-wrap: balance;
	color: inherit;
}

.magnet-team-card__link {
	color: inherit;
	text-decoration: none;
}

/* The whole card opens the person page when there is one. */
.magnet-team-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.magnet-team-card__link:focus-visible {
	outline: none;
}

.magnet-team-card:has(.magnet-team-card__link:focus-visible) {
	outline: 3px solid #e30613;
	outline-offset: 3px;
}

.magnet-team-card__role {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #f87171;
}

.magnet-team-card__role::before {
	content: "";
	flex: none;
	width: 1.25rem;
	height: 2px;
	background: #e30613;
}

/*
 * "Scopri il profilo" is the visible cue that the whole card is one link
 * (the real <a> on the name stretches over the card). It is a full-width footer
 * row (52px tall on phones) with a red arrow tile: it turns solid red on hover/focus, like the service cards.
 */
.magnet-team-card__more {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	min-height: 3.25rem;
	margin: auto -1.125rem -1.25rem;
	padding: 0.5rem 1.125rem;
	border-top: 2px solid var(--team-line);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--svc-ink, #fff);
	transition:
		background-color 0.2s ease,
		color 0.2s ease;
}

.magnet-team-card__more::after {
	content: "\2192";
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border: 2px solid #e30613;
	padding-bottom: 0.125rem;
	box-sizing: border-box;
	font-family: system-ui, sans-serif;
	font-size: 1.125rem;
	line-height: 1;
	letter-spacing: 0;
	color: #e30613;
	transition:
		background-color 0.2s ease,
		color 0.2s ease,
		transform 0.2s ease;
}

/* Touch: no mouse hover, so a press shows the same red state. */
.magnet-team-card.has-page:active {
	border-color: #e30613;
}

.magnet-team-card.has-page:active .magnet-team-card__more {
	border-top-color: #e30613;
	background: #e30613;
	color: #fff;
}

.magnet-team-card.has-page:active .magnet-team-card__more::after {
	border-color: #fff;
	color: #fff;
}

.magnet-team-card__actions {
	position: absolute;
	inset-block-start: 0.5rem;
	inset-inline-end: 0.5rem;
	z-index: 2;
}

/*
 * LinkedIn is a secondary action: a small quiet chip. The anchor keeps a 44px
 * hit area, the visible chip is smaller and fills red only on hover/focus.
 */
.magnet-team-card__linkedin {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	background: none;
	color: rgba(255, 255, 255, 0.85);
}

.magnet-team-card__linkedin::before {
	content: "";
	position: absolute;
	inset: 0.5rem;
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: rgba(10, 10, 10, 0.55);
	transition:
		background-color 0.2s ease,
		border-color 0.2s ease;
}

.magnet-team-card__linkedin svg,
.magnet-team-card__linkedin i {
	position: relative;
	width: 0.875rem;
	height: 0.875rem;
}

.magnet-team-card__linkedin:hover,
.magnet-team-card__linkedin:focus-visible {
	color: #fff;
}

.magnet-team-card__linkedin:hover::before,
.magnet-team-card__linkedin:focus-visible::before {
	border-color: #e30613;
	background: #e30613;
}

.magnet-team-card__linkedin:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 0;
}

/* Tablet: two vertical cards per row. */
@media (min-width: 768px) {
	.magnet-team-layout {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1.5rem;
	}

	.magnet-team-card__photo {
		aspect-ratio: 1;
	}

	.magnet-team-card__body {
		gap: 0.75rem;
		padding: 1.25rem 1.25rem 1.5rem;
	}

	/* Two lines reserved for every name, so roles line up across the row. */
	.magnet-team-card__name {
		min-height: 2.1em;
	}

	.magnet-team-card__more {
		min-height: 0;
		margin: auto -1.25rem -1.5rem;
		padding: 0.625rem 1.25rem;
	}

	.magnet-team-card__actions {
		inset-block-start: 0.75rem;
		inset-inline-end: 0.75rem;
	}
}

/* Desktop: the whole team on one row, aligned with the section heading. */
@media (min-width: 1024px) {
	.magnet-team-layout {
		grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
		gap: 2rem;
	}

	.magnet-team-card__body {
		padding: 1.5rem 1.5rem 1.75rem;
	}

	.magnet-team-card__more {
		margin: auto -1.5rem -1.75rem;
		padding-inline: 1.5rem;
	}

	.magnet-team-card__name {
		font-size: clamp(1.375rem, 0.6rem + 1.1vw, 1.75rem);
	}
}

/* Desktop hover: black and white portraits come to colour, red offset like the service cards. */
@media (hover: hover) and (pointer: fine) {
	.magnet-team-card__photo img {
		filter: grayscale(100%) contrast(1.05);
	}

	.magnet-team-card:hover,
	.magnet-team-card:has(.magnet-team-card__link:focus-visible) {
		border-color: #e30613;
		box-shadow: 8px 8px 0 #e30613;
	}

	.magnet-team-card:hover .magnet-team-card__photo img,
	.magnet-team-card:has(.magnet-team-card__link:focus-visible) .magnet-team-card__photo img {
		filter: none;
		transform: scale(1.04);
	}

	.magnet-team-card.has-page:hover .magnet-team-card__name {
		color: #f87171;
	}

	@media (min-width: 768px) {
		.magnet-team-card.has-page:hover .magnet-team-card__more,
		.magnet-team-card:has(.magnet-team-card__link:focus-visible) .magnet-team-card__more {
			border-top-color: #e30613;
			background: #e30613;
			color: #fff;
		}
	}

	.magnet-team-card.has-page:hover .magnet-team-card__more::after,
	.magnet-team-card:has(.magnet-team-card__link:focus-visible) .magnet-team-card__more::after {
		background: #e30613;
		color: #fff;
		transform: translateX(4px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.magnet-team-card,
	.magnet-team-card__photo img,
	.magnet-team-card__more,
	.magnet-team-card__more::after {
		transition: none;
	}

	.magnet-team-card.has-page:hover .magnet-team-card__more::after,
	.magnet-team-card:has(.magnet-team-card__link:focus-visible) .magnet-team-card__more::after {
		transform: none;
	}

	.magnet-team-card:hover .magnet-team-card__photo img,
	.magnet-team-card:has(.magnet-team-card__link:focus-visible) .magnet-team-card__photo img {
		transform: none;
	}
}
