/*
 * Services wheel (docs/04-services-wheel.md).
 *
 *   no JS          plain nested list (services -> children) styled as cards
 *   JS, < 992px    stacked: family circle, 2-column grid of service buttons, accordion of child chips under the row
 *   JS, >= 992px   radial: family circle in the middle, services on an inner ring, children on an outer ring
 *
 * Positions use rotate() translate() rotate(); JS only sets the angles (--angle, --pangle, --k).
 * The pixel sizes below are mirrored in js/wheel-core.js and checked by tests/js/wheel-core.test.mjs.
 */

.vc-wheel {
	--vcw-stage: 760px;
	--vcw-centre: 240px;
	--vcw-parent: 128px;
	--vcw-child: 100px;
	--vcw-r1: 196px;
	--vcw-r2: 322px;
	--vcw-ease: 250ms ease-out;
	--vcw-pop: 520ms cubic-bezier(0.34, 1.56, 0.64, 1);   /* springy overshoot for circles flying out */
}

.vc-wheel [hidden] { display: none !important; }

.vc-wheel__intro { margin-bottom: 2rem; }

.vc-wheel__intro > * { margin-top: 0; }

/* ----------------------------------------------------------- centre image */
.vc-wheel__centre {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 160px;
	height: 160px;
	margin: 0 auto 2rem;
	overflow: hidden;
	background: var(--vc-white);
	border: 2px solid var(--vc-tan);
	border-radius: 50%;
}

.vc-wheel__centre img {
	display: block;
	width: 84%;
	height: 84%;
	object-fit: contain;
}

/* ------------------------------------------------ no-JS fallback: card list */
.vc-wheel__list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 640px) {
	.vc-wheel__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
	.vc-wheel__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.vc-wheel__service {
	padding: 24px;
	background: var(--vc-white);
	border: 1px solid var(--vc-sand);
	border-radius: var(--vc-radius);
}

.vc-wheel__service-title {
	margin: 0 0 0.25rem;
	font-size: var(--vc-h3);
}

.vc-wheel__service-title .fas { margin-inline-end: 0.5rem; color: var(--vc-tan-deep); font-size: 0.9em; }

.vc-wheel__tagline { margin: 0 0 1rem; color: var(--vc-ink); }

.vc-wheel__service-children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vc-wheel__service-children li { padding: 0.5rem 0; border-top: 1px solid var(--vc-sand); }

/* ------------------------------------------------- enhanced: shared pieces */
.vc-wheel.is-enhanced .vc-wheel__list { display: none; }

/* Without JavaScript there is nothing to select: the list is already open, so the instruction would mislead. */
.vc-wheel:not(.is-enhanced) .vc-wheel__intro .vc-lead { display: none; }

.vc-wheel__lines { display: none; }

.vc-wheel__parent,
.vc-wheel__child {
	display: flex;
	align-items: center;
	font-family: var(--vc-font-body);
	font-weight: 600;
	line-height: 1.2;
	color: var(--vc-black);
	cursor: pointer;
	text-decoration: none;
	-webkit-appearance: none;
	appearance: none;
}

.vc-wheel__parent {
	gap: 0.6rem;
	min-height: 64px;
	padding: 0.75rem 1rem;
	font-size: 0.9375rem;
	text-align: left;
	background: var(--vc-sand);
	border: 1px solid var(--vc-tan);
	border-radius: 28px;
	transition: background-color 0.2s ease-out, color 0.2s ease-out, border-color 0.2s ease-out;
}

.vc-wheel__parent:hover { border-color: var(--vc-black); }

.vc-wheel__icon { flex: none; width: 1.5rem; text-align: center; font-size: 1.125rem; color: var(--vc-tan-deep); }

.vc-wheel__item.is-open > .vc-wheel__parent {
	background: var(--vc-black);
	border-color: var(--vc-black);
	color: var(--vc-white);
}

.vc-wheel__item.is-open > .vc-wheel__parent .vc-wheel__icon { color: var(--vc-tan); }

.vc-wheel__child {
	padding: 0.6rem 1rem;
	font-size: 0.9375rem;
	text-align: left;
	background: var(--vc-white);
	border: 1px solid var(--vc-tan);
	border-radius: 999px;
	transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
}

.vc-wheel__child:hover { background: var(--vc-cream); border-color: var(--vc-black); }


.vc-wheel__close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--vc-black);
	font-size: 1.25rem;
	line-height: 1;
	background: transparent;
	border: 0;
	cursor: pointer;
}

/* ------------------------------------------ enhanced, < 992px: stacked layout */
.vc-wheel.is-enhanced .vc-wheel__stage {
	max-width: 560px;
	margin-inline: auto;
}

