Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

12.7 KB
Raw Blame
/* <three-gate> — scoped styles injected into the element's shadow root.
 *
 * Self-contained: the palette is declared on :host (reusing the site's established
 * dark tokens — green/gold/silver on near-black panels) so the component is safe to
 * drop on any page without depending on page-level CSS variables. Every state is
 * designed: loading skeleton, locked card (overlay + replace modes), the brief
 * reveal to unlocked, and an actionable error. Responsive 320 → 1440, reduced-motion
 * aware, full keyboard focus rings. */

:host {
	/* Palette — kept byte-aligned with three-lock.js / three-economy.js. */
	--tg-bg: #0e0e13;
	--tg-bg-2: #0a0a0e;
	--tg-line: #23232c;
	--tg-line-2: #2a2a33;
	--tg-ink: #f6f6f8;
	--tg-muted: #a6a6b0;
	--tg-muted-2: #80808b;
	--tg-green: #6ee7a8;
	--tg-green-2: #9bf0c4;
	--tg-gold: #f5c451;
	--tg-gold-2: #ffd980;
	--tg-silver: #cfd6e4;
	--tg-silver-2: #eef2f8;
	--tg-ease: cubic-bezier(0.22, 1, 0.36, 1);

	display: block;
	position: relative;
	font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	color: var(--tg-ink);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

.tg-root {
	position: relative;
}

/* Visually-hidden live region for screen readers (loading announcement). */
.tg-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ── The slotted premium UI ──────────────────────────────────────────────── */

.tg-content {
	transition: opacity var(--duration-slow) var(--tg-ease), filter var(--duration-slow) var(--tg-ease);
}

/* While loading / locked / errored, the real UI is dimmed and frosted behind the
 * veil (overlay mode). Interaction is additionally blocked via the `inert`
 * attribute the component sets on the slotted children, so this is purely visual. */
.tg-root[data-state='loading'] .tg-content,
.tg-root[data-state='locked'] .tg-content,
.tg-root[data-state='error'] .tg-content {
	opacity: 0.34;
	filter: blur(2.5px) saturate(0.82);
	pointer-events: none;
	user-select: none;
}

/* Replace mode hides the real UI entirely until it's unlocked — only the lock
 * card occupies the box. */
.tg-root[data-mode='replace']:not([data-state='unlocked']) .tg-content {
	display: none;
}

/* The unlocked reveal: un-dim and rise in. */
.tg-root[data-state='unlocked'] .tg-content {
	opacity: 1;
	filter: none;
	pointer-events: auto;
	animation: tg-reveal 0.42s var(--tg-ease);
}

/* ── The veil (carries the lock card / skeleton / error) ─────────────────── */

.tg-veil {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	pointer-events: none; /* re-enabled on the card itself */
}

/* In replace mode the veil takes normal flow so the component has intrinsic height. */
.tg-root[data-mode='replace'] .tg-veil {
	position: relative;
	inset: auto;
}

.tg-root[data-state='unlocked'] .tg-veil {
	display: none;
}

.tg-veil-inner {
	width: min(440px, 100%);
	pointer-events: auto;
}

/* ── Card shell ──────────────────────────────────────────────────────────── */

.tg-card {
	position: relative;
	overflow: hidden;
	border-radius: 18px;
	padding: 20px 20px 18px;
	background: linear-gradient(180deg, var(--tg-bg), var(--tg-bg-2));
	border: 1px solid var(--tg-line);
	box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	animation: tg-rise 0.3s var(--tg-ease);
}

/* Tier tone — gold for the top tiers, silver, else green (mirrors the badge/lock). */
.tg-card.tg-green {
	border-color: rgba(110, 231, 168, 0.26);
}
.tg-card.tg-silver {
	border-color: rgba(207, 214, 228, 0.26);
}
.tg-card.tg-gold {
	border-color: rgba(245, 196, 81, 0.28);
}

/* A soft glow strip along the card top, tinted by tier. */
.tg-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--tg-green), transparent);
	opacity: 0.55;
}
.tg-card.tg-silver::before {
	background: linear-gradient(90deg, transparent, var(--tg-silver), transparent);
}
.tg-card.tg-gold::before {
	background: linear-gradient(90deg, transparent, var(--tg-gold), transparent);
}

