/* ergo.functorial.inc: the teaser. Shared look comes from style.css (copied from functorial.inc). */

:root {
	--ergo: #2f6bff;      /* the ∴, on the light page */
	--ergo-glow: #2f6bff;
	--ai: #8b6bff;
}
@media (prefers-color-scheme: dark) {
	:root { --ergo: #8ab4f8; --ergo-glow: #4a7bff; --ai: #b39bff; }
}

/* The banner bleeds past the edges; never let it scroll the page sideways. */
html, .ergo { overflow-x: clip; }

.teaser {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 3.5rem 0 4rem;
}

.mark {
	margin: 0;
	font-weight: 400;
	font-size: clamp(4rem, 14vw, 8.5rem);
	line-height: 1;
	letter-spacing: -0.01em;
}
.mark span { color: var(--ergo); margin-left: 0.12em; }

.teaser .tagline {
	margin: 0.6rem 0 0;
	font-size: clamp(1.3rem, 3vw, 1.8rem);
	font-style: italic;
	color: var(--muted);
}

/* The window, tilted toward you, lit from behind, with the banner across it. */
.stage {
	--rx: 8deg;
	--ry: -6deg;
	position: relative;
	width: min(68rem, 100%);
	margin: 3.25rem 0 3rem;
	perspective: 1800px;
	container-type: inline-size;
}

.glow {
	position: absolute;
	inset: 8% 6% 0;
	background:
		radial-gradient(50% 60% at 30% 50%, color-mix(in srgb, var(--ergo-glow) 55%, transparent), transparent 70%),
		radial-gradient(45% 55% at 75% 55%, color-mix(in srgb, var(--ai) 45%, transparent), transparent 70%);
	filter: blur(48px);
	opacity: 0.7;
	animation: breathe 7s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.4; transform: scale(0.97); } }

.shot {
	position: relative;
	margin: 0;
	border-radius: 12px;
	overflow: hidden;
	transform: rotateX(var(--rx)) rotateY(var(--ry));
	transform-style: preserve-3d;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
	box-shadow:
		0 2px 0 rgba(255, 255, 255, 0.06) inset,
		0 30px 60px -20px rgba(11, 16, 32, 0.55),
		0 60px 120px -40px rgba(11, 16, 32, 0.6);
}
.shot img {
	display: block;
	width: 100%;
	height: auto;
}
.sheen {
	position: absolute;
	inset: 0;
	background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.12) 48%, transparent 60%);
	background-size: 250% 100%;
	animation: sheen 6s ease-in-out infinite;
	pointer-events: none;
}
@keyframes sheen { 0% { background-position: 130% 0; } 60%, 100% { background-position: -30% 0; } }

/* The banner: brushed gold laid across the three boxes of the welcome screen.
   Sizes are in cqw (the stage's width), so it covers the same boxes at every width.
   In shot.png the boxes run from 47% to 63% of the height; their middle is 55%. */
