Skip to content

3D engine that AI agents drive

7.9 KB
Raw Blame
/* The world loop hero: the headline on the left, the live stage in a rounded frame on the right, scene names under it.
   Everything that moves here is opacity or transform; no rules, no eyebrow labels, states lead with an icon. */
@property --scrim {
  syntax: '<number>';
  inherits: true;
  initial-value: 0.72;
}

.hero-loop {
  --surface-hover: var(--tint-strong);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --press: 140ms;
  --hover: 160ms;
  --scrim: 0.72;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  grid-template-areas: 'copy stage' 'copy bar';
  align-items: center;
  gap: 12px clamp(28px, 4vw, 56px);
  transition: --scrim 900ms ease;
}
/* On the home page the site header sits above the hero, so the hero fills what is left of the first screen. */
.site > .hero-loop { width: var(--page); margin: clamp(24px, 5vh, 56px) auto 0; }
/* The stage: the poster first, the live canvas fades in over it, then the poster leaves. */
.hero-loop .stage { position: relative; grid-area: stage; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 16px; background: var(--bg); box-shadow: 0 0 0 1px var(--line, transparent); }
.hero-loop .stage canvas, .hero-loop .stage .poster { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-loop .stage .poster { object-fit: cover; z-index: 1; transition: opacity 520ms ease 80ms; }
.hero-loop .stage canvas { z-index: 0; touch-action: pan-y; }
.hero-loop .stage[data-live='true'] .poster { opacity: 0; pointer-events: none; }
.hero-loop .stage-status { position: absolute; z-index: 2; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--surface); color: var(--text); font-size: 13px; }
.hero-loop .stage canvas.world { z-index: 0; }
.hero-loop .stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  pointer-events: none;
  background:
    linear-gradient(to top, rgb(23 22 26 / calc(var(--scrim) * 1.08)) 0%, transparent 52%),
    linear-gradient(to right, rgb(23 22 26 / var(--scrim)) 0%, rgb(23 22 26 / calc(var(--scrim) * 0.5)) 38%, transparent 68%);
}
.hero-loop .copy { grid-area: copy; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero-loop .copy h1 { font-size: clamp(40px, 5vw, 72px); }
.hero-loop .copy .lede { max-width: 34ch; color: var(--muted); font-size: clamp(16px, 1.5vw, 19px); line-height: 1.5; }
.hero-loop .copy .rename-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; animation: rise 700ms var(--ease-out) 330ms backwards; }
.hero-loop .copy .rename-note a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: color var(--hover) ease; }
.hero-loop .copy .rename-note a:hover, .hero-loop .copy .rename-note a:focus-visible { color: var(--text); }
.hero-loop .copy .rename-note code { font: inherit; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.hero-loop .copy .lede, .hero-loop .copy h1, .hero-loop .copy .hero-actions { animation: rise 700ms var(--ease-out) backwards; }
.hero-loop .copy .lede { animation-delay: 190ms; }
.hero-loop .copy .hero-actions { animation-delay: 260ms; }
.hero-loop .copy h1 { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.scene-bar { grid-area: bar; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }
.scene-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.hero-loop .scene-tab, .hero-loop .play-live { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color var(--hover) ease, color var(--hover) ease, transform var(--press) var(--ease-out); }
.hero-loop .scene-tab svg, .hero-loop .play-live svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hero-loop .scene-tab:active, .hero-loop .play-live:active { transform: scale(0.97); }
.hero-loop .scene-tab[aria-current='true'] { background: var(--tint-strong); color: var(--text); }
.ring-track { stroke: currentColor; opacity: 0.3; }
.ring-fill { stroke: currentColor; transform: rotate(-90deg); transform-origin: 50% 50%; opacity: 0; }
.ring-dot { fill: currentColor; stroke: none; opacity: 0.6; }
.hero-loop .scene-tab[data-state='playing'] .ring-fill { opacity: 1; }
.hero-loop .scene-tab[data-state='playing'] .ring-dot { opacity: 1; }
.hero-loop .scene-tab[data-state='loading'] .ring-track { stroke-dasharray: 3 4; animation: ring-turn 1.4s linear infinite; transform-origin: 50% 50%; }
@keyframes ring-turn { to { transform: rotate(360deg); } }
@media (hover: hover) and (pointer: fine) {
  .attribution a:hover { color: var(--text); }
  .hero-loop .scene-tab:hover, .hero-loop .play-live:hover:not(:disabled) { background: var(--tint); color: var(--text); }
}
.attribution[hidden], .hero-loop .play-live[hidden] { display: none; }
/* Credits: one small caption line right under the picture; it wraps where the width runs out. */
.attribution { flex-basis: 100%; order: -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; padding: 0 4px 2px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.attribution a { color: var(--muted); transition: color var(--hover) ease; }

/* Light path: no 3D is fetched until Play live 3D is pressed, so the poster drifts once, slowly (40 s, then rests: a light device does not animate for as long as the page is open) and the scene tabs wait. */
.hero-loop .play-live { grid-area: tabs; justify-self: start; }
.hero-loop .play-live .play-icon { fill: currentColor; stroke: none; }
.hero-loop .play-live .play-wait { display: none; stroke-dasharray: 3 4; transform-origin: 50% 50%; animation: ring-turn 1.4s linear infinite; }
.hero-loop .play-live[data-state='loading'] .play-icon { display: none; }
.hero-loop .play-live[data-state='loading'] .play-wait { display: block; }
html[data-hero-mode='poster'] .hero-loop .scene-tabs { display: none; }
html[data-hero-mode='poster'] .hero-loop .stage .poster { animation: poster-pan 40s ease-in-out both; }
.hero-loop .stage:focus { outline: none; }
@keyframes poster-pan {
  from { transform: scale(1.04) translate3d(-1.5%, 0.6%, 0); }
  to { transform: scale(1.12) translate3d(1.5%, -1.2%, 0); }
}

@media (max-width: 1180px) {
  .hero-loop .scene-tab span { display: none; }
  .hero-loop .scene-tab[aria-current='true'] span { display: inline; }
}
@media (max-width: 860px) {
  .hero-loop { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'stage' 'bar' 'copy'; gap: 8px; }
  .hero-loop .copy { margin-top: 20px; }
}
@media (max-width: 700px) {
  .hero-loop .stage { aspect-ratio: 4 / 3; border-radius: 12px; }
  .hero-loop .copy h1 { font-size: 40px; }
  .scene-bar { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'attribution' 'tabs'; align-items: center; gap: 0; }
  .attribution { grid-area: attribution; }
  .scene-tabs { grid-area: tabs; }
  .attribution { padding: 0 2px 4px; }
  .hero-loop .scene-tab { padding: 0 9px; }
  .hero-loop .play-live { padding: 0 12px 0 9px; }
  .hero-loop .scene-tab[aria-current='true'] { padding: 0 12px 0 9px; }
  .scene-tabs { justify-content: flex-start; }
  .hero-loop .scene-tab span { display: none; }
  .hero-loop .scene-tab[aria-current='true'] span { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-loop .scene-tab[data-state='loading'] .ring-track, .hero-loop .play-live .play-wait { animation: none; }
  html[data-hero-mode='poster'] .hero-loop .stage .poster { animation: none; }
  .hero-loop { transition: none; }
  .hero-loop .copy > * { animation: none; }
}