/**
 * Visiokom Essentials — Services ([services] shortcode + single template).
 *
 * Follows the Visiokom design system (wp-content/DESIGN-SYSTEM.md): flat,
 * squared, red accent, tokens consumed from the theme's design-system/tokens.css.
 * Because this file ships with the plugin, every var() carries a literal
 * fallback so it still renders sensibly if the theme is swapped out.
 *
 * Class prefix: .ve- (Visiokom Essentials), BEM naming.
 */

/* =========================================================================
   Layout — sticky group menu + content column
   ========================================================================= */
.ve-services--with-menu {
	display: flex;
	align-items: flex-start;
	gap: 2.5rem;
}

.ve-services__menu {
	flex: 0 0 220px;
	position: sticky;
	top: 1rem;
}

.ve-services__menu-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-left: 1px solid var(--vk-border, #d9dce0);
}

.ve-services__menu-item {
	margin: 0;
}

.ve-services__menu-link {
	display: block;
	padding: 0.6rem 0.75rem;
	margin-left: -1px; /* Sit on the list's left rule so the active bar replaces it. */
	border-left: 3px solid transparent;
	text-decoration: none;
	color: var(--vk-ink-soft, #5a626b);
	transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.ve-services__menu-link:hover,
.ve-services__menu-link:focus-visible {
	color: var(--vk-ink, #1b1f24);
	background: var(--vk-bg-muted, #f6f4f2);
}

.ve-services__menu-item.is-active .ve-services__menu-link {
	color: var(--vk-ink, #1b1f24);
	font-weight: 600;
	border-left-color: var(--vk-accent, #c8102e);
	background: var(--vk-bg-muted, #f6f4f2);
}

.ve-services__content {
	flex: 1 1 auto;
	min-width: 0;
}

@media (max-width: 780px) {
	.ve-services--with-menu {
		flex-direction: column;
		gap: 1.5rem;
	}

	.ve-services__menu {
		position: static;
		flex-basis: auto;
		width: 100%;
	}

	.ve-services__menu-list {
		display: flex;
		flex-wrap: wrap;
		gap: 0.5rem;
		border-left: 0;
	}

	/* Squared chips on mobile; the active one gets the accent bottom bar. */
	.ve-services__menu-link {
		padding: 0.4rem 0.85rem;
		margin-left: 0;
		border: 1px solid var(--vk-border, #d9dce0);
		border-left-width: 1px;
	}
	.ve-services__menu-item.is-active .ve-services__menu-link {
		border-color: var(--vk-accent, #c8102e);
		border-left-color: var(--vk-accent, #c8102e);
	}
}

/* =========================================================================
   Service groups
   ========================================================================= */
.ve-services__group {
	margin-bottom: 3rem;
}

.ve-services__group-heading {
	margin-bottom: 1.25rem;
}

.ve-services__group-image {
	display: block;
	width: 100%;
	max-height: 240px;
	object-fit: cover;
	margin-bottom: 1rem;
}

/* Group title carries the squared accent tick (same as .vk-section__title). */
.ve-services__group-title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
}
.ve-services__group-title::before {
	content: "";
	flex: 0 0 auto;
	width: 6px;
	height: 1em;
	background: var(--vk-accent, #c8102e);
}

/* =========================================================================
   Service cards grid
   ========================================================================= */
.ve-services__grid {
	display: grid;
	grid-template-columns: repeat(var(--ve-services-columns, 3), 1fr);
	gap: 1.5rem;
}

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

@media (max-width: 600px) {
	.ve-services__grid {
		grid-template-columns: 1fr;
	}
}

/* Flat squared card — accent border + lift + sliding underline on hover,
   mirroring the site-wide .vk-card component. */
.ve-services__card {
	position: relative;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	background: var(--vk-bg, #ffffff);
	border: 1px solid var(--vk-border, #d9dce0);
	overflow: hidden;
	transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.ve-services__card:hover,
.ve-services__card:focus-visible {
	border-color: var(--vk-accent, #c8102e);
	transform: translateY(-4px);
	box-shadow: var(--vk-shadow-lift, 0 12px 24px -12px rgba(27, 31, 36, .25));
}

.ve-services__card::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 3px;
	background: var(--vk-accent, #c8102e);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .25s ease;
}
.ve-services__card:hover::after,
.ve-services__card:focus-visible::after { transform: scaleX(1); }

.ve-services__card-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-bottom: 1px solid var(--vk-border, #d9dce0);
}

.ve-services__card-body {
	padding: 1rem 1.25rem 1.5rem;
}

.ve-services__card-title {
	margin: 0 0 0.5rem;
	color: var(--vk-ink, #1b1f24);
	transition: color .2s ease;
}
.ve-services__card:hover .ve-services__card-title,
.ve-services__card:focus-visible .ve-services__card-title {
	color: var(--vk-accent, #c8102e);
}

.ve-services__card-excerpt {
	font-size: 0.95rem;
	color: var(--vk-ink-soft, #5a626b);
}

.ve-services__empty {
	color: var(--vk-ink-soft, #5a626b);
}

/* Standalone card placed by [service_card] outside the grid. Cap the width
   so a lone card in a full-width content column keeps card proportions
   (one-off value — no layout token covers component widths). */
.ve-service-card {
	max-width: 380px;
}

.ve-service-card__missing {
	color: var(--vk-accent, #c8102e);
}

/* =========================================================================
   Single service template
   ========================================================================= */
.ve-service__hero img {
	display: block;
	width: 100%;
	height: auto;
}

.ve-service__groups {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

/* Squared uppercase group badge — mirrors the site-wide .vk-badge. */
.ve-service__group-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .08em;
	padding: 4px 12px;
	background: var(--vk-bg-muted, #f6f4f2);
	border: 1px solid var(--vk-border, #d9dce0);
	text-decoration: none;
	color: var(--vk-ink-soft, #5a626b);
	transition: color .15s ease, border-color .15s ease;
}
.ve-service__group-badge:hover,
.ve-service__group-badge:focus-visible {
	color: var(--vk-accent, #c8102e);
	border-color: var(--vk-accent, #c8102e);
}

.ve-service__title {
	margin: 0 0 1.5rem;
}

/* =========================================================================
   Motion preferences
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
	.ve-services__menu-link,
	.ve-services__card,
	.ve-services__card::after,
	.ve-services__card-title,
	.ve-service__group-badge {
		transition: none;
	}
	.ve-services__card:hover,
	.ve-services__card:focus-visible {
		transform: none;
	}
}
