/* ============================================================
   AltxDesign — the Captain Navo page
   (captain-navo.html · js/captain-navo.js · js/captain-navo-ship.js)

   The alter ego's own page (Navin, 18 Nov). Built from the approved prototype in
   altx-captain-navo-handoff/ (code/page.css), on top of css/style.css for the tokens, the
   reset, focus rings and the site's button. Its own minimal top bar, no site header or
   footer. The page is near-black (--space) with the moving starfield behind everything;
   the text is the site's cream.

   The game's on-screen text is VT323, a pixel font: an approved exception to the site's
   no-monospace rule, as on the 404 page. The game keeps its own palette (the crew's
   colours, the alarm red) inside the canvas and its boxes.

   Touch screens, and any window under 760px: the direction pad and the round action
   button show, and the dialogue box moves under the canvas. Every touch target is at
   least 44px.

   The jump in from About and back home (Navin, 18 Nov) is near the end: "the arrival"
   and "the way home".
   ============================================================ */

/* the stars paint over the page's own background, so it sits on <html>, not <body> */
html{background:var(--space)}
body.nv{background:none;color:var(--cream);line-height:1.5}
.nv{
  --nv-mut:#B8B1A6;                    /* the rank line and the game's intro */
  --nv-dim:#8A857C;                    /* labels, the keys line, the footer: 5.4:1 on --space */
  --nv-line:rgba(245,241,231,.2);
  --nv-pixel:'VT323',ui-monospace,monospace;
}
.nv-stars{position:fixed;inset:0;z-index:-1;display:block;width:100%;height:100%}
.nv-wrap{max-width:1120px;margin:0 auto;padding:0 24px}

/* ---------- the top bar: logo, sound, Beam me back ---------- */
.nv-bar{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:22px 0;font-weight:600}
.nv-logo{display:flex;align-items:center;min-height:44px;padding-inline:4px;margin-inline:-4px;color:var(--cream)}
.nv-logo__svg{display:block;height:25px;width:auto;fill:currentColor}
.nv-bar__end{display:flex;align-items:center;gap:16px}
.nv-snd{min-height:44px;padding:8px 14px;border:1px solid rgba(245,241,231,.35);border-radius:999px;background:none;color:inherit;
  font:600 15px var(--font);cursor:pointer;transition:border-color .2s ease}
html:not(.nv-js) .nv-snd{visibility:hidden}   /* no scripts, no sound: no button that does nothing */
.nv-home{display:inline-flex;align-items:center;min-height:44px;font-size:15px;font-weight:600;
  text-decoration:underline 1px rgba(245,241,231,.35);text-underline-offset:6px;transition:text-decoration-color .2s ease}
@media(hover:hover){
  .nv-snd:hover{border-color:var(--cream)}
  .nv-home:hover{text-decoration-color:currentColor}
}

/* ---------- the bio: portrait left, words right ---------- */
.nv-bio{display:grid;grid-template-columns:5fr 6fr;gap:56px;align-items:center;padding:56px 0 72px}
.nv-bio__pic{position:relative;overflow:hidden;border-radius:18px}
.nv-bio__img{display:block;width:100%;height:auto;aspect-ratio:4/5;object-fit:cover;object-position:50% 30%}

/* ---------- "Beam me back" on the picture (altx-ego-handoff, 22 Nov 2026) ----------
   The way back sits where the way in was found: the bottom right corner of the picture, with
   the same X and the same ripples as on About's founder portrait (.ego, below; css/page-about.css).
   The label is the site's small button on dark (.cta--sm: near-black pill, cream text) and is
   part of the link. As on every button on the site, orange only marks "this one": on hover or
   focus the X turns orange, turns and grows, and the ripples speed up; the pill presses on
   click. It plays the way home like the top bar's link (js/captain-navo-jump.js). */
