/* ============================================================================
   Homepage v5: "Tell us what you want" (VOY-2294).

   Pattern: patterns/home-tell.php. Behaviour and canvases: home-tell.js, the
   view script of voyagermark/tell-scene (inc/tell-scene.php), which also loads
   this file wherever the section renders.

   Spec: docs/design/home/README.md, "Tell us what you want". Board reference:
   problems_v6(), PROB_JS, COSMOS_JS and PL_JS in
   docs/design/home/boards/gen_home_v5.py.txt; screen desktop-tell-us-seo.jpg.

   States, set by the script on the core blocks:
     .vy-tell.has-lit    a chip is lit (pointer) or pinned (pressed)
     chip .is-on         its box is the lit one; aria-pressed when pinned
     .vy-tell__box.is-on lit by its chip or by the pointer on the box
     .vy-tell__box.is-dim a chip lights another box
   A pointer on a box lights it without dimming the others.

   Without the script nothing is dimmed, the chips are links that jump to their
   box, and hover or focus lights a box with CSS alone.

   No block carries a colour or font-size preset: presets are !important and
   would pin the rest, hover and lit states. The section has no bg-canvas
   preset for the same reason (custom.css forces color: inherit inside one).
   ============================================================================ */

.wp-block-group.vy-tell {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	box-sizing: border-box;
	margin-block: 0;
	padding: 112px 0 120px;
	border-top: 1px solid var(--wp--preset--color--border-hair);
	background: var(--wp--preset--color--bg-canvas);
	color: var(--wp--preset--color--fg-1);
}

/* The parent theme caps an alignfull flow group's children at the wide size
   with auto margins. The scene is full bleed and the content caps itself. */
.wp-block-group.vy-tell > * {
	margin-block: 0;
}

.wp-block-group.vy-tell > .vy-tell__scene {
	position: absolute;
	inset: 0;
	max-width: none;
	margin: 0;
	pointer-events: none;
}

/* The band behind everything. The scene wrapper has no z-index, so it takes
   its place in the section's stack. */
.vy-tell__band {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	width: 100%;
	height: 100%;
}

/* Each box's planet, a 96x68 canvas the script adds, centred 58px in from the
   box's outer right edge and 50px down (46px and 40px under 782px, below);
   the offsets allow for the 1px border. Inside the box it dims with the box
   and rises with it. */
.vy-tell__pl {
	position: absolute;
	top: 15px;
	right: 9px;
	z-index: 2;
	display: block;
	width: 96px;
	height: 68px;
	pointer-events: none;
}

.wp-block-group.vy-tell > .vy-tell__inner {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	width: min(1280px, 100% - 160px);
	max-width: none;
	margin-inline: auto;
}

/* Core's flow layout spaces siblings with margins; the gaps below do it. */
.vy-tell .vy-tell__inner > *,
.vy-tell .vy-tell__head > *,
.vy-tell .vy-tell__finder > *,
.vy-tell .vy-tell__boxes > *,
.vy-tell .vy-tell__box > * {
	margin: 0;
}

/* --- Heading ------------------------------------------------------------- */

.vy-tell__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	text-align: center;
}

.vy-tell__eyebrow {
	color: var(--wp--preset--color--accent-bright);
	font-family: var(--font-mono);
	font-size: 11px;
	line-height: 1.4;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.vy-tell .vy-tell__title {
	color: var(--wp--preset--color--fg-1);
	font-family: var(--font-display);
	font-size: 50px;
	font-weight: 500;
	line-height: 1.06;
	letter-spacing: -0.035em;
}

.vy-tell__lede {
	max-width: 760px;
	margin-top: 4px !important;
	color: var(--wp--preset--color--fg-2);
	font-family: var(--font-body);
	font-size: 18px;
	line-height: 1.65;
}

/* --- Chips --------------------------------------------------------------- */

.vy-tell .vy-tell__finder {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: 34px;
}

.vy-tell__ask {
	color: var(--wp--preset--color--fg-4);
	font-family: var(--font-mono);
	font-size: 11px;
	line-height: 1.4;
}

.vy-tell .vy-tell__chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The theme's list rules space list items; chips space with the gap. */
.vy-tell .vy-tell__chips > li {
	margin: 0 !important;
	padding: 0;
}

/* The chip: a link without the script, a toggle button with it. */
.vy-tell .vy-tell__chips :is(a, button) {
	--c: var(--wp--preset--color--accent-bright);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 10px 16px;
	border: 1px solid var(--wp--preset--color--border-1);
	border-radius: 999px;
	background: color-mix(in srgb, var(--wp--preset--color--bg-canvas) 60%, transparent);
	color: var(--wp--preset--color--fg-3);
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 1.15;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color 0.25s, background-color 0.25s, color 0.25s;
}

.vy-tell .vy-tell__chips .is-svc-seo { --c: var(--service-seo); }
.vy-tell .vy-tell__chips .is-svc-wordpress { --c: var(--service-wordpress); }
.vy-tell .vy-tell__chips .is-svc-ai { --c: var(--service-ai); }
.vy-tell .vy-tell__chips .is-svc-social { --c: var(--service-social); }
.vy-tell .vy-tell__chips .is-svc-ads { --c: var(--service-ads); }
.vy-tell .vy-tell__chips .is-svc-marketing { --c: var(--service-marketing); }

.vy-tell .vy-tell__chips :is(a, button):is(.is-on, :hover) {
	border-color: var(--c);
	background-color: color-mix(in srgb, var(--c) 10%, transparent);
	color: var(--wp--preset--color--fg-1);
}

.vy-tell .vy-tell__chips button[aria-pressed="true"] {
	border-color: var(--c);
	background-color: color-mix(in srgb, var(--c) 18%, transparent);
	color: var(--wp--preset--color--fg-1);
}

.vy-tell .vy-tell__chips :is(a, button):focus-visible {
	outline: 2px solid var(--c);
	outline-offset: 2px;
}

/* "Show all": quiet until something is lit. */
.vy-tell .vy-tell__chips .vy-tell__all :is(a, button) {
	padding: 10px 6px;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--fg-5);
	font-family: var(--font-mono);
	font-size: 11px;
}

