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.

31.7 KB
Raw Blame
<!doctype html>
<html lang="en">
	<head>
		<script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title data-i18n="tour.meta_title">Guided Tour: a 3D guide walks you through three.ws · three.ws</title>
		<meta
			name="description"
			content="Take the three.ws guided tour: a 3D avatar walks across the live site, points at every feature, and narrates what each one does and how to use it, with voice plus an on-screen chat bubble, paced by you."
		 data-i18n-attr="content:tour.meta_description"/>
		<meta name="robots" content="index, follow" />
		<link rel="canonical" href="https://three.ws/tour" />

		<meta property="og:type" content="website" />
		<meta property="og:site_name" content="three.ws" />
		<meta property="og:title" content="Guided Tour: a 3D guide walks you through three.ws"  data-i18n-attr="content:tour.meta_og_title"/>
		<meta
			property="og:description"
			content="A 3D avatar walks the live site, points at every feature, and narrates how to use it. Quick highlights in a few minutes, or the full tour, paced by you."
		 data-i18n-attr="content:tour.meta_og_description"/>
		<meta property="og:url" content="https://three.ws/tour" />
		<meta property="og:image" content="https://three.ws/api/page-og?s=main&amp;t=Guided+Tour&amp;d=A+3D+guide+walks+across+the+live+site%2C+points+at+every+feature%2C+and+narrates+what+each+one+does+and+how+to+use+it%3A+voice+plus+an+on-screen+chat+bubble%2C+paced&amp;p=%2Ftour" />
		<meta property="og:image:width" content="1200" />
		<meta property="og:image:height" content="630" />
		<meta name="twitter:card" content="summary_large_image" />
		<meta name="twitter:title" content="Guided Tour: a 3D guide walks you through three.ws"  data-i18n-attr="content:tour.meta_twitter_title"/>
		<meta
			name="twitter:description"
			content="A 3D avatar walks the live site, points at every feature, and narrates how to use it."
		 data-i18n-attr="content:tour.meta_twitter_description"/>
		<meta name="twitter:image" content="https://three.ws/api/page-og?s=main&amp;t=Guided+Tour&amp;d=A+3D+guide+walks+across+the+live+site%2C+points+at+every+feature%2C+and+narrates+what+each+one+does+and+how+to+use+it%3A+voice+plus+an+on-screen+chat+bubble%2C+paced&amp;p=%2Ftour" />

		<link rel="icon" href="/favicon.ico" sizes="any" />
		<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
		<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
		<link rel="manifest" href="/manifest.webmanifest" />
		<link rel="stylesheet" href="/style.css" />
		<link rel="stylesheet" href="/nav.css" />
		<link rel="stylesheet" href="/fonts/fonts.css" />

		<style>
			.tour-page {
				--accent: #7aa2ff;
				--accent-2: #9d7bff;
				color: #e7eaf2;
			}
			.tour-wrap {
				width: 100%;
				min-width: 0;
				max-width: 1040px;
				margin: 0 auto;
				padding: 0 20px 80px;
			}
			/* Hero */
			.tour-hero {
				position: relative;
				text-align: center;
				padding: 64px 20px 48px;
				overflow: hidden;
			}
			.tour-hero::before {
				content: '';
				position: absolute;
				inset: -40% 0 auto;
				height: 480px;
				background: radial-gradient(60% 60% at 50% 0%, rgba(122, 162, 255, 0.22), transparent 70%);
				pointer-events: none;
				z-index: 0;
			}
			.tour-hero > * {
				position: relative;
				z-index: 1;
			}
			.tour-eyebrow {
				display: inline-flex;
				align-items: center;
				gap: 8px;
				font-size: 12.5px;
				font-weight: 600;
				letter-spacing: 0.04em;
				text-transform: uppercase;
				color: var(--accent);
				background: rgba(122, 162, 255, 0.1);
				border: 1px solid rgba(122, 162, 255, 0.28);
				padding: 6px 12px;
				border-radius: 99px;
				margin-bottom: 22px;
			}
			.tour-eyebrow .dot {
				width: 7px;
				height: 7px;
				border-radius: 50%;
				background: var(--accent);
				box-shadow: 0 0 0 0 rgba(122, 162, 255, 0.6);
				animation: tour-pulse 2s infinite;
			}
			@keyframes tour-pulse {
				0% { box-shadow: 0 0 0 0 rgba(122, 162, 255, 0.5); }
				70% { box-shadow: 0 0 0 8px rgba(122, 162, 255, 0); }
				100% { box-shadow: 0 0 0 0 rgba(122, 162, 255, 0); }
			}
			.tour-h1 {
				font-size: clamp(2rem, 5vw, 3.3rem);
				line-height: 1.08;
				font-weight: 800;
				margin: 0 0 16px;
				letter-spacing: -0.02em;
			}
			.tour-h1 .grad {
				background: linear-gradient(90deg, var(--accent), var(--accent-2));
				-webkit-background-clip: text;
				background-clip: text;
				color: transparent;
			}
			.tour-sub {
				font-size: clamp(1rem, 2vw, 1.18rem);
				line-height: 1.55;
				color: #aeb6c6;
				max-width: 620px;
				margin: 0 auto 30px;
			}
			.tour-cta-row {
				display: flex;
				gap: 12px;
				justify-content: center;
				flex-wrap: wrap;
			}
			.tour-btn {
				appearance: none;
				border: 1px solid rgba(255, 255, 255, 0.14);
				background: rgba(255, 255, 255, 0.05);
				color: #eef1f6;
				font: 600 15px/1 system-ui, -apple-system, 'Segoe UI', sans-serif;
				padding: 15px 24px;
				border-radius: 13px;
				cursor: pointer;
				text-decoration: none;
				display: inline-flex;
				align-items: center;
				gap: 9px;
				transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
			}
			.tour-btn:hover {
				background: rgba(255, 255, 255, 0.1);
				border-color: rgba(255, 255, 255, 0.22);
			}
			.tour-btn:active {
				transform: scale(0.98);
			}
			.tour-btn--primary {
				background: linear-gradient(90deg, var(--accent), var(--accent-2));
				color: #0b0e16;
				border-color: transparent;
				box-shadow: 0 10px 30px rgba(122, 162, 255, 0.32);
			}
			.tour-btn--primary:hover {
				filter: brightness(1.06);
				background: linear-gradient(90deg, var(--accent), var(--accent-2));
			}
			.tour-btn:focus-visible {
				outline: 2px solid var(--accent);
				outline-offset: 3px;
			}
			/* Track picker */
			.tour-tracks {
				display: flex;
				gap: 14px;
				justify-content: center;
				flex-wrap: wrap;
				margin-top: 6px;
			}
			.tour-track {
				display: flex;
				align-items: center;
				gap: 14px;
				text-align: left;
				appearance: none;
				cursor: pointer;
				flex: 0 1 300px;
				min-width: 0;
				max-width: 100%;
				padding: 16px 18px;
				border-radius: 16px;
				border: 1px solid rgba(255, 255, 255, 0.12);
				background: rgba(255, 255, 255, 0.04);
				color: #eef1f6;
				transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
			}
			.tour-track:hover {
				border-color: rgba(122, 162, 255, 0.45);
				background: rgba(122, 162, 255, 0.07);
				transform: translateY(-2px);
			}
			.tour-track:active {
				transform: translateY(0) scale(0.99);
			}
			.tour-track:focus-visible {
				outline: 2px solid var(--accent);
				outline-offset: 3px;
			}
			.tour-track--primary {
				border-color: transparent;
				background: linear-gradient(120deg, rgba(122, 162, 255, 0.22), rgba(157, 123, 255, 0.22));
				box-shadow: 0 12px 34px rgba(122, 162, 255, 0.22);
			}
			.tour-track--primary:hover {
				background: linear-gradient(120deg, rgba(122, 162, 255, 0.3), rgba(157, 123, 255, 0.3));
			}
			.tour-track__icon {
				flex: 0 0 auto;
				width: 42px;
				height: 42px;
				border-radius: 12px;
				display: grid;
				place-items: center;
				font-size: 20px;
				background: rgba(0, 0, 0, 0.22);
			}
			.tour-track__body {
				flex: 1;
				display: flex;
				flex-direction: column;
				gap: 3px;
			}
			.tour-track__title {
				font-weight: 700;
				font-size: 15.5px;
			}
			.tour-track__meta {
				font-size: 12.5px;
				color: #9aa3b6;
			}
			.tour-track__go {
				flex: 0 0 auto;
				color: var(--accent);
				font-size: 13px;
			}
			.tour-resume {
				display: none;
				margin-top: 16px;
				font-size: 13.5px;
				color: #aeb6c6;
			}
			.tour-resume a,
			.tour-resume button {
				color: var(--accent);
				font-weight: 600;
				background: none;
				border: 0;
				padding: 0;
				font-family: inherit;
				font-size: inherit;
				cursor: pointer;
				text-decoration: underline;
				border-radius: 4px;
			}
			.tour-resume a:focus-visible,
			.tour-resume button:focus-visible {
				outline: 2px solid var(--accent);
				outline-offset: 3px;
			}
			/* Stats */
			.tour-stats {
				display: flex;
				justify-content: center;
				gap: 14px;
				flex-wrap: wrap;
				margin: 40px 0 8px;
			}
			.tour-stat {
				background: rgba(255, 255, 255, 0.035);
				border: 1px solid rgba(255, 255, 255, 0.08);
				border-radius: 16px;
				padding: 18px 26px;
				min-width: 132px;
				text-align: center;
			}
			.tour-stat__n .skeleton {
				display: inline-block;
				width: 2.2em;
				height: 0.9em;
				vertical-align: middle;
			}
			.tour-stat__n {
				font-size: 1.8rem;
				font-weight: 800;
				background: linear-gradient(90deg, var(--accent), var(--accent-2));
				-webkit-background-clip: text;
				background-clip: text;
				color: transparent;
				font-variant-numeric: tabular-nums;
			}
			.tour-stat__l {
				font-size: 12.5px;
				color: #8b93a7;
				margin-top: 4px;
			}
			/* Sections */
			.tour-section {
				margin-top: 64px;
			}
			.tour-section__title {
				font-size: 1.5rem;
				font-weight: 700;
				margin: 0 0 8px;
				text-align: center;
			}
			.tour-section__lead {
				color: #8b93a7;
				text-align: center;
				margin: 0 auto 28px;
				max-width: 560px;
				font-size: 15px;
			}
			.tour-how {
				display: grid;
				grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
				gap: 16px;
			}
			.tour-how__card {
				background: rgba(255, 255, 255, 0.035);
				border: 1px solid rgba(255, 255, 255, 0.08);
				border-radius: 16px;
				padding: 22px;
			}
			.tour-how__icon {
				width: 42px;
				height: 42px;
				border-radius: 11px;
				display: grid;
				place-items: center;
				font-size: 20px;
				background: rgba(122, 162, 255, 0.12);
				border: 1px solid rgba(122, 162, 255, 0.22);
				margin-bottom: 14px;
			}
			.tour-how__h {
				font-weight: 700;
				margin: 0 0 6px;
				font-size: 16px;
			}
			.tour-how__p {
				color: #9aa3b6;
				font-size: 14px;
				line-height: 1.5;
				margin: 0;
			}
			/* Chapters */
			.tour-chapters {
				display: grid;
				grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
				gap: 14px;
			}
			.tour-chapter {
				display: flex;
				align-items: center;
				gap: 16px;
				background: rgba(255, 255, 255, 0.035);
				border: 1px solid rgba(255, 255, 255, 0.08);
				border-radius: 14px;
				padding: 18px;
				transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
			}
			.tour-chapter:hover {
				border-color: rgba(122, 162, 255, 0.3);
				background: rgba(122, 162, 255, 0.05);
			}
			.tour-chapter__num {
				flex: 0 0 auto;
				width: 38px;
				height: 38px;
				border-radius: 10px;
				display: grid;
				place-items: center;
				font-weight: 800;
				color: #0b0e16;
				background: linear-gradient(135deg, var(--accent), var(--accent-2));
			}
			.tour-chapter__body h3 {
				margin: 0 0 3px;
				font-size: 15.5px;
			}
			.tour-chapter__body p {
				margin: 0;
				font-size: 13px;
				color: #8b93a7;
			}
			.tour-chapter__count {
				color: #7f8aa0;
				font-weight: 500;
				font-size: 12px;
			}
			.tour-chapter--skeleton {
				pointer-events: none;
			}
			.tour-chapter--skeleton .tour-chapter__num {
				background: none;
			}
			.tour-chapter--skeleton .tour-chapter__body {
				flex: 1;
				display: flex;
				flex-direction: column;
				gap: 8px;
			}
			.tour-chapters__error {
				grid-column: 1 / -1;
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: space-between;
				gap: 14px;
				padding: 20px 22px;
				border-radius: 14px;
				border: 1px solid rgba(255, 138, 128, 0.35);
				background: rgba(255, 138, 128, 0.07);
				color: #e7eaf2;
			}
			.tour-chapters__error p {
				margin: 0;
				font-size: 14px;
				line-height: 1.5;
				color: #c9cfdb;
				max-width: 560px;
			}
			.tour-chapters__error strong {
				display: block;
				color: #ffb4ab;
				margin-bottom: 3px;
			}
			.tour-final {
				text-align: center;
				margin-top: 68px;
				padding: 40px 24px;
				background: radial-gradient(120% 100% at 50% 0%, rgba(122, 162, 255, 0.1), transparent 70%);
				border: 1px solid rgba(255, 255, 255, 0.08);
				border-radius: 22px;
			}
			.tour-final h2 {
				font-size: 1.5rem;
				margin: 0 0 10px;
			}
			.tour-final p {
				color: #9aa3b6;
				margin: 0 0 22px;
			}
		</style>
	
	<meta property="og:locale" content="en_US">
	<meta property="og:image:alt" content="Guided Tour - three.ws">
	<meta name="twitter:site" content="@trythreews">
	<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Guided Tour","description":"A 3D guide walks across the live site, points at every feature, and narrates what each one does and how to use it - voice plus an on-screen chat bubble, paced by you.","url":"https://three.ws/tour","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Guided+Tour&d=A+3D+guide+walks+across+the+live+site%2C+points+at+every+feature%2C+and+narrates+what+each+one+does+and+how+to+use+it+-+voice+plus+an+on-screen+chat+bubble%2C+paced+b&p=%2Ftour"}]}</script>