.ribbon {
	position: absolute;
	left: -5%;
	right: -5%;
	top: 55%;
	height: 15cqw;
	transform: translateY(-50%) rotate(-3deg);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3.2cqw;
	overflow: hidden;
	z-index: 2;
	color: #0b1020;
	background:
		/* fine brushed grain */
		repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
		linear-gradient(180deg, #fff2c2 0%, #f6d27a 14%, #e8b04b 40%, #c88f33 62%, #a8741f 74%, #e2ac4c 88%, #fbe29c 100%);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.85),
		inset 0 -1px 0 rgba(80, 48, 0, 0.5),
		0 0 0 1.5px #0b1020,
		0 24px 50px -14px rgba(11, 16, 32, 0.7),
		0 0 70px -10px rgba(232, 176, 75, 0.55);
}
/* Two engraved rules just inside the edges. */
.ribbon::before {
	content: "";
	position: absolute;
	inset: 9% 0;
	border-block: 1px solid rgba(11, 16, 32, 0.45);
	box-shadow: 0 1px 0 rgba(255, 245, 210, 0.5), inset 0 1px 0 rgba(255, 245, 210, 0.5);
	pointer-events: none;
}
/* A band of light that crosses the metal now and then. */
.ribbon::after {
	content: "";
	position: absolute;
	top: -50%;
	bottom: -50%;
	width: 18%;
	left: -30%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
	transform: skewX(-24deg);
	mix-blend-mode: overlay;
	filter: blur(2px);
	animation: glint 5.5s cubic-bezier(0.45, 0, 0.2, 1) 1s infinite;
	pointer-events: none;
}
@keyframes glint { 0% { left: -30%; } 45%, 100% { left: 130%; } }

.ribbon .words {
	display: flex;
	align-items: center;
	gap: 0.9em;
	font-size: 5.2cqw;
	line-height: 1;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	white-space: nowrap;
	-webkit-text-stroke: 0.04em currentColor;
	/* struck into the metal: light below, shade above */
	text-shadow: 0 0.035em 0 rgba(255, 246, 214, 0.75), 0 -0.02em 0 rgba(90, 55, 0, 0.35);
}
.ribbon .words b { font-weight: 400; margin-right: -0.32em; }
.ribbon .therefore {
	font-size: 0.7em;
	letter-spacing: 0;
	color: #6b4510;
	-webkit-text-stroke: 0;
}

/* Sparks that catch the light at the edges. */
.spark {
	position: absolute;
	width: 2.2cqw;
	aspect-ratio: 1;
	background: radial-gradient(circle, #fff 0 18%, transparent 19%), #fff;
	clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
	filter: drop-shadow(0 0 6px #fff6d0);
	opacity: 0;
	z-index: 3;
	animation: twinkle 3.6s ease-in-out infinite;
	pointer-events: none;
}
.spark.s1 { left: 4%; top: calc(55% - 9cqw); animation-delay: 0.4s; }
.spark.s2 { right: 7%; top: calc(55% + 3.5cqw); animation-delay: 1.7s; width: 1.6cqw; }
.spark.s3 { left: 46%; top: calc(55% + 6cqw); animation-delay: 2.8s; width: 1.3cqw; }
@keyframes twinkle {
	0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
	12% { opacity: 1; transform: scale(1) rotate(45deg); }
	26% { opacity: 0; transform: scale(0.4) rotate(90deg); }
}

/* The waitlist button rides on the banner, tilted with it. */
.join {
	position: relative;
	z-index: 1;
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.6em 1.25em;
	border-radius: 999px;
	background: linear-gradient(180deg, #1b2236, #0b1020);
	color: #f8dc94;
	font-size: clamp(0.9rem, 1.9cqw, 1.3rem);
	letter-spacing: 0.03em;
	text-decoration: none;
	white-space: nowrap;
	-webkit-text-stroke: 0.2px currentColor;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 0 rgba(255, 246, 214, 0.7), 0 6px 16px -6px rgba(11, 16, 32, 0.8);
	transition: transform 150ms ease, box-shadow 150ms ease, color 150ms ease;
}
.join:hover, .join:focus-visible {
	color: #fff3c4;
	transform: translateY(-1px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 rgba(255, 246, 214, 0.7), 0 10px 22px -6px rgba(11, 16, 32, 0.9), 0 0 0 3px rgba(11, 16, 32, 0.25);
}
.join:focus-visible { outline: 2px solid #0b1020; outline-offset: 3px; }
.join span { transition: transform 150ms ease; }
.join:hover span { transform: translateX(3px); }

/* On a narrow stage the words and the button stack, and the banner grows to hold both. */
@container (max-width: 620px) {
	.ribbon { flex-direction: column; gap: 2.2cqw; height: auto; min-height: 15cqw; padding: 4cqw 0; }
	.ribbon .words { font-size: 6.4cqw; }
	.join { font-size: 0.95rem; }
}

/* The waitlist form. A centred card on wide screens, a sheet from the bottom on phones. */
.waitlist {
	width: min(30rem, calc(100vw - 2rem));
	padding: 0;
	border: 1px solid var(--rule);
	border-radius: 16px;
	background: var(--bg);
	color: var(--fg);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}
.waitlist::backdrop { background: rgba(11, 16, 32, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.waitlist[open] { animation: rise 220ms cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.wl-form, .wl-done { position: relative; padding: 1.75rem 1.75rem 1.5rem; }
.waitlist h2 { margin: 0 0 0.35rem; font-weight: 400; font-size: 1.8rem; line-height: 1.15; }
.wl-lede, .wl-done p { margin: 0 0 1.25rem; color: var(--muted); font-style: italic; }
.wl-form label { display: block; margin: 0 0 0.9rem; font-size: 1.05rem; }
.wl-form label small { color: var(--muted); font-style: italic; font-size: 0.9rem; margin-left: 0.25rem; }
.wl-form input {
	display: block;
	width: 100%;
	margin-top: 0.3rem;
	padding: 0.65rem 0.8rem;
	border: 1.5px solid color-mix(in srgb, var(--muted) 45%, transparent);
	border-radius: 10px;
	background: color-mix(in srgb, var(--bg) 70%, #fff 30%);
	color: var(--fg);
	font: inherit;
	font-size: 1.05rem;
	-webkit-text-stroke: 0;
}
@media (prefers-color-scheme: dark) { .wl-form input { background: color-mix(in srgb, var(--bg) 85%, #fff 15%); } }
.wl-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.wl-trap { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.wl-error { min-height: 1.4em; margin: 0 0 0.6rem; color: #c43b45; font-size: 0.98rem; }
@media (prefers-color-scheme: dark) { .wl-error { color: #ef6b73; } }
.wl-error:empty { min-height: 0; margin: 0; }
.wl-submit {
	display: block;
	width: 100%;
	margin-top: 0.4rem;
	padding: 0.75rem 1rem;
	border: 0;
	border-radius: 999px;
	color: #0b1020;
	background: linear-gradient(180deg, #fff2c2 0%, #f6d27a 20%, #e8b04b 55%, #c88f33 85%, #e2ac4c 100%);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 0 0 1.5px #0b1020;
	font: inherit;
	font-size: 1.15rem;
	letter-spacing: 0.06em;
	cursor: pointer;
}
.wl-submit:hover:not(:disabled) { filter: brightness(1.05); }
.wl-submit:disabled { opacity: 0.6; cursor: default; }
.wl-close {
	position: absolute;
	top: 0.6rem;
	right: 0.7rem;
	width: 2.4rem;
	height: 2.4rem;
	border: 0;
	border-radius: 999px;
	background: none;
	color: var(--muted);
	font-size: 1.7rem;
	line-height: 1;
	cursor: pointer;
}
.wl-close:hover { color: var(--fg); background: color-mix(in srgb, var(--muted) 15%, transparent); }
.wl-done { text-align: center; }
.wl-mark { margin: 0 !important; font-size: 3rem; line-height: 1; color: var(--ergo) !important; font-style: normal !important; }
.wl-done b { color: var(--fg); font-style: normal; }

@media (max-width: 640px) {
	.waitlist { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; }
	.waitlist[open] { animation-name: sheet; }
	@keyframes sheet { from { transform: translateY(100%); } }
}

.hint {
	margin: 0 0 1.75rem;
	font-size: 1.25rem;
	color: var(--muted);
	max-width: 40ch;
	text-wrap: balance;
}

@media (max-width: 640px) {
	.teaser { padding-top: 2.5rem; }
	.stage { --rx: 4deg; --ry: -3deg; margin: 2.25rem 0 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
	.glow, .sheen, .ribbon::after { animation: none; }
	.spark { display: none; }
	.waitlist[open] { animation: none; }
	.shot { transition: none; }
}