.vy-tell.has-lit .vy-tell__chips .vy-tell__all :is(a, button),
.vy-tell .vy-tell__chips .vy-tell__all :is(a, button):hover {
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--accent-bright);
}

/* --- Boxes --------------------------------------------------------------- */

.vy-tell .vy-tell__boxes {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin-top: 30px;
}

.vy-tell__box {
	--c: var(--wp--preset--color--accent-bright);
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 14px;
	box-sizing: border-box;
	padding: 26px 24px 22px;
	border: 1px solid var(--wp--preset--color--border-1);
	border-radius: 4px;
	background: color-mix(in srgb, var(--wp--preset--color--bg-panel) 88%, transparent);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	cursor: pointer;
	transition: opacity 0.35s, border-color 0.3s, background-color 0.3s, box-shadow 0.3s, translate 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.vy-tell__box.is-svc-seo { --c: var(--service-seo); }
.vy-tell__box.is-svc-wordpress { --c: var(--service-wordpress); }
.vy-tell__box.is-svc-ai { --c: var(--service-ai); }
.vy-tell__box.is-svc-social { --c: var(--service-social); }
.vy-tell__box.is-svc-ads { --c: var(--service-ads); }
.vy-tell__box.is-svc-marketing { --c: var(--service-marketing); }

/* Corner brackets, the page's hover grammar: decoration on the box itself. */
.vy-tell__box::before {
	--k: 10px;
	--w: 1.5px;
	content: "";
	position: absolute;
	inset: -1px;
	pointer-events: none;
	background:
		linear-gradient(var(--c) 0 0) top left / var(--k) var(--w) no-repeat,
		linear-gradient(var(--c) 0 0) top left / var(--w) var(--k) no-repeat,
		linear-gradient(var(--c) 0 0) top right / var(--k) var(--w) no-repeat,
		linear-gradient(var(--c) 0 0) top right / var(--w) var(--k) no-repeat,
		linear-gradient(var(--c) 0 0) bottom left / var(--k) var(--w) no-repeat,
		linear-gradient(var(--c) 0 0) bottom left / var(--w) var(--k) no-repeat,
		linear-gradient(var(--c) 0 0) bottom right / var(--k) var(--w) no-repeat,
		linear-gradient(var(--c) 0 0) bottom right / var(--w) var(--k) no-repeat;
	opacity: 0;
	transition: opacity 0.3s;
}

.vy-tell__box.is-on,
.vy-tell:not(.is-js) .vy-tell__box:is(:hover, :focus-within) {
	border-color: var(--c);
	background-color: color-mix(in srgb, var(--c) 10%, color-mix(in srgb, var(--wp--preset--color--bg-panel) 90%, transparent));
}

.vy-tell__box.is-on::before,
.vy-tell:not(.is-js) .vy-tell__box:is(:hover, :focus-within)::before {
	opacity: 1;
}

/* Hover lifts; a chip's light does not. */
.vy-tell__box:hover {
	translate: 0 -4px;
	box-shadow: 0 26px 50px -30px rgb(0 0 0 / 0.85);
}

.vy-tell__box.is-dim {
	opacity: 0.42;
}

/* The title leaves room for the box's planet at its top right. */
.vy-tell .vy-tell__box-title {
	min-height: 58px;
	display: flex;
	align-items: center;
	padding-right: 76px;
	color: var(--wp--preset--color--fg-1);
	font-family: var(--font-display);
	font-size: 23px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.02em;
	/* Headings balance by default; the board's titles wrap where they fall. */
	text-wrap: wrap;
}

.vy-tell__box-copy {
	color: var(--wp--preset--color--fg-3);
	font-family: var(--font-body);
	font-size: 15px;
	line-height: 1.6;
}

.vy-tell__box-copy strong {
	color: var(--wp--preset--color--fg-1);
	font-weight: 500;
}

.vy-tell .vy-tell__go {
	margin-top: auto !important;
	padding-top: 6px;
}

.vy-tell .vy-tell__go .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: 42px;
	padding: 0 18px;
	border-radius: 4px;
	font-size: 14.5px;
	line-height: 1.2;
}

