/* =========================================================
   Landing, first screen: a dark world to drive a robot through (world.js draws it with WebGL).
   Scrolling floods it; the field film comes up out of the water. main.js sets --q (0..1 through
   the section) and --flood, --rise, --surf, and the classes is-sunk, is-under, show-film, is-film.
   Without WebGL (.is-flat) the same scroll plays with CSS: water rises, the film is revealed.
   Type, buttons and cards are the site's own (eyebrow, display, card, btn), in their dark colours
   as the footer uses them; the green lives in the world itself, not in the interface.
   ========================================================= */
.xp {
  --xp-bg: #03070d; --xp-ink: #f2f4f8; --xp-mute: rgba(255, 255, 255, .62); --xp-line: rgba(255, 255, 255, .14);
  --xp-accent: #7fb0ff;
  --q: 0; --flood: 0; --rise: 0; --surf: 0;
  position: relative; height: 420vh; background: var(--xp-bg); color: var(--xp-ink);
}
.xp__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; isolation: isolate; outline: none; }
.xp .eyebrow { color: var(--xp-mute); }
.xp kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 4px;
  font: 600 11px/1 var(--sans); color: var(--xp-ink); background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  transition: background .15s, color .15s, box-shadow .15s;
}
.xp kbd.is-down { background: var(--blue); color: #fff; box-shadow: inset 0 0 0 1px var(--blue); }

/* ---- layers, back to front ---- */
.xp__backdrop { position: absolute; inset: 0; z-index: 0; background: radial-gradient(120% 90% at 70% 110%, #0b2034 0%, #050d18 45%, #03070d 78%); }
.xp__gl { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s; touch-action: pan-y; }
.xp.is-ready .xp__gl { opacity: 1; }
.xp__film { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.xp.is-film .xp__film { opacity: 1; }
.xp.is-film .xp__gl { visibility: hidden; }
.xp__water { display: none; }
/* legibility: darker behind the words and under the header */
.xp__shade {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, rgba(3, 7, 13, .55) 0%, transparent 18%), linear-gradient(90deg, rgba(3, 7, 13, .78) 0%, rgba(3, 7, 13, .35) 38%, transparent 60%);
  opacity: calc(1 - var(--surf));
}
.xp[data-mode="drive"] .xp__shade { background: linear-gradient(180deg, rgba(3, 7, 13, .5) 0%, transparent 20%), linear-gradient(0deg, rgba(3, 7, 13, .45) 0%, transparent 16%); }

/* ---- chapter one: the name, the line, the choice ---- */
.xp__one {
  position: absolute; z-index: 5; left: var(--gutter); top: 0; bottom: 0; width: min(46vw, 640px);
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--header-h) + 8px) 0 clamp(72px, 11vh, 112px);
  opacity: calc(1 - clamp(0, (var(--q) - .012) * 13, 1));
  transform: translate3d(0, calc(var(--q) * -55vh), 0);
}
.xp.is-under .xp__one { visibility: hidden; }
.xp[data-mode="drive"] .xp__one { opacity: 0; visibility: hidden; transform: translate3d(-40px, 0, 0); transition: opacity .45s, transform .7s var(--ease), visibility 0s .7s; }
/* scroll-driven values follow the scroll directly, with no second easing on top */
.xp[data-mode="select"] .xp__one { transition: none; }
.xp__title {
  margin: clamp(16px, 2.6vh, 26px) 0 clamp(18px, 3vh, 30px);
  font-family: var(--display); font-weight: 700; font-size: clamp(56px, 8.6vw, 164px); line-height: .9; letter-spacing: -.045em; text-transform: uppercase;
}
.xp__line { display: block; width: max-content; }
.xp__line + .xp__line { padding-left: .5em; }
.xp__quote { max-width: 28ch; font-size: clamp(18px, 1.5vw, 23px); line-height: 1.4; color: rgba(255, 255, 255, .82); }
.xp__pick { margin-top: clamp(28px, 5vh, 52px); }
.xp__pick-label { display: flex; align-items: center; gap: 10px; }
.xp__boot { display: none; }
.xp.is-booting .xp__boot { display: inline; }
.xp.is-booting .xp__if-gl { display: none; }
.xp__boot b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--xp-ink); }

