/*
 * Service pages: the systems map (VOY-1528, spec KB-554 /about/ section 04).
 *
 * Six system cards in a 3 x 2 grid, the page's one live dither surface. Each
 * card names its practice with a vy-svc-sys--<practice> class, which sets
 * --sys-500 / --sys-700 from the same scale steps as the umbrella pairs in
 * custom.css; the square before its number is that colour. On hover the card
 * takes the colour, the other cards dim, and svc-systems.js points the
 * field's --um-500 / --um-700 at the card, so the dither follows it. The cards
 * are translucent so the field shows through them; the surface runs 24px past
 * the grid so the comet is not clipped at the card edges.
 *
 * Off on touch and with reduced motion (vy-dither.js), where the cards stand
 * on their own. Below 768px the grid becomes a ruled list.
 */

/* A card with no practice class takes the page pair. :where() keeps it at zero
   specificity, so a practice class always wins. */
:where(.vy-svc-sys) { --sys-500: var(--um-500); --sys-700: var(--um-700); }
.vy-svc-page .vy-svc-sys--wordpress { --sys-500: var(--color-violet-300);         --sys-700: var(--color-violet-450); }
.vy-svc-page .vy-svc-sys--seo       { --sys-500: var(--color-cyan-400);           --sys-700: var(--color-cyan-550); }
.vy-svc-page .vy-svc-sys--ai        { --sys-500: var(--color-service-ai-500);     --sys-700: var(--color-service-ai-700); }
.vy-svc-page .vy-svc-sys--social    { --sys-500: var(--color-service-social-500); --sys-700: var(--color-service-social-700); }
.vy-svc-page .vy-svc-sys--ads       { --sys-500: var(--color-service-ads-500);    --sys-700: var(--color-service-ads-700); }
.vy-svc-page .vy-svc-sys--marketing { --sys-500: var(--color-magenta-400);        --sys-700: var(--color-magenta-450); }

.vy-svc-page .vy-svc-systems {
	position: relative;
	isolation: isolate;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}
/* Only where the page gutter (32px from 782px) is wider than the overhang. */
@media (min-width: 1024px) {
	.vy-svc-page .vy-svc-systems { margin: -24px; padding: 24px; }
}
.vy-svc-page .vy-svc-systems > .vy-dither {
	position: absolute;
	inset: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.vy-svc-page .vy-svc-sys {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 26px;
	border: 1px solid var(--border-1);
	border-radius: 6px;
	background: color-mix(in oklab, var(--bg-panel) 80%, transparent);
	transition:
		border-color 220ms var(--svc-ease),
		background-color 220ms var(--svc-ease),
		opacity 220ms var(--svc-ease);
}

.vy-svc-page .vy-svc-sys__num {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--fg-4);
}
/* The practice square, drawn so the number stays the paragraph's only text. */
.vy-svc-page .vy-svc-sys__num::before {
	content: "";
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 3px;
	background: var(--sys-500);
}

.vy-svc-page .vy-svc-sys__name {
	font-family: var(--font-display);
	font-size: 24px;
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.015em;
	color: var(--fg-1);
}
.vy-svc-page .vy-svc-sys__desc {
	max-width: 40ch;
	font-size: 15px;
	line-height: 1.55;
	color: var(--fg-3);
}

/* ---- Hover: the card takes its practice colour, the rest step back ---------------- */

.vy-svc-page .vy-svc-sys:is(:hover, .is-lit) {
	border-color: var(--sys-500);
	background: color-mix(in oklab, var(--bg-raised) 94%, transparent);
}
.vy-svc-page .vy-svc-systems:has(.vy-svc-sys:hover) .vy-svc-sys:not(:hover) { opacity: 0.55; }

/* ---- Tablet: two across ---------------------------------------------------------- */

@media (max-width: 1023px) {
	.vy-svc-page .vy-svc-systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Mobile: a ruled list, the practice square beside each name ---------------------- */

@media (max-width: 767px) {
	.vy-svc-page .vy-svc-systems {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
		border-top: 1px solid var(--border-hair);
	}
	.vy-svc-page .vy-svc-sys {
		display: grid;
		grid-template-columns: 10px minmax(0, 1fr);
		gap: 6px 14px;
		padding: 18px 0;
		border: 0;
		border-bottom: 1px solid var(--border-hair);
		border-radius: 0;
		background: none;
	}
	.vy-svc-page .vy-svc-sys__num {
		grid-row: 1;
		grid-column: 1;
		align-self: center;
		gap: 0;
		font-size: 0;
	}
	.vy-svc-page .vy-svc-sys__name { grid-column: 2; font-size: 18px; }
	.vy-svc-page .vy-svc-sys__desc { grid-column: 2; font-size: 14px; }
	.vy-svc-page .vy-svc-sys:is(:hover, .is-lit) { background: none; }
	.vy-svc-page .vy-svc-systems:has(.vy-svc-sys:hover) .vy-svc-sys:not(:hover) { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.vy-svc-page .vy-svc-sys { transition: none; }
}