.nv-back{position:absolute;right:46px;bottom:46px;display:flex;align-items:center;gap:30px;border-radius:999px;-webkit-tap-highlight-color:transparent}
.nv-back__t{display:inline-flex;align-items:center;padding:14px 18px;border-radius:999px;background:var(--near);color:var(--cream);
  font-size:14px;font-weight:600;line-height:1.1;letter-spacing:.005em;white-space:nowrap;transition:transform .2s}
.nv-back:active .nv-back__t{transform:scale(.98)}
.nv-back:focus-visible{outline:2px solid var(--ring);outline-offset:4px}
/* the X and its ripples: the same rules as on About */
.ego{position:absolute;right:46px;bottom:46px;width:36px;height:36px}
.ego svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.ego__x path{fill:var(--cream);transition:fill .3s ease}
.ego__x{animation:egoX 7.8s var(--ease-io) infinite;transition:transform .7s var(--ease-out)}
.ego__ping path{fill:none;stroke:var(--cream);stroke-width:1.5px;vector-effect:non-scaling-stroke}
.ego__ping{opacity:0;animation:egoPing 2.6s cubic-bezier(.2,.6,.3,1) infinite}
.ego__ping:nth-child(2){animation-delay:.87s}
.ego__ping:nth-child(3){animation-delay:1.73s}
@keyframes egoPing{0%{transform:scale(1);opacity:.9}100%{transform:scale(3.4);opacity:0}}
@keyframes egoX{0%,70%{transform:none}82%,100%{transform:rotate(90deg)}}
.nv-back .ego{position:relative;right:auto;bottom:auto;flex:none}
.nv-back:focus-visible .ego__x path{fill:var(--orange)}
.nv-back:focus-visible .ego__x{animation:none;transform:rotate(180deg) scale(1.25)}
.nv-back:focus-visible .ego__ping{animation-duration:1.3s}
.nv-back:focus-visible .ego__ping:nth-child(2){animation-delay:.43s}
.nv-back:focus-visible .ego__ping:nth-child(3){animation-delay:.87s}
@media(hover:hover){
  .nv-back:hover .ego__x path{fill:var(--orange)}
  .nv-back:hover .ego__x{animation:none;transform:rotate(180deg) scale(1.25)}
  .nv-back:hover .ego__ping{animation-duration:1.3s}
  .nv-back:hover .ego__ping:nth-child(2){animation-delay:.43s}
  .nv-back:hover .ego__ping:nth-child(3){animation-delay:.87s}
}
@media(max-width:900px){
  .ego{right:38px;bottom:38px;width:32px;height:32px}
  .nv-back{right:38px;bottom:38px;gap:26px}
}
@media(prefers-reduced-motion:reduce){
  .ego__x,.ego__ping{animation:none;transition:none}
  /* one still outline stays, so the X still reads as something to press */
  .ego__ping:first-child{opacity:.45;transform:scale(1.8)}
}
.nv h1{font-size:clamp(44px,7vw,88px);font-weight:800;letter-spacing:-.045em;line-height:.95}
/* each word of the name in its own window, for the arrival: padded so no letter is cut,
   the padding taken back by the margins so the line sits exactly where it would */
.nv-w{display:inline-block;overflow:hidden;vertical-align:top;padding:.1em .08em .2em;margin:-.1em -.08em -.2em}
.nv-w > span{display:inline-block}
.nv-rank{margin-top:18px;font-size:19px;color:var(--nv-mut)}
.nv-t{max-width:520px;margin-top:22px;font-size:19px}
.nv-facts{margin-top:28px;border-top:1px solid var(--nv-line)}
.nv-facts div{display:grid;grid-template-columns:150px 1fr;gap:16px;padding:13px 0;border-bottom:1px solid var(--nv-line);font-size:16px}
.nv-facts dt{color:var(--nv-dim)}
/* "Take the bridge": the site's button on dark (.cta--cream), down to the game */
.nv-go{margin-top:30px}

