/* ==========================================================================
   The Sleeping Engine app page (templates/page-the-sleeping-engine.html).
   Enqueued only on that page, so nothing here reaches any other route.
   Every selector is scoped to main.tse, or to body:has(main.tse) for the
   header/footer chrome on this page alone.
   ========================================================================== */

.tse {
	--tse-bg: #07110f;
	--tse-stone: #0d1a17;
	--tse-stone-2: #13241f;
	--tse-line: rgba(216, 178, 106, 0.16);
	--tse-ink: #ece4d2;
	--tse-muted: #a3b2ab;
	--tse-gold: #e2bd73;
	--tse-orange: #f39a2b;
	--tse-cyan: #3cc8ff;
	--tse-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--tse-pad: var(--wp--style--root--padding-left, 22px);
	--tse-band-y: 112px;

	background: var(--tse-bg);
	color: var(--tse-ink);
	font-size: 17px;
	line-height: 1.65;
	overflow: clip;
}

/* The global page-top offset and the template-part block gap don't apply. */
main.wp-block-group.tse {
	padding-top: 0;
	padding-bottom: 0;
	margin-block-start: 0;
}
body:has(main.tse) .wp-site-blocks > footer { margin-block-start: 0; }

.tse :where(h1, h2, h3, h4) { color: var(--tse-ink); }
.tse :where(p, li) { color: var(--tse-muted); }
.tse a { color: var(--tse-orange); text-decoration: underline; text-decoration-color: rgba(243, 154, 43, 0.4); text-underline-offset: 3px; }
.tse a:hover { color: #ffb75a; text-decoration-color: currentColor; }
.tse a:focus-visible,
.tse .wp-block-button__link:focus-visible { outline: 2px solid var(--tse-cyan); outline-offset: 3px; border-radius: 4px; }
.tse strong { color: var(--tse-ink); }

/* The hero image is a backdrop, not a photo: no lightbox, no zoom cursor. */
.tse img { pointer-events: none; }

/* ---------- Header on this page: dark, to sit on the stone ---------- */
body:has(main.tse) .teemusk-header.has-white-background-color {
	background-color: #07110f !important;
	border-bottom-color: rgba(216, 178, 106, 0.14) !important;
}
body:has(main.tse) .teemusk-header .wp-block-site-title a { color: #ece4d2; }
body:has(main.tse) .teemusk-header .teemusk-tagline { color: #a3b2ab; }
body:has(main.tse) .teemusk-header .wp-block-navigation__responsive-container:not(.is-menu-open) a,
body:has(main.tse) .teemusk-header .wp-block-navigation__responsive-container-open { color: #ece4d2; }

/* ---------- Shared bits ---------- */
.tse-eyebrow {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 12px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--tse-gold) !important;
	margin: 0;
}
.tse h2 {
	font-family: var(--tse-serif);
	font-weight: 600;
	font-size: clamp(32px, 4.4vw, 50px);
	line-height: 1.08;
	letter-spacing: -0.005em;
	margin-top: 16px;
}
.tse h3 {
	font-size: 19px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.3;
}

.tse-band {
	position: relative;
	padding: var(--tse-band-y) var(--tse-pad);
}
.tse-band + .tse-band { border-top: 1px solid var(--tse-line); }

/* A faint carved grid, like channels cut into the floor of a chamber. */
.tse-band::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(216, 178, 106, 0.035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(216, 178, 106, 0.035) 1px, transparent 1px);
	background-size: 64px 64px;
	mask-image: radial-gradient(ellipse at 50% 40%, #000 0%, transparent 75%);
	-webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 0%, transparent 75%);
}
.tse-band > * { position: relative; }

/* ---------- Hero ---------- */
.tse .tse-hero {
	min-height: min(92vh, 880px);
	padding: 112px var(--tse-pad) 136px;
	align-items: center;
	text-align: center;
	background: var(--tse-bg);
}
/* The glows are CSS over whatever image is the hero, so a new hero still
   gets the orange and cyan light without any edit here. */
.tse .tse-hero .wp-block-cover__background {
	opacity: 1 !important;
	background:
		radial-gradient(ellipse 55% 45% at 12% 88%, rgba(243, 154, 43, 0.28), transparent 70%),
		radial-gradient(ellipse 55% 45% at 88% 88%, rgba(60, 200, 255, 0.22), transparent 70%),
		radial-gradient(ellipse 60% 50% at 50% 42%, rgba(7, 17, 15, 0.1), rgba(7, 17, 15, 0.7) 100%),
		linear-gradient(to bottom, rgba(7, 17, 15, 0.25) 0%, rgba(7, 17, 15, 0.2) 55%, var(--tse-bg) 100%) !important;
}
.tse .tse-hero .wp-block-cover__image-background { object-position: 50% 40%; }
.tse .tse-hero .wp-block-cover__inner-container { width: 100%; max-width: 1000px; margin-inline: auto; }

.tse-hero .tse-eyebrow { margin-bottom: 24px; }
.tse h1.tse-title {
	font-family: var(--tse-serif);
	font-weight: 600;
	font-size: clamp(32px, 7vw, 92px) !important;
	line-height: 0.98 !important;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	margin: 0;
	color: var(--tse-gold);
	background: linear-gradient(180deg, #fbe7b8 0%, #e2bd73 45%, #b07a32 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	filter: drop-shadow(0 0 28px rgba(243, 154, 43, 0.35));
}
.tse .tse-subtitle {
	font-family: var(--tse-serif);
	font-style: italic;
	font-size: clamp(20px, 2.4vw, 28px);
	color: var(--tse-ink);
	margin: 24px 0 0;
}

/* Glyph row: square, triangle, circle, star. */
.tse-glyphs {
	display: flex;
	justify-content: center;
	gap: 24px;
	margin: 40px 0 0;
}
.tse-glyph {
	width: 48px;
	height: 48px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linejoin: round;
	color: var(--tse-orange);
	filter: drop-shadow(0 0 6px currentColor);
}
.tse-glyph:nth-child(even) { color: var(--tse-cyan); }

.tse .tse-badge {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	margin: 40px auto 0;
	padding: 10px 24px 12px;
	border: 1px solid rgba(236, 228, 210, 0.45);
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.55);
	color: var(--tse-ink);
	line-height: 1.1;
	text-align: left;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}
.tse-badge__top { font-size: 12px; letter-spacing: 0.04em; color: var(--tse-muted); }
.tse-badge__main { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; color: #fff; }
.tse .tse-price { font-size: 15px; margin: 16px 0 0; }
.tse .tse-jump {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	margin: 32px 0 0;
}
.tse .tse-jump a { color: var(--tse-ink); text-decoration: none; padding: 8px 4px; }
.tse .tse-jump a:hover { color: var(--tse-cyan); }

/* A signal running along the foot of the hero: orange in, cyan out. */
.tse-signal {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 48px;
	height: 2px;
	background: linear-gradient(90deg, transparent, rgba(243, 154, 43, 0.5) 20%, rgba(60, 200, 255, 0.5) 80%, transparent);
	overflow: hidden;
}
.tse-signal::after {
	content: "";
	position: absolute;
	top: -3px;
	left: 0;
	width: 160px;
	height: 8px;
	border-radius: 8px;
	background: radial-gradient(ellipse at center, #fff 0%, var(--tse-orange) 35%, transparent 70%);
	filter: blur(1px);
	transform: translateX(-200px);
}

/* ---------- The game (intro) ---------- */
.tse-intro { text-align: center; }
.tse-intro p:not(.tse-eyebrow) { font-size: 18px; }

/* ---------- How a chamber works ---------- */
.tse-how { background: linear-gradient(180deg, var(--tse-bg), var(--tse-stone) 50%, var(--tse-bg)); }
.tse-how > h2,
.tse-how > .tse-eyebrow { text-align: center; }
.tse-steps { gap: 24px; margin-top: 48px; position: relative; }
.tse-step {
	position: relative;
	padding: 32px 24px;
	border: 1px solid var(--tse-line);
	border-radius: 16px;
	background: linear-gradient(180deg, rgba(19, 36, 31, 0.9), rgba(10, 21, 18, 0.9));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 16px 40px rgba(0, 0, 0, 0.35);
}
.tse .tse-step__num {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	letter-spacing: 0.12em;
	color: var(--tse-orange);
	margin: 0;
}
.tse-step:nth-child(2) .tse-step__num { color: var(--tse-gold); }
.tse-step:nth-child(3) .tse-step__num { color: var(--tse-cyan); }
.tse-step h3 { margin-top: 8px; }
.tse-step p:last-child { margin-bottom: 0; }

.tse-gates {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 16px;
	margin: 48px 0 0;
	padding: 0;
	list-style: none;
}
.tse-gates li {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 104px;
	padding: 16px 8px;
	border: 1px solid var(--tse-line);
	border-radius: 12px;
	background: rgba(7, 17, 15, 0.6);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--tse-ink);
}
.tse .tse-note { text-align: center; margin: 24px auto 0; max-width: 560px; }

/* ---------- Features ---------- */
.tse-features > h2,
.tse-features > .tse-eyebrow { text-align: center; }
.tse-cards { gap: 24px; margin-top: 48px; }
.tse-card {
	position: relative;
	padding: 32px 24px 24px;
	border: 1px solid var(--tse-line);
	border-radius: 16px;
	background: linear-gradient(160deg, var(--tse-stone-2), var(--tse-stone));
	overflow: hidden;
}
/* A lit channel across the top of each tile. */
.tse-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 24px;
	right: 24px;
	height: 2px;
	background: linear-gradient(90deg, var(--tse-orange), var(--tse-cyan));
	box-shadow: 0 0 12px rgba(243, 154, 43, 0.6);
	opacity: 0.85;
}
.tse-card h3 { margin: 0; }
.tse-card p { margin: 8px 0 0; font-size: 16px; }
.tse .tse-fineprint {
	text-align: center;
	margin: 40px 0 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	letter-spacing: 0.06em;
	color: var(--tse-ink);
}

/* ---------- Music ---------- */
.tse-music {
	background:
		radial-gradient(ellipse 60% 70% at 85% 50%, rgba(60, 200, 255, 0.1), transparent 70%),
		var(--tse-bg);
}
.tse-eq {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	height: 64px;
	margin: 0 0 32px;
}
.tse-eq span {
	display: block;
	width: 8px;
	height: var(--h, 40%);
	border-radius: 4px;
	background: linear-gradient(180deg, var(--tse-cyan), rgba(60, 200, 255, 0.15));
	box-shadow: 0 0 10px rgba(60, 200, 255, 0.45);
	transform-origin: bottom;
}
.tse-eq span:nth-child(3n) { background: linear-gradient(180deg, var(--tse-orange), rgba(243, 154, 43, 0.15)); box-shadow: 0 0 10px rgba(243, 154, 43, 0.45); }
.tse-music p:not(.tse-eyebrow) { font-size: 18px; }
.tse-auv3 {
	margin-top: 40px;
	padding: 32px;
	border: 1px solid rgba(60, 200, 255, 0.25);
	border-radius: 16px;
	background: rgba(13, 26, 23, 0.85);
}
.tse-auv3 h3 { margin: 0; color: var(--tse-cyan); }
.tse-auv3 p { margin: 8px 0 0; font-size: 16px !important; }

/* ---------- Privacy ---------- */
.tse-privacy { background: var(--tse-stone); scroll-margin-top: 24px; }
.tse-privacy h2 { margin-bottom: 0; }
.tse .tse-updated {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--tse-gold);
	margin-top: 16px;
}
.tse-privacy h3 { margin-top: 40px; margin-bottom: 8px; font-size: 18px; }
.tse-privacy p { color: #c4cfca; }
.tse-privacy p + p { margin-top: 16px; }

/* ---------- Support ---------- */
.tse-support { text-align: center; scroll-margin-top: 24px; }
.tse-support h2 { margin-top: 0; }
.tse-support .wp-block-buttons { justify-content: center; gap: 16px; margin-top: 32px; }
.tse .wp-block-button__link {
	background: linear-gradient(180deg, #f6a93f, #e0841a);
	color: #1a0f02;
	font-weight: 700;
	border-radius: 999px;
	padding: 14px 24px;
	text-decoration: none;
	box-shadow: 0 0 24px rgba(243, 154, 43, 0.35);
}
.tse .wp-block-button__link:hover { color: #1a0f02; filter: brightness(1.08); text-decoration: none; }
.tse .is-style-ghost .wp-block-button__link {
	background: transparent;
	color: var(--tse-cyan);
	border: 1px solid rgba(60, 200, 255, 0.55);
	box-shadow: none;
}
.tse .is-style-ghost .wp-block-button__link:hover { color: #fff; border-color: var(--tse-cyan); }
.tse .tse-maker { margin-top: 40px; font-size: 14px; }

/* ---------- Motion (only when the visitor allows it) ---------- */
@media (prefers-reduced-motion: no-preference) {
	.tse-signal::after { animation: tse-run 5s linear infinite; }
	.tse-glyph { animation: tse-pulse 3.2s ease-in-out infinite; }
	.tse-glyph:nth-child(2) { animation-delay: 0.4s; }
	.tse-glyph:nth-child(3) { animation-delay: 0.8s; }
	.tse-glyph:nth-child(4) { animation-delay: 1.2s; }
	.tse-eq span { animation: tse-eq 1.6s ease-in-out infinite alternate; }
	.tse-eq span:nth-child(2n) { animation-duration: 1.1s; }
	.tse-eq span:nth-child(3n) { animation-duration: 1.9s; animation-delay: 0.3s; }
	.tse-eq span:nth-child(5n) { animation-duration: 1.3s; animation-delay: 0.6s; }
	.tse-card { transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; }
	.tse-card:hover { transform: translateY(-4px); border-color: rgba(243, 154, 43, 0.4); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 24px rgba(243, 154, 43, 0.12); }
}
@keyframes tse-run {
	from { transform: translateX(-200px); }
	to { transform: translateX(100vw); }
}
@keyframes tse-pulse {
	0%, 100% { opacity: 0.55; filter: drop-shadow(0 0 3px currentColor); }
	50% { opacity: 1; filter: drop-shadow(0 0 10px currentColor); }
}
@keyframes tse-eq {
	from { transform: scaleY(0.35); }
	to { transform: scaleY(1); }
}

/* With reduced motion the signal still reads, as a static lit segment. */
@media (prefers-reduced-motion: reduce) {
	.tse-signal::after { transform: translateX(calc(50vw - 80px)); }
}

/* ---------- Phone ---------- */
@media (max-width: 781px) {
	.tse { --tse-band-y: 72px; font-size: 16px; }
	.tse .tse-hero { min-height: 0; padding: 72px var(--tse-pad) 104px; }
	.tse-glyphs { gap: 16px; margin-top: 32px; }
	.tse-glyph { width: 40px; height: 40px; }
	.tse-intro p:not(.tse-eyebrow),
	.tse-music p:not(.tse-eyebrow) { font-size: 17px; }
	.tse-steps { margin-top: 32px; }
	.tse-gates { gap: 8px; }
	.tse-gates li { width: calc(50% - 4px); max-width: 140px; }
	.tse-auv3 { padding: 24px; }
	.tse .tse-jump { line-height: 2.2; }
}

/* App icon above the title, rounded like iOS draws it, with the hero's two lights behind it. */
.tse .tse-hero .tse-icon { margin: 0 auto 28px; }
.tse .tse-hero .tse-icon img {
	display: block;
	width: 120px;
	height: 120px;
	border-radius: 22.5%;
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.12),
		-14px 10px 40px rgba(243, 154, 43, 0.35),
		14px 10px 40px rgba(60, 200, 255, 0.3),
		0 18px 40px rgba(0, 0, 0, 0.5);
}
@media (max-width: 600px) {
	.tse .tse-hero .tse-icon { margin-bottom: 20px; }
	.tse .tse-hero .tse-icon img { width: 88px; height: 88px; }
}