.tg-card-head {
	display: flex;
	align-items: center;
	gap: 13px;
	margin-bottom: 12px;
}

.tg-glyph {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--tg-green);
	background: rgba(110, 231, 168, 0.1);
	border: 1px solid rgba(110, 231, 168, 0.22);
}
.tg-glyph svg {
	width: 21px;
	height: 21px;
}
.tg-silver .tg-glyph {
	color: var(--tg-silver);
	background: rgba(207, 214, 228, 0.1);
	border-color: rgba(207, 214, 228, 0.22);
}
.tg-gold .tg-glyph {
	color: var(--tg-gold);
	background: rgba(245, 196, 81, 0.1);
	border-color: rgba(245, 196, 81, 0.24);
}

.tg-card-titles {
	min-width: 0;
}
.tg-eyebrow {
	margin: 0 0 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--tg-green);
}
.tg-silver .tg-eyebrow {
	color: var(--tg-silver);
}
.tg-gold .tg-eyebrow {
	color: var(--tg-gold);
}
.tg-label {
	margin: 0;
	font-size: 15.5px;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.3;
	color: var(--tg-ink);
}

.tg-why {
	margin: 0 0 14px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--tg-muted-2);
	font-style: italic;
}

/* Held vs required */
.tg-meta {
	display: flex;
	align-items: stretch;
	gap: 10px;
	margin: 0 0 12px;
}
.tg-meta-col {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 10px 12px;
	border-radius: 11px;
	background: rgba(255, 255, 255, 0.025);
	border: 1px solid var(--tg-line);
}
.tg-meta-col--req {
	border-color: rgba(110, 231, 168, 0.22);
	background: rgba(110, 231, 168, 0.05);
}
.tg-silver .tg-meta-col--req {
	border-color: rgba(207, 214, 228, 0.22);
	background: rgba(207, 214, 228, 0.05);
}
.tg-gold .tg-meta-col--req {
	border-color: rgba(245, 196, 81, 0.22);
	background: rgba(245, 196, 81, 0.06);
}
.tg-meta-k {
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--tg-muted-2);
}
.tg-meta-v {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--tg-ink);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tg-meta-arrow {
	align-self: center;
	flex-shrink: 0;
	color: var(--tg-muted-2);
	font-size: 14px;
}

/* Progress (held_usd / required min_usd) */
.tg-prog {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px;
}
.tg-prog-track {
	flex: 1;
	height: 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.07);
	overflow: hidden;
}
.tg-prog-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--tg-green), var(--tg-green-2));
	transition: width var(--duration-slow) var(--tg-ease);
}
/* Grow the fill in from the left to its real, balance-driven width without
   touching the inline width (scaleX, transform-origin left). */
.tg-prog-fill--grow {
	transform-origin: left center;
	animation: tg-fill-grow 0.6s var(--tg-ease) both;
}
@keyframes tg-fill-grow {
	from { transform: scaleX(0); }
	to { transform: scaleX(1); }
}
.tg-silver .tg-prog-fill {
	background: linear-gradient(90deg, var(--tg-silver), var(--tg-silver-2));
}
.tg-gold .tg-prog-fill {
	background: linear-gradient(90deg, var(--tg-gold), var(--tg-gold-2));
}
.tg-prog-cap {
	flex-shrink: 0;
	font-size: 11px;
	font-weight: 600;
	color: var(--tg-muted);
	white-space: nowrap;
}