/* the two robots, as the site's cards on dark */
.xp__bots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; max-width: 580px; }
.xp__bot {
  position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto auto auto auto; column-gap: 14px; align-content: start;
  padding: 14px 16px 16px 12px; border-radius: var(--radius); color: var(--xp-ink);
  background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px var(--xp-line);
  transition: background .35s, box-shadow .35s;
}
.xp__bot-img { grid-row: 1 / 5; align-self: center; width: 64px; aspect-ratio: 1; }
.xp__bot-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .8s var(--ease); }
.xp__bot-n { font-size: 12px; font-weight: 600; color: var(--xp-accent); }
.xp__bot-name { margin-top: 6px; font-family: var(--display); font-weight: 500; font-size: clamp(16px, 1.2vw, 19px); line-height: 1.2; letter-spacing: -.015em; }
.xp__bot-kind { margin-top: 4px; font-size: 13.5px; line-height: 1.4; color: var(--xp-mute); }
.xp__bot-go { display: inline-flex; gap: 8px; margin-top: 10px; font-size: 14px; font-weight: 600; }
.xp__bot-go i { font-style: normal; transition: transform .4s var(--ease); }
.xp__bot:hover, .xp__bot.is-hot, .xp__bot:focus-visible { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); }
.xp__bot:focus-visible { outline: 2px solid var(--xp-accent); outline-offset: 3px; }
.xp__bot:hover .xp__bot-img img, .xp__bot.is-hot .xp__bot-img img { transform: scale(1.06); }
.xp__bot:hover .xp__bot-go i, .xp__bot.is-hot .xp__bot-go i, .xp__bot:focus-visible .xp__bot-go i { transform: translateX(5px); }
.xp.is-booting .xp__bot { pointer-events: none; opacity: .55; }
.xp__hint { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 16px; font-size: 13px; color: var(--xp-mute); }
.xp__hint kbd:first-of-type { margin-left: 4px; }
.xp__hint kbd:nth-of-type(4) { margin-right: 4px; }
.xp__hint kbd:nth-of-type(5) { margin-left: 4px; }

/* ---- driving: name, speed, keys, and what else you can do ---- */
.xp__hud { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s; }
.xp[data-mode="drive"]:not(.is-sunk) .xp__hud { opacity: 1; visibility: visible; transition: opacity .6s .45s, visibility 0s; }
.xp__hud-top { position: absolute; left: var(--gutter); top: calc(var(--header-h) + 12px); display: grid; gap: 14px; }
.xp__hud-bot b { display: block; margin-top: 8px; font-family: var(--display); font-weight: 500; font-size: 20px; letter-spacing: -.015em; }
.xp__speed { display: flex; align-items: baseline; gap: 10px; font-family: var(--display); font-weight: 700; font-size: clamp(44px, 4.6vw, 68px); line-height: .9; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.xp__speed b { min-width: 1.6em; font-weight: 700; }
.xp__keys { position: absolute; left: var(--gutter); bottom: clamp(22px, 4vh, 36px); display: flex; align-items: flex-end; gap: 10px; }
.xp__pad { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(2, 30px); gap: 4px; }
.xp__pad kbd { width: 30px; height: 30px; }
.xp__pad kbd[data-k="up"] { grid-column: 2; grid-row: 1; }
.xp__pad kbd[data-k="left"] { grid-column: 1; grid-row: 2; }
.xp__pad kbd[data-k="down"] { grid-column: 2; grid-row: 2; }
.xp__pad kbd[data-k="right"] { grid-column: 3; grid-row: 2; }
.xp__space { height: 30px; min-width: 88px; margin-left: 8px; }
.xp__keys-t { font-size: 13px; line-height: 30px; color: var(--xp-mute); }
.xp__acts { position: absolute; right: var(--gutter); bottom: clamp(22px, 4vh, 36px); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; pointer-events: auto; }
.xp__acts button {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 9px 0 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--xp-ink); background: rgba(3, 7, 13, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
  transition: box-shadow .3s, background .3s;
}
.xp__acts button:hover { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px #fff; }

/* things found out there: the count under the speed, and a card for each find */
.xp__found b { font-weight: 600; color: var(--xp-ink); }
.xp__finds { position: absolute; left: 50%; bottom: clamp(96px, 14vh, 128px); width: min(440px, calc(100% - 2 * var(--gutter))); transform: translateX(-50%); }
.xp__find {
  position: relative; padding: 18px 48px 18px 20px; border-radius: var(--radius); color: var(--xp-ink);
  background: rgba(3, 7, 13, .82); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 2px 0 rgba(61, 255, 142, .6), 0 24px 60px -24px rgba(0, 0, 0, .7);
  opacity: 0; transform: translate3d(0, 16px, 0); transition: opacity .45s var(--e-out), transform .6s var(--e-out); pointer-events: auto;
}
.xp__find[hidden] { display: none; }
.xp__find.is-in { opacity: 1; transform: none; }
.xp__find-title { margin: 8px 0 6px; font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.2; letter-spacing: -.015em; }
.xp__find-text { font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, .74); }
.xp__find-link { display: inline-flex; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.xp__find-link i { font-style: normal; transition: transform .4s var(--ease); }
.xp__find-link:hover i { transform: translateX(5px); }
.xp__find-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--xp-mute); transition: background .3s, color .3s; }
.xp__find-x:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* touch: a thumbstick and a hop button instead of keys */
.xp__touch { display: none; }
.xp__joy { position: absolute; z-index: 7; left: calc(var(--gutter) + 6px); bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); width: 124px; height: 124px; border-radius: 50%; background: rgba(3, 7, 13, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); touch-action: none; pointer-events: auto; }
.xp__joy::before { content: ""; position: absolute; inset: 22%; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.xp__joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.xp__hop { position: absolute; z-index: 7; right: calc(var(--gutter) + 6px); bottom: calc(env(safe-area-inset-bottom, 0px) + 48px); width: 84px; height: 84px; border-radius: 50%; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--xp-ink); background: rgba(3, 7, 13, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); touch-action: none; pointer-events: auto; }
.xp__hop:active { background: var(--blue); box-shadow: none; }