/* The outline buttons take their service's colour, mixed into the canvas, and
   the arrow in full. The last box's button stays the filled magenta one. */
.vy-tell .vy-tell__go .is-style-voyager-ghost .wp-block-button__link {
	border-color: color-mix(in srgb, var(--c) 55%, var(--wp--preset--color--bg-canvas));
	background: color-mix(in srgb, var(--wp--preset--color--bg-canvas) 50%, transparent);
	color: var(--wp--preset--color--fg-1);
}

.vy-tell .vy-tell__go .is-style-voyager-ghost .wp-block-button__link:is(:hover, :focus-visible) {
	border-color: var(--c);
}

.vy-tell__arr {
	color: var(--c);
}

/* --- Footer line --------------------------------------------------------- */

.vy-tell .vy-tell__foot {
	width: fit-content;
	max-width: 100%;
	box-sizing: border-box;
	margin: 28px auto 0;
	padding: 12px 22px;
	border: 1px solid var(--wp--preset--color--border-hair);
	border-radius: 4px;
	background: color-mix(in srgb, var(--wp--preset--color--bg-canvas) 86%, transparent);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	color: var(--wp--preset--color--fg-3);
	font-family: var(--font-body);
	font-size: 15px;
	line-height: 1.6;
	text-align: center;
}

.vy-tell .vy-tell__foot a {
	color: var(--wp--preset--color--accent-bright);
	text-decoration: none;
}

.vy-tell .vy-tell__foot a.vy-tell__plans {
	color: var(--wp--preset--color--fg-2);
}

.vy-tell .vy-tell__foot a:is(:hover, :focus-visible) {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.vy-tell__sep {
	margin-inline: 4px;
	color: var(--wp--preset--color--fg-5);
}

/* --- The rise, once, as the section comes into view (the script arms it). - */

.vy-tell.is-armed:not(.is-in) .vy-tell__inner > * {
	opacity: 0;
	transform: translateY(18px);
}

.vy-tell.is-in .vy-tell__inner > * {
	transition: opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.vy-tell.is-in .vy-tell__inner > :nth-child(2) { transition-delay: 0.08s; }
.vy-tell.is-in .vy-tell__inner > :nth-child(3) { transition-delay: 0.16s; }
.vy-tell.is-in .vy-tell__inner > :nth-child(4) { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
	.vy-tell__box,
	.vy-tell__box::before,
	.vy-tell .vy-tell__chips :is(a, button) {
		transition: none;
	}

	.vy-tell__box:hover {
		translate: none;
	}
}

/* --- Narrower ------------------------------------------------------------ */

@media (max-width: 1099px) {
	.vy-tell .vy-tell__boxes {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 781px) {
	.wp-block-group.vy-tell {
		padding: 64px 0 72px;
	}

	.wp-block-group.vy-tell > .vy-tell__inner {
		width: calc(100% - 40px);
	}

	.vy-tell__head {
		gap: 12px;
	}

	.vy-tell .vy-tell__title {
		font-size: 32px;
		line-height: 1.08;
	}

	.vy-tell__lede {
		font-size: 16px;
		line-height: 1.6;
	}

	.vy-tell .vy-tell__finder {
		margin-top: 28px;
	}

	.vy-tell .vy-tell__chips {
		display: grid;
		grid-template-columns: 1fr 1fr;
		width: 100%;
	}

	.vy-tell .vy-tell__chips :is(a, button) {
		width: 100%;
		padding: 10px 6px;
		font-size: 13px;
	}

	.vy-tell .vy-tell__chips .vy-tell__all {
		grid-column: span 2;
		text-align: center;
	}

	.vy-tell .vy-tell__chips .vy-tell__all :is(a, button) {
		width: auto;
		padding: 6px;
	}

	.vy-tell .vy-tell__boxes {
		grid-template-columns: 1fr;
		gap: 12px;
		margin-top: 24px;
	}

	/* No backdrop blur on a phone: six blurred boxes over a 2,300px canvas
	   were part of what stopped Android painting them. The panel is 88%
	   opaque, so the blur barely showed. */
	.vy-tell__box,
	.vy-tell .vy-tell__foot {
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.vy-tell__box {
		gap: 12px;
		padding: 20px 18px 18px;
	}

	.vy-tell__pl {
		top: 5px;
		right: -3px;
	}

	.vy-tell .vy-tell__box-title {
		min-height: 48px;
		padding-right: 64px;
		font-size: 20px;
	}

	.vy-tell__box-copy {
		font-size: 14.5px;
	}

	.vy-tell .vy-tell__foot {
		padding: 12px 16px;
		font-size: 14px;
	}
}

/* --- Editor -------------------------------------------------------------- */

.vy-tell-scene-editor {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	margin: 0 auto 24px !important;
	padding: 10px 16px;
	width: fit-content;
	border: 1px dashed var(--wp--preset--color--border-1);
	color: var(--wp--preset--color--fg-4);
	font-family: var(--font-mono);
	font-size: 12px;
	text-align: center;
}