/* Actions */
.tg-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
	align-items: center;
}
.tg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font: 700 13px/1 Inter, system-ui, sans-serif;
	padding: 11px 16px;
	border-radius: 11px;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid var(--tg-line-2);
	background: #13131a;
	color: var(--tg-ink);
	transition: transform var(--duration-fast) var(--tg-ease), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard),
		box-shadow var(--duration-fast) var(--ease-standard);
}
.tg-btn--sm {
	padding: 8px 13px;
	font-size: 12px;
}
.tg-btn--primary {
	background: var(--tg-green);
	color: #06120c;
	border-color: var(--tg-green);
	box-shadow: 0 0 0 0 rgba(110, 231, 168, 0);
}
.tg-btn--primary:hover {
	background: var(--tg-green-2);
	transform: translateY(-1px);
	box-shadow: 0 8px 24px -8px rgba(110, 231, 168, 0.55);
}
.tg-silver .tg-btn--primary {
	background: var(--tg-silver);
	color: #10131a;
	border-color: var(--tg-silver);
}
.tg-silver .tg-btn--primary:hover {
	background: var(--tg-silver-2);
	box-shadow: 0 8px 24px -8px rgba(207, 214, 228, 0.5);
}
.tg-gold .tg-btn--primary {
	background: var(--tg-gold);
	color: #1a1303;
	border-color: var(--tg-gold);
}
.tg-gold .tg-btn--primary:hover {
	background: var(--tg-gold-2);
	box-shadow: 0 8px 24px -8px rgba(245, 196, 81, 0.5);
}
.tg-btn--ghost {
	background: #0e0e13;
}
.tg-btn--ghost:hover {
	border-color: #3a3a44;
	background: #181820;
	transform: translateY(-1px);
}

.tg-hold-hint {
	font-size: 12px;
	color: var(--tg-muted);
	line-height: 1.4;
}

.tg-pay {
	margin: 11px 0 0;
	font-size: 12px;
	color: var(--tg-muted);
}
.tg-pay strong {
	color: var(--tg-ink);
	font-weight: 700;
}

.tg-perks {
	display: inline-block;
	margin-top: 14px;
	font-size: 12px;
	font-weight: 600;
	color: var(--tg-muted);
	text-decoration: none;
	transition: color var(--duration-fast) var(--ease-standard);
}
.tg-perks:hover {
	color: var(--tg-ink);
	text-decoration: underline;
}

/* ── Loading skeleton ────────────────────────────────────────────────────── */

.tg-card--skel {
	display: flex;
	align-items: center;
	gap: 14px;
}
.tg-skel {
	display: block;
	border-radius: 9px;
	background: linear-gradient(90deg, #15151b, #20202a, #15151b);
	background-size: 200% 100%;
	animation: tg-shimmer 1.3s infinite;
}
.tg-skel--glyph {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	border-radius: 12px;
}
.tg-skel-lines {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.tg-skel--l1 {
	height: 12px;
	width: 64%;
}
.tg-skel--l2 {
	height: 10px;
	width: 88%;
}
.tg-skel--l3 {
	height: 10px;
	width: 40%;
}

/* ── Error ───────────────────────────────────────────────────────────────── */

.tg-card--err {
	display: flex;
	align-items: center;
	gap: 12px;
	border-color: #3a2222;
	background: linear-gradient(180deg, rgba(34, 18, 18, 0.95), rgba(22, 12, 12, 0.95));
	animation: none;
}
.tg-card--err::before {
	display: none;
}
.tg-err-ico {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 13px;
	color: #ff9b9b;
	background: rgba(255, 120, 120, 0.12);
	border: 1px solid rgba(255, 120, 120, 0.3);
}
.tg-err-body {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.tg-err-text {
	margin: 0;
	font-size: 12.5px;
	color: #f0c2c2;
}

/* ── Focus + motion ──────────────────────────────────────────────────────── */

.tg-btn:focus-visible,
.tg-perks:focus-visible {
	outline: 2px solid var(--tg-green);
	outline-offset: 2px;
}
.tg-gold .tg-btn:focus-visible {
	outline-color: var(--tg-gold);
}
.tg-silver .tg-btn:focus-visible {
	outline-color: var(--tg-silver);
}

@keyframes tg-shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}
@keyframes tg-rise {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
@keyframes tg-reveal {
	from {
		opacity: 0;
		transform: translateY(6px) scale(0.995);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 420px) {
	.tg-card {
		padding: 16px 15px 15px;
	}
	.tg-meta {
		flex-direction: column;
		gap: 8px;
	}
	.tg-meta-arrow {
		transform: rotate(90deg);
	}
	.tg-actions {
		width: 100%;
	}
	.tg-actions .tg-btn {
		flex: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tg-content,
	.tg-card,
	.tg-prog-fill,
	.tg-btn,
	.tg-skel {
		transition: none;
		animation: none;
	}
}