/*
 * Valor Maintenance — Services We Handle
 * Hover-flip cards: front shows icon + name, back reveals the description.
 */

.vm-services {
	background-color: var(--vm-bg-light);
}

.vm-services__grid {
	display: grid;
	grid-template-columns: repeat(20, 1fr);
	gap: 1px;
	background-color: var(--vm-border);
	border: 1px solid var(--vm-border);
}

.vm-services__cell {
	grid-column: span 4;
	height: 208px;
	background-color: transparent;
	perspective: 1000px;
}

.vm-services__cell:nth-child(n + 11) {
	grid-column: span 5;
}

/* ---- Flip mechanics ---- */

.vm-services__flip {
	position: relative;
	width: 100%;
	height: 100%;
	transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
	transform-style: preserve-3d;
}

.vm-services__cell:hover .vm-services__flip,
.vm-services__cell:focus-within .vm-services__flip {
	transform: rotateY(180deg);
}

.vm-services__face {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 1.5rem 1.25rem;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.vm-services__face--front {
	background-color: #ffffff;
}

.vm-services__face--back {
	background-color: var(--wp--preset--color--brand-dark);
	transform: rotateY(180deg);
}

/* ---- Face content ---- */

.vm-services__icon {
	display: inline-flex;
	color: var(--vm-heading);
	margin-bottom: 1rem;
	transition: color 0.2s ease;
}

.vm-services__icon svg {
	width: 40px;
	height: 40px;
}

.vm-services__cell:hover .vm-services__icon {
	color: var(--wp--preset--color--brand);
}

.vm-services__face--front h3 {
	color: var(--vm-heading);
	font-size: 1.15rem;
	font-weight: 700;
	margin: 0;
}

.vm-services__face--back p {
	color: #dbe4f0;
	font-size: 0.95rem;
	line-height: 1.55;
	margin: 0;
}

@media (max-width: 1023px) {
	.vm-services__grid {
		grid-template-columns: repeat(6, 1fr);
	}

	.vm-services__cell,
	.vm-services__cell:nth-child(n + 11) {
		grid-column: span 2;
	}

	.vm-services__cell:nth-child(n + 13) {
		grid-column: span 3;
	}
}

@media (max-width: 599px) {
	.vm-services__grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.vm-services__cell,
	.vm-services__cell:nth-child(n + 11),
	.vm-services__cell:nth-child(n + 13) {
		grid-column: span 1;
	}

	.vm-services__cell {
		height: 190px;
	}
}

/* Touch devices can't hover — show name + description stacked instead of flipping. */
@media (hover: none) {
	.vm-services__cell {
		height: auto;
		perspective: none;
		background-color: #ffffff;
	}

	.vm-services__flip {
		transform: none !important;
		transform-style: flat;
		height: auto;
	}

	.vm-services__face {
		position: static;
		transform: none;
		backface-visibility: visible;
		-webkit-backface-visibility: visible;
	}

	.vm-services__face--front {
		padding-bottom: 0.4rem;
	}

	.vm-services__face--back {
		background-color: #ffffff;
		padding-top: 0;
	}

	.vm-services__face--back p {
		color: var(--vm-muted);
	}
}