.vc-wheel__parents {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.vc-wheel__item { display: contents; }

.vc-wheel__parent { order: var(--o, 0); }

.vc-wheel__panel {
	display: none;
	grid-column: 1 / -1;
	order: var(--o2, 0);
	padding: 4px 0 8px;
}

.vc-wheel__item.is-open .vc-wheel__panel { display: block; }

.vc-wheel__children {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 8px 0;
	list-style: none;
}

/* ----------------------------------------- enhanced, >= 992px: radial layout */
@media (min-width: 992px) {
	.vc-wheel.is-enhanced .vc-wheel__stage {
		position: relative;
		width: min(100%, var(--vcw-stage));
		max-width: none;
		margin-inline: auto;
		aspect-ratio: 1 / 1;
	}

	.vc-wheel.is-enhanced .vc-wheel__centre {
		position: absolute;
		left: 50%;
		top: 50%;
		width: var(--vcw-centre);
		height: var(--vcw-centre);
		margin: calc(var(--vcw-centre) / -2) 0 0 calc(var(--vcw-centre) / -2);
	}

	.vc-wheel.is-enhanced .vc-wheel__lines {
		position: absolute;
		inset: 0;
		display: block;
		width: 100%;
		height: 100%;
		pointer-events: none;
	}

	/* Decoration: two dashed orbits that turn once and settle, and a soft pulse behind the family picture. Every idle animation
   stops within 5 seconds (WCAG 2.2.2); after that only hover, focus and clicks move anything. */
	.vc-wheel__orbit,
	.vc-wheel__ping {
		fill: none;
		transform-box: fill-box;
		transform-origin: center;
	}

	.vc-wheel__orbit { stroke: var(--vc-tan); stroke-width: 1; opacity: 0.55; }

	.vc-wheel__orbit--inner { stroke-dasharray: 2 9; stroke-linecap: round; }

	.vc-wheel__orbit--outer { stroke-dasharray: 1 14; stroke-linecap: round; opacity: 0.35; }

	.vc-wheel.is-in .vc-wheel__orbit--inner { animation: vcw-spin 4.5s cubic-bezier(0.2, 0.6, 0.3, 1) 1 both; }

	.vc-wheel.is-in .vc-wheel__orbit--outer { animation: vcw-spin 4.5s cubic-bezier(0.2, 0.6, 0.3, 1) 1 reverse both; }

	.vc-wheel__ping { stroke: var(--vc-tan); stroke-width: 2; opacity: 0; }

	.vc-wheel.is-in .vc-wheel__ping { animation: vcw-ping 2.2s ease-out 700ms 2; }

	/* The connector of the opened service: a short stem, then the track the children sit on. Both draw themselves in. */
	.vc-wheel__stem,
	.vc-wheel__track {
		fill: none;
		stroke: var(--vc-tan);
		stroke-width: 1.5;
		stroke-linecap: round;
		stroke-dasharray: 1;
		stroke-dashoffset: 1;
		transition: stroke-dashoffset 380ms ease-out;
	}

	.vc-wheel__track { transition: stroke-dashoffset 700ms cubic-bezier(0.45, 0, 0.2, 1) 240ms; }

	.vc-wheel__lines.is-on .vc-wheel__stem,
	.vc-wheel__lines.is-on .vc-wheel__track { stroke-dashoffset: 0; }

	.vc-wheel__parents {
		position: absolute;
		inset: 0;
		display: block;
	}

	/* One full-stage layer per service; only its buttons take pointer events. */
	.vc-wheel__item {
		position: absolute;
		inset: 0;
		display: block;
		pointer-events: none;
	}

	.vc-wheel__parent,
	.vc-wheel__child { pointer-events: auto; }

	.vc-wheel__panel { display: contents; padding: 0; }

	.vc-wheel__children { display: contents; padding: 0; }

	.vc-wheel__children > li { display: contents; }

	/* Inner ring */
	.vc-wheel__parent {
		position: absolute;
		left: 50%;
		top: 50%;
		flex-direction: column;
		justify-content: center;
		gap: 0.3rem;
		width: var(--vcw-parent);
		height: var(--vcw-parent);
		min-height: 0;
		margin: calc(var(--vcw-parent) / -2) 0 0 calc(var(--vcw-parent) / -2);
		padding: 12px;
		text-align: center;
		border-radius: 50%;
		transform: rotate(var(--angle, 0deg)) translateX(var(--vcw-r1)) rotate(calc(var(--angle, 0deg) * -1)) scale(var(--scale, 1));
		transition: transform var(--vcw-ease), opacity var(--vcw-ease), background-color 0.2s ease-out, color 0.2s ease-out, border-color 0.2s ease-out;
	}

	/* Entrance: the circles pop in one after another when the wheel first scrolls into view, then float gently for a few seconds. */
	.vc-wheel.is-enhanced:not(.is-in) .vc-wheel__parent,
	.vc-wheel.is-enhanced:not(.is-in) .vc-wheel__centre { opacity: 0; }

	.vc-wheel.is-in .vc-wheel__parent {
		animation: vcw-in 700ms cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--i, 0) * 90ms + 150ms) both,
			vcw-bob 1.8s ease-in-out calc(var(--i, 0) * 100ms + 800ms) 2;
	}

	.vc-wheel.is-in .vc-wheel__centre { animation: vcw-in 800ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }

	/* Floating pauses while a service is open or the pointer is on a circle, so nothing drifts under the cursor. */
	.vc-wheel.has-open .vc-wheel__parent,
	.vc-wheel__parent:hover,
	.vc-wheel__parent:focus-visible { animation-play-state: paused; }

	.vc-wheel__parent:hover { --scale: 1.07; box-shadow: 0 10px 24px rgba(77, 60, 44, 0.2); }

	.vc-wheel__item.is-open > .vc-wheel__parent { --scale: 1.08; z-index: 2; box-shadow: 0 0 0 6px rgba(185, 159, 132, 0.28), 0 12px 28px rgba(0, 0, 0, 0.25); }

	/* The other parents are dimmed with an opaque lighter fill, not with opacity: a translucent circle let a connector line
	   show through it (QA L1). The lines run behind the parents, so a line that passes one is hidden by it. */
	.vc-wheel.has-open .vc-wheel__item:not(.is-open) > .vc-wheel__parent {
		background-color: color-mix(in srgb, var(--vc-sand) 55%, var(--vc-white));
		border-color: color-mix(in srgb, var(--vc-tan) 55%, var(--vc-white));
		color: var(--vc-tan-deep);
	}

	.vc-wheel__icon { width: auto; font-size: 1.25rem; }

	/* Outer ring: children start on their parent and fan out to the arc (same transform function list, so CSS interpolates). */
	.vc-wheel__child {
		--ca: var(--pangle, 0deg);
		--cr: var(--vcw-r1);
		--cs: 0.4;
		position: absolute;
		left: 50%;
		top: 50%;
		justify-content: center;
		width: var(--vcw-child);
		height: var(--vcw-child);
		margin: calc(var(--vcw-child) / -2) 0 0 calc(var(--vcw-child) / -2);
		padding: 8px;
		font-size: 0.8125rem;
		text-align: center;
		overflow-wrap: anywhere;
		hyphens: auto;
		border-radius: 50%;
		opacity: 0;
		visibility: hidden;
		transform: rotate(var(--ca)) translateX(var(--cr)) rotate(calc(var(--ca) * -1)) scale(var(--cs));
		transition: transform 260ms ease-in, opacity 200ms ease-in, visibility 0s linear 260ms, background-color 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
	}

	.vc-wheel__child.is-long { font-size: 0.75rem; }

	.vc-wheel__child:hover { box-shadow: 0 8px 20px rgba(77, 60, 44, 0.18); }

	.vc-wheel__item.is-open .vc-wheel__child {
		--ca: var(--angle);
		--cr: var(--vcw-r2);
		--cs: 1;
		opacity: 1;
		visibility: visible;
		transition: transform var(--vcw-pop) calc(var(--k, 0) * 70ms + 160ms), opacity 260ms ease-out calc(var(--k, 0) * 70ms + 160ms), visibility 0s, background-color 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
	}
}