</head>
	<body class="tour-page">
		<header><div id="nav-container"></div></header>
		<script src="/nav.js"></script>

		<main class="tour-wrap">
			<section class="tour-hero">
				<span class="tour-eyebrow" data-i18n-html="tour.guided_tour"><span class="dot"></span> Guided Tour</span>
				<h1 class="tour-h1" data-i18n-html="tour.let_a_3d_guide_walk_you_through">Let a 3D guide <span class="grad">walk you through</span> three.ws</h1>
				<p class="tour-sub" data-i18n="tour.press_play_and_a_3d_avatar_steps">
					Press play and a 3D avatar steps onto the page, walks over to each feature,
					points right at it, and tells you what it does and how to use it — speaking
					out loud with a chat bubble over its head. It covers the whole platform, on
					the real live site, and you set the pace.
				</p>
				<div class="tour-tracks" id="tour-tracks">
					<button class="tour-track tour-track--primary" data-track="quick" id="tour-start-quick">
						<span class="tour-track__icon" aria-hidden="true">⚡</span>
						<span class="tour-track__body">
							<span class="tour-track__title" data-i18n="tour.quick_highlights">Quick highlights</span>
							<span class="tour-track__meta" id="track-quick-meta" data-i18n="tour.the_best_of_every_chapter">the best of every chapter</span>
						</span>
						<span class="tour-track__go" aria-hidden="true">▶</span>
					</button>
					<button class="tour-track" data-track="full" id="tour-start-full">
						<span class="tour-track__icon" aria-hidden="true">🗺️</span>
						<span class="tour-track__body">
							<span class="tour-track__title" data-i18n="tour.full_tour">Full tour</span>
							<span class="tour-track__meta" id="track-full-meta" data-i18n="tour.every_feature_chapter_by_chapter">every feature, chapter by chapter</span>
						</span>
						<span class="tour-track__go" aria-hidden="true">▶</span>
					</button>
				</div>
				<div class="tour-cta-row" style="margin-top:18px">
					<a class="tour-btn" href="#how" data-i18n="tour.how_it_works">How it works</a>
				</div>
				<p class="tour-resume" id="tour-resume">
					<span id="tour-resume-live" data-i18n="tour.you_have_a_tour_in_progress">You have a tour in progress.</span>
					<span id="tour-resume-saved" hidden data-i18n="tour.welcome_back_your_tour_is_bookmarked">Welcome back, your tour is bookmarked.</span>
					<button type="button" id="tour-resume-link" data-i18n="tour.pick_it_back_up">Pick it back up →</button>
				</p>
			</section>

			<div class="tour-stats" id="tour-stats" aria-busy="true">
				<div class="tour-stat"><div class="tour-stat__n" id="stat-features"><span class="skeleton skeleton--text" aria-hidden="true"></span></div><div class="tour-stat__l">features visited</div></div>
				<div class="tour-stat"><div class="tour-stat__n" id="stat-minutes"><span class="skeleton skeleton--text" aria-hidden="true"></span></div><div class="tour-stat__l">minutes, paced by you</div></div>
				<div class="tour-stat"><div class="tour-stat__n" id="stat-chapters"><span class="skeleton skeleton--text" aria-hidden="true"></span></div><div class="tour-stat__l">chapters</div></div>
			</div>

			<section class="tour-section" id="how">
				<h2 class="tour-section__title" data-i18n="tour.how_it_works_2">How it works</h2>
				<p class="tour-section__lead" data-i18n="tour.no_video_no_slides_the_guide_drives">No video, no slides — the guide drives the actual site, so everything it points at is the real thing you'll use.</p>
				<div class="tour-how">
					<div class="tour-how__card">
						<div class="tour-how__icon">🚶</div>
						<h3 class="tour-how__h" data-i18n="tour.it_walks_and_points">It walks and points</h3>
						<p class="tour-how__p" data-i18n="tour.the_avatar_moves_across_the_page_to">The avatar moves across the page to stand beside each feature, faces it, and gestures — with a beam connecting the guide to exactly what it's talking about.</p>
					</div>
					<div class="tour-how__card">
						<div class="tour-how__icon">🗣️</div>
						<h3 class="tour-how__h" data-i18n="tour.it_speaks_and_captions">It speaks and captions</h3>
						<p class="tour-how__p" data-i18n="tour.every_stop_is_narrated_out_loud_and">Every stop is narrated out loud and shown in a chat bubble above the guide's head, so you can listen, read, or mute the voice and just read along.</p>
					</div>
					<div class="tour-how__card">
						<div class="tour-how__icon">🎛️</div>
						<h3 class="tour-how__h" data-i18n="tour.you_re_in_control">You're in control</h3>
						<p class="tour-how__p" data-i18n="tour.pause_skip_ahead_step_back_or_scrub">Pause, skip ahead, step back, or scrub the progress bar anytime. Wander off to explore and the guide waits — press play and it takes you back to where you were.</p>
					</div>
				</div>
			</section>

			<section class="tour-section">
				<h2 class="tour-section__title" data-i18n="tour.or_drive_it_yourself">Or drive it yourself</h2>
				<p class="tour-section__lead" data-i18n-html="tour.rather_play_than_watch_take_the_controls">Rather play than watch? Take the controls: each page gets a glowing checkpoint, and you steer the guide to it — arrow keys or WASD on desktop, a joystick on your phone. Press <strong>M</strong> anytime to flip between the two movement styles.</p>
				<div class="tour-tracks">
					<button class="tour-track" id="tour-start-explore" data-i18n-html="tour.explore_walk_the_guide_anywhere_no_falling">
						<span class="tour-track__icon">🕹</span>
						<span class="tour-track__body">
							<span class="tour-track__title">Explore</span>
							<span class="tour-track__meta">walk the guide anywhere — no falling</span>
						</span>
						<span class="tour-track__go">▶</span>
					</button>
					<button class="tour-track" id="tour-start-platformer" data-i18n-html="tour.platformer_gravity_on_run_and_jump_across">
						<span class="tour-track__icon">🎮</span>
						<span class="tour-track__body">
							<span class="tour-track__title">Platformer</span>
							<span class="tour-track__meta">gravity on — run and jump across the page</span>
						</span>
						<span class="tour-track__go">▶</span>
					</button>
				</div>
				<p class="tour-section__lead" style="margin-top:14px; font-size:13.5px" data-i18n-html="tour.want_this_on_your_own_site_or">
					Want this on your own site or store? Build one in the <a href="/tour-builder">Tour Builder</a> — no code, both modes included.
				</p>
			</section>

			<section class="tour-section">
				<h2 class="tour-section__title" data-i18n="tour.what_you_ll_see">What you'll see</h2>
				<p class="tour-section__lead" data-i18n="tour.the_tour_runs_as_chapters_from_building">The tour runs as chapters — from building your first agent to taking it on-chain.</p>
				<div class="tour-chapters" id="tour-chapters" aria-busy="true">
					<div class="tour-chapter tour-chapter--skeleton" aria-hidden="true"><div class="tour-chapter__num skeleton"></div><div class="tour-chapter__body"><span class="skeleton skeleton--text" style="width:45%"></span><span class="skeleton skeleton--text" style="width:85%"></span></div></div>
					<div class="tour-chapter tour-chapter--skeleton" aria-hidden="true"><div class="tour-chapter__num skeleton"></div><div class="tour-chapter__body"><span class="skeleton skeleton--text" style="width:45%"></span><span class="skeleton skeleton--text" style="width:85%"></span></div></div>
					<div class="tour-chapter tour-chapter--skeleton" aria-hidden="true"><div class="tour-chapter__num skeleton"></div><div class="tour-chapter__body"><span class="skeleton skeleton--text" style="width:45%"></span><span class="skeleton skeleton--text" style="width:85%"></span></div></div>
					<div class="tour-chapter tour-chapter--skeleton" aria-hidden="true"><div class="tour-chapter__num skeleton"></div><div class="tour-chapter__body"><span class="skeleton skeleton--text" style="width:45%"></span><span class="skeleton skeleton--text" style="width:85%"></span></div></div>
					<div class="tour-chapter tour-chapter--skeleton" aria-hidden="true"><div class="tour-chapter__num skeleton"></div><div class="tour-chapter__body"><span class="skeleton skeleton--text" style="width:45%"></span><span class="skeleton skeleton--text" style="width:85%"></span></div></div>
					<div class="tour-chapter tour-chapter--skeleton" aria-hidden="true"><div class="tour-chapter__num skeleton"></div><div class="tour-chapter__body"><span class="skeleton skeleton--text" style="width:45%"></span><span class="skeleton skeleton--text" style="width:85%"></span></div></div>
				</div>
			</section>

			<section class="tour-final">
				<h2 data-i18n="tour.ready_when_you_are">Ready when you are</h2>
				<p data-i18n="tour.bring_your_curiosity_the_guide_handles_the">Bring your curiosity — the guide handles the rest.</p>
				<button class="tour-btn tour-btn--primary" id="tour-start-2" data-i18n="tour.start_the_guided_tour">▶ Start the guided tour</button>
			</section>
		</main>

		<script>
			// Friendly one-line summaries for each chapter, keyed by curriculum
			// section id. The curriculum (built from data/pages.json) supplies the
			// authoritative titles and per-chapter stop counts at runtime.
			const CHAPTER_BLURB = {
				main: 'Get your bearings — the front door, discovery, and the marketplace.',
				build: 'Give your AI a body: avatars, a brain, a voice, and the studios.',
				crypto: 'Wallets, payments, token launches, and live market intelligence.',
				labs: 'The showcases — living demos that push the platform to full power.',
				'agent-tools': 'Talk to your agents, manage them, and check their reputation.',
				learn: 'Docs, guides, and tutorials for going deeper on your own.',
			};

			const STATE_KEY = 'tws:tour:state';
			const RESUME_KEY = 'tws:tour:resume';

			function startTour(track) {
				// The engine boots on the first stop's page via ?tour=start.
				const q = track === 'quick' ? '?tour=start&track=quick' : '?tour=start';
				fetch('/tour/curriculum.json', { cache: 'force-cache' })
					.then((r) => r.json())
					.then((c) => {
						const first = (c.stops && c.stops[0] && c.stops[0].path) || '/';
						location.href = first + q;
					})
					.catch(() => {
						location.href = '/' + q;
					});
			}

			document.getElementById('tour-start-quick').addEventListener('click', () => startTour('quick'));
			document.getElementById('tour-start-full').addEventListener('click', () => startTour('full'));
			document.getElementById('tour-start-2').addEventListener('click', () => startTour('quick'));

			// Interactive modes are single-surface (one checkpoint per page), so they
			// start on the homepage — the engine boots there via the deep link.
			function startInteractive(mode) {
				location.href = '/?tour=start&mode=' + mode;
			}
			document.getElementById('tour-start-explore').addEventListener('click', () => startInteractive('explore'));
			document.getElementById('tour-start-platformer').addEventListener('click', () => startInteractive('platformer'));

			// Resume affordance: an in-progress tour this session (sessionStorage)
			// takes priority; otherwise a durable cross-session bookmark
			// (localStorage) lets a returning visitor pick up where they left off.
			function readJSON(store, key) {
				try {
					const raw = store.getItem(key);
					return raw ? JSON.parse(raw) : null;
				} catch (_) {
					return null;
				}
			}
			(function setupResume() {
				const live = readJSON(sessionStorage, STATE_KEY);
				const saved = readJSON(localStorage, RESUME_KEY);
				const inProgress = live && live.active;
				const bookmarked = saved && !saved.completed && (saved.index || 0) > 0;
				if (!inProgress && !bookmarked) return;
				const src = inProgress ? live : saved;
				const resume = document.getElementById('tour-resume');
				resume.style.display = 'block';
				// Both sentences ship in the markup (each translatable on its own);
				// the script only picks which one shows.
				document.getElementById('tour-resume-live').hidden = !inProgress;
				document.getElementById('tour-resume-saved').hidden = inProgress;
				document.getElementById('tour-resume-link').addEventListener('click', () => {
					fetch('/tour/curriculum.json', { cache: 'force-cache' })
						.then((r) => r.json())
						.then((c) => {
							const stop = (c.stops && c.stops[src.index || 0]) || c.stops[0];
							// Re-seed the live session from the durable bookmark before navigating.
							if (!inProgress && src) {
								try {
									sessionStorage.setItem(
										STATE_KEY,
										JSON.stringify({
											active: true,
											index: src.index || 0,
											track: src.track || 'full',
											voice: src.voice || 'nova',
											speed: src.speed || 1,
											paused: false,
											muted: false,
										}),
									);
								} catch (_) {}
							}
							location.href = (stop ? stop.path : '/') + '?tour=1';
						})
						.catch(() => (location.href = '/?tour=1'));
				});
			})();

			// Populate stats, track cards, and chapter cards from the live curriculum.
			// The track meta spans are annotated copy until the curriculum lands;
			// from then on the script owns them (data-i18n-owned), so the i18n
			// catalog pass, which arrives after its own async fetch and again on
			// every locale switch, never reverts a real count to placeholder copy.
			const ONBOARDING_SECTION = 'onboarding';
			let curriculum = null;

			// Counts are copy too: "{{count}} picks · ~{{minutes}} min" goes through the
			// i18n runtime when it is up (its catalogs carry the templates per locale)
			// and falls back to the English template before the runtime has booted.
			function formatCounts(key, fallback, vars) {
				const i18n = window.threewsI18n;
				const localized = i18n ? i18n.t(key, vars) : null;
				const template = localized && localized !== key ? localized : fallback;
				return template.replace(/\{\{\s*(\w+)\s*\}\}/g, (m, k) => (k in vars ? String(vars[k]) : m));
			}

			function isChapter(section) {
				// Same rule the engine's buildPlaylist uses: the onboarding walkthrough
				// is its own track, never a chapter of the site tour.
				return section && section.id !== ONBOARDING_SECTION;
			}

			function renderCurriculum(c) {
				const tracks = {};
				(c.tracks || []).forEach((t) => (tracks[t.id] = t));
				const stops = (c.stops || []).filter((s) => s.section !== ONBOARDING_SECTION);
				const chapters = (c.sections || []).filter(isChapter);
				const full = tracks.full || { stopCount: stops.length, estimatedMinutes: c.estimatedMinutes };

				const stats = document.getElementById('tour-stats');
				stats.hidden = false;
				stats.removeAttribute('aria-busy');
				document.getElementById('stat-features').textContent = full.stopCount || stops.length;
				document.getElementById('stat-minutes').textContent = '~' + (full.estimatedMinutes || c.estimatedMinutes);
				document.getElementById('stat-chapters').textContent = chapters.length;

				const quickMeta = document.getElementById('track-quick-meta');
				if (tracks.quick && quickMeta) {
					quickMeta.textContent = formatCounts('tour.quick_track_counts', '{{count}} picks · ~{{minutes}} min', {
						count: tracks.quick.stopCount,
						minutes: tracks.quick.estimatedMinutes,
					});
					quickMeta.setAttribute('data-i18n-owned', '1');
				}
				const fullMeta = document.getElementById('track-full-meta');
				if (tracks.full && fullMeta) {
					fullMeta.textContent = formatCounts('tour.full_track_counts', '{{count}} features · ~{{minutes}} min', {
						count: tracks.full.stopCount,
						minutes: tracks.full.estimatedMinutes,
					});
					fullMeta.setAttribute('data-i18n-owned', '1');
				}

				const counts = {};
				stops.forEach((s) => (counts[s.section] = (counts[s.section] || 0) + 1));
				const host = document.getElementById('tour-chapters');
				host.innerHTML = '';
				host.removeAttribute('aria-busy');
				chapters.forEach((section, i) => {
					const n = counts[section.id] || 0;
					const card = document.createElement('div');
					card.className = 'tour-chapter';
					card.innerHTML =
						'<div class="tour-chapter__num">' + (i + 1) + '</div>' +
						'<div class="tour-chapter__body"><h3>' + escapeHtml(section.title) +
						' <span class="tour-chapter__count">· ' + n + ' stops</span></h3>' +
						'<p>' + escapeHtml(CHAPTER_BLURB[section.id] || section.intro || '') + '</p></div>';
					host.appendChild(card);
				});
			}

			function renderCurriculumError() {
				const stats = document.getElementById('tour-stats');
				stats.hidden = true;
				const host = document.getElementById('tour-chapters');
				host.removeAttribute('aria-busy');
				host.innerHTML = '';
				const card = document.createElement('div');
				card.className = 'tour-chapters__error';
				card.setAttribute('role', 'alert');
				card.innerHTML =
					'<p><strong>The chapter list did not load.</strong>' +
					'The tour outline could not be fetched, so chapter and feature counts are unavailable right now. ' +
					'The guided tour itself still starts from the buttons above.</p>' +
					'<button type="button" class="tour-btn" id="tour-chapters-retry">Try again</button>';
				host.appendChild(card);
				document.getElementById('tour-chapters-retry').addEventListener('click', () => {
					host.setAttribute('aria-busy', 'true');
					host.innerHTML = '';
					loadCurriculum('no-cache');
				});
			}

			function loadCurriculum(cache) {
				fetch('/tour/curriculum.json', { cache: cache || 'force-cache' })
					.then((r) => {
						if (!r.ok) throw new Error('tour curriculum ' + r.status);
						return r.json();
					})
					.then((c) => {
						if (!c || !Array.isArray(c.stops) || !c.stops.length) throw new Error('tour curriculum empty');
						curriculum = c;
						renderCurriculum(c);
					})
					.catch(renderCurriculumError);
			}
			loadCurriculum();

			// A locale switch re-translates the annotated copy but skips the owned
			// count spans, so re-format those with the new locale's templates.
			window.addEventListener('i18n:change', () => {
				if (curriculum) renderCurriculum(curriculum);
			});

			function escapeHtml(s) {
				return String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({
					'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;',
				})[c]);
			}
		</script>

		<div id="footer-container"></div>
		<script src="/footer.js"></script>
		<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
	<script type="module" src="/i18n.js"></script>
</body>
</html>