/* ---- chapter two: over the dark water, then the film ---- */
.xp__two {
  position: absolute; z-index: 5; left: 0; right: 0; top: 17%; padding: 0 var(--gutter); text-align: center; pointer-events: none;
  opacity: min(clamp(0, (var(--q) - .47) * 14, 1), clamp(0, (.71 - var(--q)) * 14, 1));
  transform: translate3d(0, calc((var(--q) - .56) * -32vh), 0);
}
.xp__two-title { margin: 18px 0; font-family: var(--display); font-weight: 700; font-size: clamp(36px, 6vw, 100px); line-height: .96; letter-spacing: -.04em; text-transform: uppercase; }
.xp__two-lead { max-width: 44ch; margin: 0 auto; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.5; color: rgba(255, 255, 255, .78); }
.xp__film-cap {
  position: absolute; z-index: 5; left: var(--gutter); right: var(--gutter); bottom: clamp(28px, 6vh, 60px);
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px;
  opacity: clamp(0, (var(--q) - .88) * 12, 1); visibility: hidden;
}
.xp__film-cap::before { content: ""; position: absolute; z-index: -1; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); bottom: calc(-1 * clamp(28px, 6vh, 60px)); height: 300%; background: linear-gradient(0deg, rgba(3, 7, 13, .78), transparent); pointer-events: none; }
.xp.show-film .xp__film-cap { visibility: visible; }
.xp__film-title { margin-top: 10px; font-family: var(--display); font-weight: 700; font-size: clamp(24px, 2.8vw, 44px); line-height: 1; letter-spacing: -.035em; text-transform: uppercase; }
/* the site's button, light on the dark film */
.btn--light { background: #fff; color: var(--ink); }
.btn--light:hover { color: #fff; }
.xp__watch i { font-size: 11px; }
.xp__watch:hover i { transform: translateX(3px); }

/* ---- the scroll cue, as on the inner pages ---- */
.xp__cue {
  position: absolute; z-index: 5; right: var(--gutter); bottom: clamp(24px, 4vh, 36px); display: flex; align-items: center; gap: 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--xp-mute); pointer-events: none;
  opacity: calc(1 - clamp(0, (var(--q) - .01) * 14, 1));
}
.xp__cue .hero__scroll-line { background: rgba(255, 255, 255, .7); }
.xp[data-mode="drive"] .xp__cue { opacity: 0; }

/* ---- the film, full screen with sound ---- */
.filmbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: clamp(16px, 4vw, 56px); border: 0; background: rgba(3, 7, 13, .94); color: #fff; overflow: hidden; }
.filmbox[open] { display: grid; place-items: center; animation: xp-fade .4s var(--e-out); }
.filmbox::backdrop { background: transparent; }
.filmbox video { width: min(100%, calc((100vh - 2 * clamp(16px, 4vw, 56px)) * 16 / 9)); aspect-ratio: 16 / 9; height: auto; border-radius: var(--radius); background: #000; }
.filmbox__close { position: absolute; top: 16px; right: 16px; width: 48px; height: 48px; border-radius: 50%; font-size: 24px; background: #1d1d21; transition: background .3s, transform .5s var(--e-spring); }
.filmbox__close:hover { background: var(--blue); transform: rotate(90deg); }
@keyframes xp-fade { from { opacity: 0; } }

/* ---- the header over the dark world ---- */
.site-header.is-dark { color: #fff; }
.site-header.is-dark .pill { background: #fff; color: var(--ink); }
.site-header.is-dark.is-solid { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* while driving with the keys the pointer gets out of the way */
body.xp-keys .cursor, body.xp-keys .cursor-dot { opacity: 0; }

/* ---- the line after the world ---- */
.lede__eyebrow { margin-bottom: 18px; }

/* ---- no WebGL (or three.js couldn't load): the same scroll, done with CSS ---- */
.xp.is-flat .xp__gl { display: none; }
.xp.is-flat .xp__water {
  display: block; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(190, 220, 255, .55) 0, rgba(12, 30, 52, .96) 3px, #03070d 65%);
  transform: translate3d(0, calc((1 - var(--flood)) * 102%), 0);
}
.xp.is-flat .xp__film { z-index: 3; opacity: 1; clip-path: inset(0 0 calc((1 - var(--surf)) * 100%) 0); }
.xp.is-flat .xp__hint, .xp.is-flat .xp__if-gl { display: none; }
.xp:not(.is-flat) .xp__if-flat { display: none; }

@media (max-width: 760px) {
  .xp__one { right: var(--gutter); width: auto; justify-content: flex-start; padding-bottom: clamp(60px, 9vh, 84px); }
  .xp__title { font-size: clamp(50px, 16vw, 96px); margin-top: 12px; }
  .xp__quote { font-size: 17px; max-width: 24ch; }
  .xp__pick { margin-top: auto; }
  .xp__bots { gap: 8px; }
  .xp__bot { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 14px; }
  .xp__bot-img { grid-row: auto; position: absolute; right: 8px; top: 8px; width: 48px; }
  .xp__bot-name { padding-right: 44px; font-size: 15px; }
  .xp__bot-kind { font-size: 12.5px; }
  .xp__hint { display: none; }
  .xp__shade { background: linear-gradient(180deg, rgba(3, 7, 13, .72) 0%, rgba(3, 7, 13, .2) 38%, transparent 50%, rgba(3, 7, 13, .7) 76%); }
  .xp__cue { display: none; }
  .xp__hud-top { top: calc(var(--header-h) + 4px); }
  .xp__acts { top: calc(var(--header-h) + 8px); bottom: auto; flex-direction: column; align-items: flex-end; }
  .xp__acts button { height: 34px; font-size: 13px; padding: 0 14px; }
  .xp__acts kbd { display: none; }
  .xp__two { top: 14%; }
  .xp__finds { bottom: calc(env(safe-area-inset-bottom, 0px) + 172px); }   /* above the thumbstick, clear of the view ahead */
  .xp__find { padding: 14px 42px 14px 16px; }
  .xp__find-title { margin: 6px 0 4px; font-size: 17px; }
  .xp__find-text { font-size: 13px; }
  .xp__find-link { margin-top: 8px; }
  .xp__film-cap { align-items: flex-start; flex-direction: column; }
}
@media (hover: none), (pointer: coarse) {
  .xp__keys, .xp__hint, .xp__acts kbd { display: none; }
  .xp__acts button { padding: 0 16px; }
  .xp.is-gl[data-mode="drive"]:not(.is-sunk) .xp__touch { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .xp *, .xp *::before, .xp *::after { animation: none !important; transition: none !important; }
}