/* ------------------------------------------------------------------ keyframes */
@keyframes vcw-in {
	from { opacity: 0; scale: 0.2; }
	to { opacity: 1; scale: 1; }
}

@keyframes vcw-bob {
	0%, 100% { translate: 0 0; }
	50% { translate: 0 -7px; }
}

@keyframes vcw-spin { to { transform: rotate(50deg); } }

@keyframes vcw-ping {
	0% { opacity: 0.55; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.5); }
}

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
	.vc-wheel *,
	.vc-wheel *::before,
	.vc-wheel *::after {
		transition-duration: 0.01ms !important;
		transition-delay: 0ms !important;
		animation: none !important;
	}
}

/* ============================================================ descriptions (module "Show: Descriptions") */
/* The circles link here. Headings sit clear of the sticky header when the page scrolls to them. */
.vc-wd { max-width: 60rem; margin-inline: auto; }
.vc-wd__intro { margin: 0 0 2rem; }
.vc-wd__intro h2 { margin: 0.25rem 0 0.5rem; }
.vc-wd__intro .vc-lead { margin: 0; }

.vc-wd__group {
	margin: 0 0 1rem;
	background: var(--vc-white);
	border: 1px solid var(--vc-sand);
	border-radius: 1.25rem;
	transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}
.vc-wd__group:hover,
.vc-wd__group[open] { border-color: var(--vc-tan); }
.vc-wd__group[open] { box-shadow: 0 8px 24px rgba(77, 60, 44, 0.08); }

