/*
 * seal/prompt-close — the third stage: founders' photo, closing line, shell
 * chat with a real input. Same stage, tokens and type as the two blocks
 * before it. Without .is-live (no JS, reduced motion) everything is shown.
 */

main:has(.seal-prompt-close) {
	overflow: clip;
}

.seal-prompt-close {
	--pc-ink: #0f1a20;
	--pc-line: rgba(255, 255, 255, 0.22);
	--pc-muted: rgba(255, 255, 255, 0.62);
	--pc-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--pc-pad: clamp(1.25rem, 3vw, 2.5rem);
	--z: 1;
	position: relative;
	background: #fff;
	margin: 0 !important;
	max-width: none !important;
}

.seal-prompt-close.is-live {
	height: 260vh;
}

.pc-stage {
	height: 100vh;
	padding: 1rem;
}

.is-live .pc-stage {
	position: sticky;
	top: 0;
}

.pc-teaser {
	position: relative;
	overflow: hidden;
	height: 100%;
	min-height: 560px;
	background: var(--pc-ink);
	border-radius: var(--radius);
	color: #fff;
}

.pc-teaser::before {
	content: "";
	position: absolute;
	inset: 0;
	border: 1px solid var(--pc-line);
	border-radius: var(--radius);
	pointer-events: none;
	z-index: 5;
}

/* ---------- the founders ---------- */
/* the founders stand on the right and fade into the dark stage on the left,
   graded towards the petrol of the stage, so the chat never covers a face */
.pc-photo {
	position: absolute;
	inset: 0 0 0 42%;
	margin: 0;
	/* the zoom must not push the photo past its own left edge */
	overflow: hidden;
}

.pc-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 32% 25%;
	display: block;
	transform: scale(var(--z));
	transform-origin: 45% 30%;
	will-change: transform;
	filter: saturate(0.55) brightness(0.72) contrast(1.08);
}

/* the photo darkens with every answer, so the growing chat stays legible */
.pc-photo::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: #06262f;
	opacity: var(--veil, 0);
	transition: opacity 0.6s var(--pc-ease);
}

.pc-photo::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(90deg, #0f1a20 0%, rgba(15, 26, 32, 0.75) 8%, rgba(15, 26, 32, 0.3) 17%, rgba(15, 26, 32, 0) 26%),
		linear-gradient(180deg, rgba(6, 38, 47, 0) 60%, rgba(6, 38, 47, 0.85) 100%),
		rgba(6, 38, 47, 0.28);
}

/* ---------- background: the night port instead of the founders ---------- */
.pc-bg-port .pc-photo {
	inset: 0;
}

.pc-photo video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 70% 50%;
	display: block;
	transform: scale(var(--z));
	transform-origin: 60% 50%;
}

.pc-bg-port .pc-photo::after {
	background:
		linear-gradient(90deg, rgba(15, 26, 32, 0.94) 0%, rgba(15, 26, 32, 0.8) 36%, rgba(15, 26, 32, 0.2) 70%),
		rgba(6, 38, 47, 0.25);
}

.pc-bg-port .pc-content {
	right: 45%;
}

.pc-bg-port .pc-title {
	font-size: var(--wp--preset--font-size--display);
}

/* ---------- background: a full-bleed image under the opener's gradient ---------- */
.pc-bg-image .pc-photo {
	inset: 0;
}

.pc-bg-image .pc-photo img {
	object-position: 50% 50%;
	transform-origin: 60% 50%;
	filter: none;
}

/* exactly the left gradient of seal/aiolos-scroll, nothing on top */
.pc-bg-image .pc-photo::after {
	background: linear-gradient(90deg, rgba(15, 26, 32, 0.94) 0%, rgba(15, 26, 32, 0.85) 36%, rgba(15, 26, 32, 0) 60%);
}

.pc-bg-image .pc-photo::before {
	display: none;
}

