/* ============================================================
   AltxDesign — the 404 page, "Backstage" (404.html only)
   Loaded on this page only, after css/style.css (tokens, Urbanist and its fallback,
   .sr-only). The page is dark: the site's near-black and cream. The playful orange
   is an accent here and nowhere else on the site: hover and focus, and the scene.

   Three states:
     no data-room   "lights off", the page without JavaScript (also if the scene doesn't
                    start within 4 s): a still of the dark room and a caption. CSS only.
     wide           (set by js/notfound.js) desktop, laptop, landscape tablet: the scene
                    fills the screen, logo and bottom bar sit over its dark margins
     tall           (set by js/notfound.js) phones and narrow screens: logo row, scene,
                    caption, bottom bar
   ============================================================ */

.nf{
  --nf-quiet:#B8B1A6;                  /* hint and secondary text: 9.9:1 on near-black */
  --nf-line:rgba(245,241,231,.3);      /* outlines of the round icons and the links */
  --nf-accent:#FF8A5B;                 /* the playful orange, accents only */
}
html.nf,.nf body{background:var(--near);color:var(--cream)}
.nf body{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
.nf a:focus-visible,.nf button:focus-visible{outline-color:var(--nf-accent)}

/* ---------- logo (the site's own, linking home) ---------- */
.nf-top{flex:0 0 auto;display:flex;align-items:center;padding:6px 22px 0}
.nf-logo{display:flex;align-items:center;min-height:44px;padding-inline:4px;margin-inline:-4px;color:var(--cream)}
.nf-logo svg{display:block;height:25px;width:auto;fill:currentColor}

/* ---------- the stage ---------- */
.nf-stage{position:relative;flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center}

/* ---------- "lights off": the page without JavaScript ----------
   a still of the dark room (tools/notfound-stills.mjs renders it from the scene's own
   drawing code) with the heading on its wall screen, the doors as links, and a
   text-adventure caption under it. no JavaScript: the room is picked here, wide from
   960 x 600 like the live page, and --s scales the picture in whole or half steps so its
   pixels stay square, small enough on desktops to leave room for the caption. */
.nf-plain{--s:2;display:flex;flex-direction:column;align-items:center;gap:18px;width:100%;padding:8px 16px 16px}
/* with JavaScript the scene takes over, so this waits up to 4 s instead of flashing; if
   the scene hasn't started by then, js/notfound.js lets it stay (Navin, 11 Nov).
   without JavaScript the class isn't set and it shows at once. */
.nf-js .nf-plain{animation:nf-wait 0s 4s both}
@keyframes nf-wait{from{visibility:hidden}to{visibility:visible}}
.nf-still{position:relative;flex:0 0 auto;width:calc(180px * var(--s));height:calc(416px * var(--s))}
.nf-still img{display:block;width:100%;height:100%;image-rendering:crisp-edges;image-rendering:pixelated}
/* real text over the picture, laid out in its own pixels and scaled with it */
.nf-still__ov{position:absolute;left:0;top:0;width:180px;height:416px;transform-origin:0 0;transform:scale(var(--s));
  font-family:'Pixelify Sans',ui-monospace,monospace;line-height:1}
.nf-still__ov > *{position:absolute}
.nf-title{margin:0;font-family:'Pixelify Sans',ui-monospace,monospace;font-weight:600;color:var(--cream)}
.nf-still .nf-title{left:16px;top:13px;width:102px;font-size:14px;line-height:15px}
.nf-still .nf-404{left:146px;top:11px;width:21px;font-size:7px}
.nf-still .nf-door{top:100px}
.nf-still [data-door="0"]{left:8px}
.nf-still [data-door="1"]{left:40px}
.nf-still [data-door="2"]{left:143px}
.nf-still .nf-door:hover .nf-plate,.nf-still .nf-door:active .nf-plate{background:#FF4A1C;color:var(--near)}
/* the caption, as a text adventure */
.nf-adv{width:calc(180px * var(--s));max-width:100%;font-family:'Pixelify Sans',ui-monospace,monospace;font-size:15px;line-height:1.45;color:var(--cream)}
.nf-adv noscript{display:block}
.nf-adv > * + *{margin-top:10px}
.nf-adv a{color:var(--nf-accent);text-decoration:underline;text-underline-offset:3px}
@media (max-width:359px){.nf-plain{--s:1.5}}
@media (min-width:540px){.nf-plain{--s:3}}
@media (min-width:960px) and (min-height:600px){
  .nf-plain{--s:1.5}
  .nf-still{width:calc(480px * var(--s));height:calc(300px * var(--s))}
  .nf-still__ov{width:480px;height:300px}
  .nf-still .nf-title{left:126px;top:34px;width:168px;font-size:19px;line-height:20px;letter-spacing:.01em}
  .nf-still .nf-404{left:336px;top:32px;width:24px;font-size:8px}
  .nf-still .nf-door{top:72px}
  .nf-still [data-door="0"]{left:38px}
  .nf-still [data-door="1"]{left:74px}
  .nf-still [data-door="2"]{left:398px}
  .nf-adv{width:calc(428px * var(--s));font-size:16px}   /* lined up with the room's floor */
}
@media (min-width:1040px) and (min-height:810px){.nf-plain{--s:2}}
@media (min-width:1280px) and (min-height:960px){.nf-plain{--s:2.5}}
@media (min-width:1520px) and (min-height:1110px){.nf-plain{--s:3}}
@media (min-width:1760px) and (min-height:1260px){.nf-plain{--s:3.5}}

/* ---------- caption (tall room) and bottom bar ---------- */
.nf-foot{flex:0 0 auto}
.nf-caption{display:none}
.nf-ico[hidden],.nf-hint[hidden]{display:none}   /* replay and the hint need the scene */
.nf-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px 18px;padding:0 20px 16px}
.nf-hint{font-size:15px;line-height:1.35;color:var(--nf-quiet)}
.nf-ico{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:44px;height:44px;padding:0;
  border-radius:50%;border:1px solid var(--nf-line);background:transparent;color:var(--cream);cursor:pointer;
  transition:color .2s,border-color .2s}
.nf-ico:hover,.nf-ico:focus-visible{border-color:var(--nf-accent);color:var(--nf-accent)}

/* ---------- wide room: the scene is the whole screen ---------- */
.nf[data-room] body{height:100vh;height:100dvh;overflow:hidden}
.nf[data-room="wide"] .nf-top{position:absolute;top:8px;left:22px;z-index:6;padding:0}
.nf[data-room="wide"] .nf-stage{position:absolute;inset:0}
.nf[data-room="wide"] .nf-foot{position:absolute;left:0;right:0;bottom:16px;z-index:5}
.nf[data-room="wide"] .nf-bar{padding:0 20px}

/* ---------- tall room: logo row, scene, caption, bar ---------- */
.nf[data-room="tall"] .nf-top{height:50px;padding:0 18px}
.nf[data-room="tall"] .nf-logo svg{height:21px}
.nf[data-room="tall"] .nf-foot{padding:8px 18px 12px;text-align:center}
/* the caption's height is reserved so nothing jumps when a line comes and goes */
.nf[data-room="tall"] .nf-caption{display:flex;align-items:center;justify-content:center;min-height:46px;margin:0 0 6px;
  font-size:16px;line-height:1.35}
.nf[data-room="tall"] .nf-caption.is-hush{color:var(--nf-quiet);font-style:italic}
.nf[data-room="tall"] .nf-bar{flex-wrap:nowrap;gap:12px;padding:0}
.nf[data-room="tall"] .nf-hint{font-size:14px;text-align:left}

/* ---------- the scene (both rooms) ----------
   the canvas is drawn at the room's own small size and scaled up whole, so pixels stay
   square. the text over it (wall screen, door signs, panel, bubbles) is real HTML in
   Pixelify Sans, laid out in the canvas's pixels and scaled with it. */
.nf-plain[hidden]{display:none}
.nf-scene{position:absolute;left:0;top:0}
.nf-scene canvas{position:absolute;inset:0;width:100%;height:100%;display:block;image-rendering:crisp-edges;image-rendering:pixelated}
.nf-ov{position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;
  font-family:'Pixelify Sans',ui-monospace,monospace;line-height:1;color:var(--cream)}
.nf-ov > *{position:absolute}
.nf-ov [hidden]{display:none}
.nf{--nf-soft:#CFC8BC;--nf-dim:#8A857C}   /* the scene's c and m */

/* the wall screen: "looking for", the message, or the meeting's agenda */
.nf-seek{font-size:7px;line-height:9px;color:var(--nf-quiet)}
.nf-agenda__h{font-weight:600}
.nf-agenda__i{font-size:7px;line-height:10px;color:var(--nf-dim)}
.nf-agenda__i.is-now{color:var(--nf-accent)}
.nf-ov .nf-title{font-family:inherit;font-weight:600;color:var(--cream)}
.nf-msg > *{pointer-events:auto}
.nf-msg p{font-size:7px;line-height:9px;color:var(--nf-soft)}
/* until the message is up, the heading is still read out, just not seen */
.nf-msg:not(.is-in){opacity:0}
.nf-msg:not(.is-in) p{visibility:hidden}
.nf-msg.is-in > *{animation:nf-rise 700ms steps(6) both}
.nf-msg.is-in > :nth-child(2){animation-delay:500ms}
.nf-msg.is-in > :nth-child(3){animation-delay:900ms}
@keyframes nf-rise{from{opacity:0}to{opacity:1}}
.nf-lnk{color:var(--nf-accent);text-decoration:underline}
/* rings inside the scene are drawn in its own pixels (1px here is 2-4px on screen) */
.nf .nf-lnk:focus-visible{outline:1px solid var(--nf-accent);outline-offset:1px}
.nf-blink{animation:nf-blink 1s steps(2) infinite}
@keyframes nf-blink{50%{opacity:0}}
.nf-404{text-align:right;color:var(--nf-accent)}

/* the doors: real links to Home, Work and Contact */
.nf-door{display:block;width:26px;height:60px;pointer-events:auto}
.nf .nf-door:focus-visible{outline:none}   /* the sign lights up and takes the ring instead */
.nf-plate{position:absolute;left:50%;top:0;transform:translateX(-50%);padding:2px 3px;background:var(--near);color:var(--cream);
  font-size:6px;white-space:nowrap}
.nf-door:focus-visible .nf-plate{background:#FF4A1C;color:var(--near);outline:1px solid var(--cream);outline-offset:1px}

/* the settings panel and its Human / Bot switch */
.nf-panel{color:var(--nf-quiet)}
.nf-panel > div{display:flex;justify-content:space-between}
.nf-hot{color:var(--nf-accent)}
.nf-switch{display:flex;align-items:center;justify-content:space-between;color:var(--nf-quiet)}
.nf-switch__opts{display:flex;gap:2px}
.nf-sw{padding:0;border:0;border-bottom:1px solid transparent;background:transparent;color:var(--nf-dim);font:inherit;cursor:pointer;pointer-events:auto}
.nf-sw[aria-pressed="true"]{color:var(--nf-accent);border-bottom-color:var(--nf-accent)}
.nf-sw[aria-pressed="false"]:hover{color:var(--cream)}
.nf .nf-sw:focus-visible{outline:1px solid var(--cream);outline-offset:1px}

/* speech bubbles; whispers are grey with a dashed edge */
.nf-bub{transform:translate(-50%,-100%);width:max-content;padding:3px 4px 4px;background:var(--cream);color:var(--near);
  border:1px solid var(--near);box-shadow:1px 1px 0 var(--near);font-size:7px;line-height:8px;opacity:0;transition:opacity 120ms linear}
.nf-bub.is-on{opacity:1}
.nf-bub.is-hush{color:var(--muted);border:1px dashed var(--nf-dim);box-shadow:none}

/* wide room sizes, from the prototype */
.nf[data-room="wide"] .nf-ov .nf-title{font-size:19px;line-height:20px;letter-spacing:.01em}
.nf[data-room="wide"] .nf-msg p{margin-top:5px}
.nf[data-room="wide"] .nf-msg p + p{margin-top:4px}
.nf[data-room="wide"] .nf-agenda__h{font-size:13px;line-height:14px}
.nf[data-room="wide"] .nf-agenda__h + p{margin-top:6px}
.nf[data-room="wide"] .nf-404{font-size:8px}
.nf[data-room="wide"] .nf-panel,.nf[data-room="wide"] .nf-switch{font-size:5.5px;line-height:6px}
.nf[data-room="wide"] .nf-panel > div + div{margin-top:3px}
.nf[data-room="wide"] .nf-sw{line-height:7px}
.nf[data-room="wide"] .nf-door:hover .nf-plate{background:#FF4A1C;color:var(--near)}
.nf[data-room="wide"] .nf-bub{max-width:118px}
.nf[data-room="wide"] .nf-bub.is-hush{font-size:6px}

/* tall room sizes, from the prototype. the room moves inside the stage (the camera),
   and dragging it is the stage's own gesture, so the browser mustn't scroll it */
.nf[data-room="tall"] .nf-stage{overflow:hidden;touch-action:none}
.nf[data-room="tall"] .nf-ov .nf-title{font-size:14px;line-height:15px;letter-spacing:normal}
.nf[data-room="tall"] .nf-msg p{margin-top:4px}
.nf[data-room="tall"] .nf-agenda__h{font-size:12px;line-height:13px}
.nf[data-room="tall"] .nf-agenda__h + p{margin-top:5px}
.nf[data-room="tall"] .nf-404{font-size:7px}
.nf[data-room="tall"] .nf-panel{font-size:6px;line-height:7px}
.nf[data-room="tall"] .nf-panel > div + div{margin-top:2px}
.nf[data-room="tall"] .nf-sw{position:relative;font-size:7px;line-height:9px}
/* the switch is about 26px tall on a phone: a 44px tap area round each half, unseen.
   --s is the room's scale, set by js/notfound-tall.js */
.nf[data-room="tall"] .nf-sw::before{content:'';position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:max(100%,calc(44px / var(--s,2)));height:calc(44px / var(--s,2))}
.nf[data-room="tall"] .nf-door:active .nf-plate{background:#FF4A1C;color:var(--near)}
/* and the same unseen 44px tap height for the "did you mean" link */
.nf[data-room="tall"] .nf-lnk{position:relative}
.nf[data-room="tall"] .nf-lnk::after{content:'';position:absolute;left:-2px;right:-2px;top:50%;transform:translateY(-50%);height:calc(44px / var(--s,2))}
.nf[data-room="tall"] .nf-bub{max-width:104px}

@media(prefers-reduced-motion:reduce){
  .nf-links a,.nf-ico{transition:none}
  .nf-msg.is-in > *,.nf-blink{animation:none}
}