/* The service name is the dropdown's button. */
.vc-wd__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.125rem 1.5rem;
	border-radius: 1.25rem;
	cursor: pointer;
	list-style: none;
}
.vc-wd__summary::-webkit-details-marker { display: none; }
.vc-wd__summary::after {
	content: "";
	flex: none;
	width: 0.6rem;
	height: 0.6rem;
	margin-inline-end: 0.25rem;
	border-right: 2px solid var(--vc-black);
	border-bottom: 2px solid var(--vc-black);
	transform: rotate(45deg);
	transition: transform 0.2s ease-out;
}
.vc-wd__group[open] > .vc-wd__summary::after { transform: rotate(-135deg); }
.vc-wd__summary:focus-visible { outline: 2px solid var(--vc-black); outline-offset: 3px; }
.vc-wd__group[open] > .vc-wd__summary { border-bottom: 1px solid var(--vc-sand); border-radius: 1.25rem 1.25rem 0 0; }
.vc-wd__group > .vc-wd__items,
.vc-wd__group > .vc-wd__note { margin-inline: 1.5rem; }
.vc-wd__group > .vc-wd__items { padding-top: 1.25rem; }
.vc-wd__group > .vc-wd__note { margin-bottom: 1.5rem; }
.vc-wd__group > .vc-wd__items:last-child { padding-bottom: 1.5rem; }
.vc-wd__group-title {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.75rem;
	margin: 0;
	font-family: var(--vc-font-display);
	font-size: var(--vc-h3);
	font-weight: 600;
}
.vc-wd__group-title > i { color: var(--vc-tan-deep); }
.vc-wd__tagline { flex-basis: 100%; font-family: var(--vc-font-body); font-size: var(--vc-small); font-weight: 400; }

.vc-wd__item,
.vc-wd__part { scroll-margin-top: 7rem; }

.vc-wd__item {
	margin: 0 0 1rem;
	padding: 1.25rem 1.5rem;
	background: var(--vc-cream);
	border: 1px solid var(--vc-sand);
	border-radius: var(--vc-radius);
}
.vc-wd__item:focus { outline: none; }
.vc-wd__item:focus-visible,
.vc-wd__part:focus-visible { outline: 2px solid var(--vc-black); outline-offset: 3px; }

.vc-wd__item-title { margin: 0 0 0.5rem; font-family: var(--vc-font-body); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.vc-wd__text { margin: 0 0 1rem; max-width: var(--vc-measure, 68ch); }

.vc-wd__part { margin: 0 0 1rem; padding: 0.875rem 0 0 1rem; border-inline-start: 3px solid var(--vc-tan); }
.vc-wd__part:focus { outline: none; }
.vc-wd__part-title { margin: 0 0 0.375rem; font-family: var(--vc-font-body); font-size: 1.0625rem; font-weight: 700; }
.vc-wd__part .vc-wd__text { margin-bottom: 0.5rem; }

.vc-wd__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0.5rem 0 0; }
.vc-wd__actions .vc-btn { padding: 0.6rem 1.1rem; font-size: 0.9375rem; }
.vc-wd__back {
	display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.25rem; border: 2px solid var(--vc-black); border-radius: 999px;
	background: var(--vc-black); color: var(--vc-white); font-size: 0.9375rem; font-weight: 600; text-decoration: none;
	transition: background-color 0.2s ease-out, box-shadow 0.2s ease-out;
}
.vc-wd__back i { color: var(--vc-tan); }
.vc-wd__back:hover { color: var(--vc-white); background: #222; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); text-decoration: none; }
.vc-wd__back:focus-visible { outline: 2px solid var(--vc-black); outline-offset: 3px; }
.vc-wd__note { margin: 0.5rem 0 0; font-size: var(--vc-small); font-style: italic; }

/* The block a circle led to: a ring that fades out on its own (nothing keeps moving), and stays marked while it is the :target. */
.vc-wd__item:target,
.vc-wd__item.is-picked { border-color: var(--vc-black); box-shadow: 0 0 0 3px var(--vc-tan); }
.vc-wd__item.is-picked { animation: vcw-pick 2.5s ease-out 1; }

@keyframes vcw-pick {
	0% { box-shadow: 0 0 0 10px rgba(185, 159, 132, 0.65); }
	100% { box-shadow: 0 0 0 3px var(--vc-tan); }
}

@media print {
	.vc-wd__actions { display: none; }
}