/* ---------- background: a clip in the right half, scrubbed by the scroll ---------- */
.pc-bg-clip .pc-photo::after {
	background: linear-gradient(90deg, #0f1a20 0%, rgba(15, 26, 32, 0.75) 8%, rgba(15, 26, 32, 0.3) 17%, rgba(15, 26, 32, 0) 26%);
}

.pc-bg-clip .pc-photo::before {
	display: none;
}

.pc-bg-clip .pc-photo video {
	object-position: 50% 50%;
	transform: none;
}

/* full bleed: a wide clip that keeps its left side calm, under exactly the
   left gradient of seal/aiolos-scroll */
.pc-clip-full .pc-photo {
	inset: 0;
}

.seal-prompt-close.pc-clip-full .pc-photo::after {
	background: linear-gradient(90deg, rgba(15, 26, 32, 0.94) 0%, rgba(15, 26, 32, 0.85) 36%, rgba(15, 26, 32, 0) 60%);
}

.pc-clip-full .pc-photo video {
	object-position: 70% 50%;
}


/* ---------- closing line and chat ---------- */
/* anchored at the bottom: every answer pushes the conversation up, and
   what no longer fits fades out at the top, like a chat */
.pc-content {
	position: absolute;
	z-index: 2;
	left: var(--pc-pad);
	right: 59%;
	bottom: var(--pc-pad);
	max-width: 62rem;
	/* full height, so the fade only touches lines that run out at the top */
	height: calc(100% - clamp(88px, 13vh, 150px) - var(--pc-pad));
	pointer-events: none;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(180deg, transparent 0, #000 3rem);
	mask-image: linear-gradient(180deg, transparent 0, #000 3rem);
}

.pc-title {
	/* sized to the text column, so "Autocomplete yours with us." fits one line */
	font-size: clamp(1.75rem, 2.9vw, 3.5rem);
	line-height: 1.1;
	letter-spacing: -0.02em;
	font-weight: 500;
	margin: 0;
}

.pc-l1 {
	color: var(--pc-muted);
}

.pc-l2 {
	color: #fff;
	white-space: nowrap;
}

.pc-chat {
	margin-top: clamp(1.25rem, 4vh, 2.5rem);
	max-width: 44rem;
	font-family: var(--wp--preset--font-family--mono);
	font-size: max(16px, clamp(0.9rem, 1.1vw, 1.05rem));
	line-height: 1.55;
}

.pc-line {
	margin: 0 0 0.5em;
}

.pc-ps {
	color: var(--pc-muted);
	margin-right: 0.6em;
	white-space: nowrap;
}

.pc-ask {
	color: #fff;
}

/* the opening question in brand orange, like "autocomplete" in the opener
   (a deliberate exception to the brand rule: orange text on the dark stage) */
.pc-hot {
	color: var(--brand-primary);
}

.pc-form {
	pointer-events: auto;
	display: flex;
	align-items: baseline;
}

.pc-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	font: inherit;
	color: #fff;
	caret-color: #fff;
}

.pc-input::placeholder {
	color: var(--pc-muted);
	opacity: 1;
}

/* the answer line stays a shell line, set apart only by what says "type
   here": an orange line under it, an example in the placeholder, a blinking
   block cursor while idle and an orange send key */
.pc-form {
	position: relative;
	align-items: center;
	gap: 0.6em;
	padding: 0 0 0.45em;
	border-bottom: 1px solid var(--brand-primary);
	cursor: text;
}

.pc-form:hover,
.pc-form:focus-within {
	border-bottom-width: 2px;
	padding-bottom: calc(0.45em - 1px);
}

.pc-form .pc-ps {
	margin-right: 0;
}

.pc-input {
	flex: 1 1 auto;
}

.pc-input::placeholder {
	color: rgba(255, 255, 255, 0.5);
}

/* the terminal's block cursor right after the prompt, until the field has focus or text */
.pc-form::before {
	content: "";
	order: 1;
	width: 0.6em;
	height: 1.1em;
	margin-right: -0.3em;
	background: var(--brand-primary);
	animation: pc-blink 1.1s steps(1) infinite;
}

.pc-form > .pc-ps {
	order: 0;
}

.pc-input {
	order: 2;
}

/* the Enter key as in "autocomplete ⏎" of the opener: an orange sign, no button */
.pc-send {
	order: 3;
	flex: 0 0 auto;
	padding: 0 0.2em;
	border: 0;
	background: none;
	color: var(--brand-primary);
	font: inherit;
	font-size: 1.25em;
	line-height: 1;
	cursor: pointer;
}

.pc-send:hover {
	color: color-mix(in srgb, var(--brand-primary) 75%, white);
}

.pc-form:focus-within::before,
.pc-form:has(.pc-input:not(:placeholder-shown))::before {
	display: none;
}

@keyframes pc-blink {
	50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.pc-form::before {
		animation: none;
	}
}


.pc-out {
	color: #fff;
}

.pc-out a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* the field for bots, out of sight */
.pc-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.pc-done .pc-form {
	display: none;
}

/* lines written by the chat arrive softly */
.pc-line.pc-new {
	animation: pc-arrive 0.4s var(--pc-ease) both;
}

@keyframes pc-arrive {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* ---------- arriving with the scroll (view.js sets .is-on) ---------- */
.is-live .pc-l1,
.is-live .pc-uses,
.is-live .pc-l2,
.is-live .pc-line {
	opacity: 0;
	transform: translateY(0.6em);
	transition: opacity 0.5s var(--pc-ease), transform 0.6s var(--pc-ease);
}

.is-live .pc-l1,
.is-live .pc-l2 {
	display: inline-block;
}

.is-live .pc-uses.is-on,
.is-live .pc-l1.is-on,
.is-live .pc-l2.is-on,
.is-live .pc-line.is-on {
	opacity: 1;
	transform: none;
}

/* ---------- small screens: the double portrait in the top half ---------- */
@media (max-width: 767.98px) {
	/* the same size as the other two shells on phones */
	.pc-chat,
	.seal-prompt-close .pc-uses {
		font-size: 14px;
	}

	/* the answer field stays at 16px, or iPhones zoom in when it gets focus */
	.pc-input {
		font-size: 16px;
	}

	.pc-photo {
		inset: 0 0 50% 0;
	}

	/* the clip ends a quarter above the card's bottom, so the robot stands
	   above the text and stays in view while the keyboard is open */
	.pc-clip-full .pc-photo {
		inset: 0 0 25% 0;
	}

	/* the road's centre line in the middle, a robot on either side */
	.pc-clip-full .pc-photo video {
		object-position: 87% 50%;
	}

	/* the prompt keeps "~$" and the first question drops "for you", so every
	   line fits the width of a phone */
	.seal-prompt-close .pc-host,
	.seal-prompt-close .pc-wide {
		display: none;
	}

	/* the shade starts below the robots, so both stay bright */
	.seal-prompt-close.pc-clip-full .pc-photo::after {
		background: linear-gradient(180deg, rgba(15, 26, 32, 0) 60%, rgba(15, 26, 32, 0.85) 85%, #0f1a20 100%);
	}

	/* the field needs its width for the answer, the prompt label goes */
	.pc-form > .pc-ps {
		display: none;
	}

	/* the clip sits in the top half and fades into the stage below it */
	.seal-prompt-close.pc-bg-clip .pc-photo::after {
		background: linear-gradient(180deg, rgba(15, 26, 32, 0) 60%, #0f1a20 100%);
	}

	/* the image mode keeps the full bleed and, like the opener on phones,
	   darkens from the bottom where the text sits */
	.pc-bg-image .pc-photo {
		inset: 0;
	}

	.seal-prompt-close.pc-bg-image .pc-photo::after {
		background: linear-gradient(180deg, rgba(15, 26, 32, 0) 25%, rgba(15, 26, 32, 0.9) 55%, rgba(15, 26, 32, 0.96) 100%);
	}

	.pc-content {
		right: var(--pc-pad);
	}

	.pc-photo img {
		object-position: 45% 20%;
		transform-origin: 45% 30%;
	}

	.pc-photo::after {
		background: linear-gradient(180deg, rgba(15, 26, 32, 0) 55%, #0f1a20 100%);
	}

	.pc-title {
		font-size: var(--wp--preset--font-size--xl);
	}
}

/* examples of heavy or out-of-reach work, as shell output */
.pc-uses {
	list-style: none;
	margin: clamp(0.75rem, 2vh, 1.25rem) 0;
	padding: 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: max(16px, clamp(0.9rem, 1.1vw, 1.05rem));
	line-height: 1.55;
	color: #fff;
}

.seal-prompt-close .pc-title-ask {
	margin: 0;
}

/* the theme colours every li dark grey (#41505f) */
.seal-prompt-close .pc-uses li {
	color: #fff;
	line-height: 1.55;
}
