/*
**
**
**
**
**
** His Stage
** =================================
**
** The layer he takes the screen on (.TL-Mascot-Stage): for his entrance when the assistant is
** turned on (TL.MascotDebut, scripts/nav-mascot.debut.js, below) and for his introduction the
** first time search is opened (TL.MascotIntro, styles/nav-mascot.intro.css). It covers the
** whole shell just under him (he's over everything while he's away from home, see
** #TL-Mascot-Float in navigation.css): a soft veil over the page, a spot that he drops onto,
** and a glow that swells behind him as he lands.
**
** He isn't in here. A spot only marks where he lands and how big he is there, so nothing may
** move or scale it; the glow and the words do their moving on their own layers.
**
** Type: words read in the primary font at a regular weight. Only a title takes the theme font.
*/

.TL-Mascot-Stage {
	position: fixed;
	inset: 0;
	z-index: 94;
	font-family: var(--Primary-Font);
	font-weight: 400;
	-webkit-tap-highlight-color: transparent;
	transition: opacity 340ms ease;
}
/* Put away, a stage is gone altogether. Each stage sets its own display by ID, which would win
   over a plain [hidden] rule and leave an unseen layer over the whole shell taking every click */
#TL-Mascot-Debut[hidden],
#TL-Mascot-Intro[hidden] {
	display: none;
}
.TL-Mascot-Stage[data-state="leaving"] {
	opacity: 0;
	pointer-events: none;
}

/*
** Veil
** =================================
**
** The page behind goes soft and pale, the way it does behind search, only more so.
*/

.TL-Mascot-Stage > .veil {
	position: absolute;
	inset: 0;
	background-color: rgba(246, 245, 252, 0.8);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	backdrop-filter: blur(18px) saturate(140%);
	opacity: 0;
	transition: opacity 320ms ease;
}
.TL-Mascot-Stage:not([data-state="closed"]) > .veil {
	opacity: 1;
}

/*
** Spot and Glow
** =================================
**
** Where he lands. The glow is his own colors, and comes up from under him with the plop
** (data-glow on the stage).
*/

.TL-Mascot-Stage .spot {
	position: relative;
	flex: none;
	width: clamp(132px, 24vmin, 208px);
	aspect-ratio: 1;
}
.TL-Mascot-Stage .spot > .glow {
	position: absolute;
	inset: -75%;
	border-radius: 50%;
	background-image:
		radial-gradient(closest-side at 42% 44%, rgba(169, 147, 255, 0.42), rgba(169, 147, 255, 0) 100%),
		radial-gradient(closest-side at 60% 58%, rgba(255, 143, 208, 0.34), rgba(255, 143, 208, 0) 100%);
	opacity: 0;
	transform: scale(0.5);
	pointer-events: none;
	transition:
		opacity 420ms ease,
		transform 720ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.TL-Mascot-Stage[data-glow] .spot > .glow {
	opacity: 1;
	transform: scale(1);
}

/*
**
**
**
**
**
** His Entrance
** =================================
**
** The moment the assistant is turned on (TL.MascotDebut): he lands in the middle, and his
** hello comes up underneath. data-state: "closed", "open" (the veil is up, he's on his way
** down), "hello" (he's landed), "leaving" (all of it fades as he flies home).
*/

#TL-Mascot-Debut {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 30px;
	padding: 24px 24px calc(10dvh + env(safe-area-inset-bottom));
	cursor: pointer;
}

/*
** Words
** =================================
**
** His hello pops up under him once he's down, and the line under it follows a beat later.
*/

#TL-Mascot-Debut > .words {
	position: relative;
	max-width: 420px;
	text-align: center;
}
#TL-Mascot-Debut > .words > .hello,
#TL-Mascot-Debut > .words > .line {
	margin: 0;
	opacity: 0;
	transform: translateY(16px) scale(0.92);
	transition:
		opacity 260ms ease,
		transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
#TL-Mascot-Debut > .words > .hello {
	font-family: var(--Theme-Font);
	font-size: 38px;
	font-weight: 500;
	line-height: 1.1;
	letter-spacing: -0.035em;
	color: #1d1d24;
}
#TL-Mascot-Debut > .words > .line {
	margin-top: 10px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: -0.01em;
	color: rgba(29, 29, 36, 0.62);
	transition-delay: 160ms;
}
#TL-Mascot-Debut[data-state="hello"] > .words > .hello,
#TL-Mascot-Debut[data-state="hello"] > .words > .line,
#TL-Mascot-Debut[data-state="leaving"] > .words > .hello,
#TL-Mascot-Debut[data-state="leaving"] > .words > .line {
	opacity: 1;
	transform: none;
}

/* Only the line that's true here: where his home is, or where to find him without one */
#TL-Mascot-Debut[data-home="true"] > .words > .line[data-debut-line="away"],
#TL-Mascot-Debut[data-home="false"] > .words > .line[data-debut-line="home"] {
	display: none;
}

/*
** Dark
** =================================
*/

body[data-theme="dark"] .TL-Mascot-Stage > .veil,
body[data-home="true"][data-home-theme="dark"] .TL-Mascot-Stage > .veil {
	background-color: rgba(14, 14, 20, 0.72);
}
body[data-theme="dark"] #TL-Mascot-Debut > .words > .hello,
body[data-home="true"][data-home-theme="dark"] #TL-Mascot-Debut > .words > .hello {
	color: #f5f5f8;
}
body[data-theme="dark"] #TL-Mascot-Debut > .words > .line,
body[data-home="true"][data-home-theme="dark"] #TL-Mascot-Debut > .words > .line {
	color: rgba(245, 245, 248, 0.66);
}

/*
** Small Screens and Reduced Motion
** =================================
*/

@media (max-width: 640px) {
	#TL-Mascot-Debut {
		gap: 24px;
	}
	#TL-Mascot-Debut > .words > .hello {
		font-size: 30px;
	}
}

/* The stage still comes and goes, it just fades instead of popping */
@media (prefers-reduced-motion: reduce) {
	.TL-Mascot-Stage .spot > .glow,
	#TL-Mascot-Debut > .words > .hello,
	#TL-Mascot-Debut > .words > .line {
		transform: none;
		transition: opacity 200ms ease;
	}
}