/* ---------- the game ---------- */
.nv-game{padding:24px 0 80px}
.nv h2{font-size:clamp(32px,4.4vw,56px);font-weight:800;letter-spacing:-.04em;line-height:1}
.nv-ctr{text-align:center;margin-inline:auto}
.nv-sub{max-width:640px;margin-top:12px;font-size:18px;color:var(--nv-mut)}
.nv-frame{position:relative;margin-top:28px;overflow:hidden;border:1px solid rgba(245,241,231,.14);border-radius:18px;background:#0b0d14}
/* the canvas takes the keys; its focus ring goes round the frame, which clips anything
   drawn outside the canvas */
.nv-frame:has(#cv:focus-visible){outline:2px solid var(--ring);outline-offset:3px}
#cv{display:block;width:100%;height:auto;image-rendering:pixelated;outline:none}
#hud{position:absolute;left:12px;top:10px;padding:6px 10px;border-radius:6px;background:rgba(8,8,11,.78);font:20px/1 var(--nv-pixel)}
#hud.hot{background:#e5484d;color:#fff}
#hint{position:absolute;right:12px;top:10px;padding:6px 10px;border-radius:6px;background:var(--orange);color:var(--near);font:20px/1 var(--nv-pixel)}
#dlg{position:absolute;left:12px;right:12px;bottom:12px;padding:14px 18px 16px;border:2px solid var(--cream);border-radius:10px;
  background:rgba(8,8,11,.94);font:24px/1.15 var(--nv-pixel);cursor:pointer}
#who{margin-bottom:4px;font-size:20px;color:#FF8A5B}
#who[data-w="COMPUTER"]{color:#3fd0c9}
#who[data-w="SCAN"]{color:#f2c14e}
#who[data-w="ENSIGN PIP"]{color:#6fd08c}
#dlg small{display:block;margin-top:6px;font-size:16px;color:var(--nv-dim)}
#choices{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
#choices button,.nv-ctl button{min-height:44px;padding:10px 14px;border:0;border-radius:8px;background:var(--cream);color:var(--near);
  font:22px/1 var(--nv-pixel);cursor:pointer}
#title,#end{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;
  background:rgba(8,8,11,.9);text-align:center}
#title[hidden],#end[hidden],#dlg[hidden],#hint[hidden],#choices[hidden]{display:none}
#title b,#end b{font:48px/1 var(--nv-pixel);color:var(--cream)}
#title span,#end span{max-width:520px;margin:12px 0 20px;font:22px/1.2 var(--nv-pixel);color:var(--nv-mut)}
#end #endN{margin-top:0;font-size:18px}
#start,#again{min-height:48px;padding:12px 22px;border:0;border-radius:10px;background:var(--orange);color:var(--near);
  font:26px/1 var(--nv-pixel);cursor:pointer}

/* the touch controls: a direction pad (52px keys) and the round action button (96px) */
.nv-ctl{display:none;justify-content:space-between;align-items:center;margin-top:14px}
.nv-pad{display:grid;grid-template-columns:repeat(3,52px);grid-template-rows:repeat(3,52px);gap:4px}
.nv-pad button{padding:0;touch-action:none;-webkit-user-select:none;user-select:none}
.nv-ctl #actb{width:96px;height:96px;border-radius:50%;background:var(--orange);font-size:26px}
.nv-keys{margin-top:14px;font-size:15px;color:var(--nv-dim)}
@media (pointer:coarse),(max-width:760px){
  .nv-ctl{display:flex}
  .nv-keys{display:none}
  #dlg{position:static;min-height:118px;border-width:2px 0 0;border-radius:0}
}

/* ---------- the arrival (html.nv-arrive: the page opened, not reloaded, motion allowed) ----------
   About's "Alter ego" button jumps here at full speed (js/about.js). The stars come in as
   streaks and slow down into the starfield (.nv-warp, js/captain-navo-jump.js); as they
   settle, the page arrives: the portrait switches on like a screen (a bright line that opens
   into the picture), the name rises word by word, the top bar drops in, then the rest of
   the bio row by row. About 2.2 seconds, once. Fill-mode backwards only, so nothing is held
   after it has played (the button keeps its own press). */
.nv-warp{position:fixed;inset:0;z-index:-1;display:block;width:100%;height:100%;pointer-events:none}
.nv-arrive .nv-bio__img{animation:nvScreen 1s cubic-bezier(.5,0,.2,1) .55s backwards}
.nv-arrive .nv-w > span{animation:nvWord .9s var(--ease-out) .76s backwards}
.nv-arrive .nv-w + .nv-w > span{animation-delay:.84s}
.nv-arrive .nv-bar{animation:nvDrop .8s var(--ease-out) .95s backwards}
.nv-arrive .nv-rank{animation:nvRise .8s var(--ease-out) .98s backwards}
.nv-arrive .nv-t{animation:nvRise .8s var(--ease-out) 1.04s backwards}
.nv-arrive .nv-facts{animation:nvFade .5s ease 1.08s backwards}
.nv-arrive .nv-facts > div{animation:nvRise .8s var(--ease-out) 1.1s backwards}
.nv-arrive .nv-facts > div:nth-child(2){animation-delay:1.15s}
.nv-arrive .nv-facts > div:nth-child(3){animation-delay:1.2s}
.nv-arrive .nv-facts > div:nth-child(4){animation-delay:1.25s}
.nv-arrive .nv-facts > div:nth-child(5){animation-delay:1.3s}
.nv-arrive .nv-go{animation:nvRise .8s var(--ease-out) 1.38s backwards}
.nv-arrive .nv-back{animation:nvRise .8s var(--ease-out) 1.45s backwards}   /* after the picture has switched on */
.nv-arrive .nv-game{animation:nvFade .9s ease 1.3s backwards}
@keyframes nvScreen{
  0%{clip-path:inset(calc(50% - 1px) 50% calc(50% - 1px) 50% round 2px);filter:brightness(4) saturate(0)}
  24%{clip-path:inset(calc(50% - 1px) 0 calc(50% - 1px) 0 round 2px);filter:brightness(4) saturate(0)}
  100%{clip-path:inset(0 round 18px);filter:brightness(1) saturate(1)}
}
@keyframes nvWord{from{transform:translateY(125%)}}
@keyframes nvDrop{from{opacity:0;transform:translateY(-12px)}}
@keyframes nvRise{from{opacity:0;transform:translateY(18px)}}
@keyframes nvFade{from{opacity:0}}

/* ---------- the way home ("Beam me back", html.nv-leaving) ----------
   the arrival backwards (js/captain-navo-jump.js): the page fades back, the stars speed up
   into streaks again, an orange dot appears where they come from and opens into a cream
   window, the About page's colour, that fills the screen before About loads. Under a
   second. The window is drawn above everything and takes the clicks while it plays. */
.nv-leaving .nv-wrap{opacity:0;pointer-events:none;transition:opacity .3s ease}
.nv-out{position:fixed;inset:0;z-index:300;cursor:progress}
.nv-out__rim,.nv-out__home{position:absolute;inset:0;clip-path:circle(0 at 50% 50%)}
.nv-out__rim{background:var(--orange)}
.nv-out__home{background:var(--cream)}

/* ---------- the footer line ---------- */
.nv-foot{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 24px;padding:22px 0 40px;
  border-top:1px solid rgba(245,241,231,.16);font-size:14px;color:var(--nv-dim)}
.nv-foot .nv-home{font-size:14px;font-weight:400;text-decoration-color:currentColor;text-underline-offset:3px}

/* ---------- phones ---------- */
@media (max-width:760px){
  .nv-bio{grid-template-columns:1fr;gap:28px;padding:24px 0 48px}
  .nv-facts div{grid-template-columns:110px 1fr}
  #dlg{padding:10px 12px;font-size:19px}
  #hud,#hint{font-size:16px}
  #title b,#end b{font-size:34px}
  #title span,#end span{font-size:18px}
}
@media (max-width:420px){
  /* logo, sound and Beam me back share one line */
  .nv-logo__svg{height:21px}
  .nv-bar__end{gap:12px}
}
