/* The console's surfaces.
 *
 * Lit like the reference cabins: one warm tungsten source above and slightly
 * behind the panel, cool phosphor coming off the glass, and everything else
 * falling into a deep blue-black. That is the whole material system, and
 * every rule below is one of three things —
 *
 *   BEVEL     a light top edge and a dark bottom edge, because a raised
 *             surface catches the lamp on its upper lip and shades its lower
 *   OCCLUSION a dark inset ring where a part meets its housing; without it
 *             components look printed on rather than set into
 *   BLOOM     a coloured glow around anything that emits, never around
 *             anything that only reflects
 *
 * Kept to plain CSS. No image ships, so the console stays quick over a phone
 * connection in someone else's building. */

:root {
  --ink:      #e9eef5;
  --ink-2:    #9fb0c4;
  --ink-3:    #64778d;

  --bg:       #05080d;
  --steel-1:  #1c2733;   /* lit face   */
  --steel-2:  #141d27;   /* body       */
  --steel-3:  #0c141c;   /* shaded     */
  --line:     #2b3a4a;
  --line-lit: #3d5266;

  --amber:    #e0a94a;   /* the tungsten lamp   */
  --amber-hi: #ffd89a;
  --phos:     #6ee7a8;   /* the glass           */
  --sky:      #38bdf8;
  --bad:      #ff6b5c;
  --ok:       #3ddc97;

  /* One lamp, declared once, reused by every bevel so the whole console is
     lit from the same direction. Change these two and the light moves. */
  --lit:      rgba(255, 226, 176, 0.16);
  --shade:    rgba(0, 0, 0, 0.55);

  --radius:   14px;
  --mono:     ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The spatial field sits behind everything, and behind a vignette so the
   controls always have a dark ground to sit on however bright it gets.
   (Still used by the lobby; the door now uses #stage below instead.) */
#field {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; display: block;
}
/* The door backdrop: a cross-fading slideshow of the renders in /bg. Sits
   exactly where #field did — z-0, under the vignette (z-1) and the door (z-2). */
#stage { position: fixed; inset: 0; z-index: 0; background: var(--bg); overflow: hidden; }
.slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  opacity: 0; transition: opacity 1.4s ease-in-out; will-change: opacity;
}
.slide.on { opacity: 1; }
body::after {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  /* A floor of dark even at the centre now. The door sits over photographic
     renders that can be bright, and the controls need a ground on every frame —
     not just the dim ones the constellation used to give. */
  background: radial-gradient(120% 85% at 50% 30%, rgba(3,6,10,.34) 0%, rgba(3,6,10,.80) 100%);
}
/* Named explicitly, NOT as body > *:not(#field).
 *
 * :not() carries the specificity of its argument, so `body > *:not(#field)`
 * scored (1,0,1) on the strength of the id inside it and beat `.rail`'s
 * (0,1,0) — which quietly dragged the fixed rail back into normal flow,
 * where it stood 1377px tall and shoved the entire lobby below the fold.
 * Nothing looked broken; the page had simply moved. */
.wrap, #door { position: relative; z-index: 2; }

a { color: var(--sky); }

/* ============================ the door ============================ */

.door-body { display: grid; place-items: center; min-height: 100dvh; }

#door {
  /* A fixed width, not a max-width. As a centred flex column the panel would
     otherwise grow to fit whichever message is longest — so the keypad
     visibly jumped sideways the moment "Card presented. Enter your code."
     appeared under it. Nothing about a door should move while you use it. */
  width: min(344px, 100%);
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center;
}

.brandlock { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.brandtick {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(160deg, #4fc9ff, #0c8ecf);
  color: #04121f;
  /* Lit top edge, occluded bottom — the mark is a raised chip, not a sticker. */
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 4px rgba(0,0,0,.35),
              0 4px 14px rgba(56,189,248,.30);
}
.brandlock b { display: block; font-weight: 700; font-size: 19px; letter-spacing: .3px; }
.brandlock i {
  display: block; font-style: normal; color: var(--ink-3);
  font-size: 12px; letter-spacing: 2.6px; text-transform: uppercase;
}

/* ---- the INTEGRATE wordmark ----
   White at rest; a scheduler in the door fires brief bursts (chromatic split,
   technicolor, slice-glitch, blur, turbulence-warp, pixel-mosaic) and blue
   energy orbs radiate from it. All decoration — prefers-reduced-motion at the
   end strips every burst back to a clean white wordmark. The base rule is
   .brandlock b.wordmark so it outweighs .brandlock b above. */
.brandlock { overflow: visible; }            /* let the orbs radiate past the lockup */
.brandlock b.wordmark {
  position: relative; display: inline-block;
  color: #fff; font-weight: 800; letter-spacing: 1.5px; white-space: nowrap;
  text-shadow: 0 0 1px rgba(255,255,255,.45);
  will-change: filter, transform;
}
.wordmark .ch { display: inline-block; }

/* two chromatic ghosts, drawn from the word itself — invisible until a burst */
.wordmark::before, .wordmark::after {
  content: attr(data-word);
  position: absolute; left: 0; top: 0;
  letter-spacing: inherit; font-weight: inherit;
  opacity: 0; pointer-events: none; mix-blend-mode: screen;
}
.wordmark.fx-rgb::before,  .wordmark.fx-glitch::before { color: #ff0044; opacity: .9; }
.wordmark.fx-rgb::after,   .wordmark.fx-glitch::after  { color: #00e5ff; opacity: .9; }
.wordmark.fx-rgb::before { transform: translateX(-2px); }
.wordmark.fx-rgb::after  { transform: translateX(2px); }

/* slice glitch / line-freeze: ghosts clipped to bands and jerked sideways */
.wordmark.fx-glitch::before { animation: wm-slice-a .42s steps(3) 1; }
.wordmark.fx-glitch::after  { animation: wm-slice-b .42s steps(3) 1; }
@keyframes wm-slice-a {
  0%   { clip-path: inset(0 0 72% 0);  transform: translateX(-7px); opacity: .95; }
  33%  { clip-path: inset(42% 0 30% 0); transform: translateX(6px); }
  66%  { clip-path: inset(76% 0 4% 0);  transform: translateX(-4px); }
  100% { clip-path: inset(0 0 100% 0);  transform: translateX(0); opacity: 0; }
}
@keyframes wm-slice-b {
  0%   { clip-path: inset(22% 0 52% 0); transform: translateX(7px); opacity: .95; }
  50%  { clip-path: inset(62% 0 10% 0); transform: translateX(-6px); }
  100% { clip-path: inset(0 0 100% 0);  transform: translateX(0); opacity: 0; }
}

.wordmark.fx-blur  { animation: wm-blur .42s ease-in-out 1; }
@keyframes wm-blur { 0%,100% { filter: blur(0); } 45% { filter: blur(4px); } 70% { filter: blur(1.5px); } }

.wordmark.fx-warp  { filter: url(#wm-distort); }
.wordmark.fx-pixel { filter: url(#wm-pixel); }

/* the blue energy orb */
.orb {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; pointer-events: none; z-index: 3; mix-blend-mode: screen;
  background: radial-gradient(circle, #eaf6ff 0%, #7cc4ff 34%, rgba(46,132,255,.4) 60%, rgba(30,110,255,0) 72%);
  box-shadow: 0 0 16px 5px rgba(96,182,255,.85), 0 0 34px 12px rgba(42,124,255,.5);
  animation: wm-orb 900ms cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes wm-orb {
  0%   { transform: scale(.15); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: scale(4.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark, .wordmark .ch { animation: none !important; filter: none !important; }
  .wordmark::before, .wordmark::after { display: none; }
  .orb { display: none; }
}

/* ---- the reader ---- */
.reader {
  width: 100%; display: flex; align-items: center; gap: 13px;
  padding: 12px 13px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--steel-1), var(--steel-3));
  border: 1px solid var(--line);
  border-top-color: var(--line-lit);
  box-shadow: inset 0 1px 0 var(--lit), 0 10px 26px rgba(0,0,0,.55);
}
.readled {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: #2b3a4c;
  /* Unlit LEDs are recessed and slightly wet-looking, never flat grey. */
  box-shadow: inset 0 1px 2px rgba(0,0,0,.8), inset 0 -1px 1px rgba(255,255,255,.10);
  transition: background .25s, box-shadow .25s;
}
.readled.on { background: var(--ok);  box-shadow: 0 0 16px var(--ok),  inset 0 0 3px rgba(255,255,255,.7); }
.readled.no { background: var(--bad); box-shadow: 0 0 16px var(--bad), inset 0 0 3px rgba(255,255,255,.7); }
.readtext { flex: 1; min-width: 0; }
.readcap { color: var(--ink-3); font-size: 10.5px; letter-spacing: 1.8px; text-transform: uppercase; }
#readsub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

.prox {
  width: 82px; height: 52px; flex: none; border: 0; cursor: pointer;
  border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(160deg, #eef3fa, #a9bbd0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -3px 6px rgba(0,0,0,.22),
              0 5px 13px rgba(0,0,0,.55);
  transition: background .25s, box-shadow .25s, transform .08s;
}
.prox:active { transform: translateY(1px); }
.prox.on {
  background: linear-gradient(160deg, #c4f7e0, #35d792);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 0 26px rgba(61,220,151,.6);
}
.prox svg { width: 46px; height: 22px; }

/* ---- the code ---- */
.pinbox {
  font-family: var(--mono); font-size: 26px; letter-spacing: 11px;
  height: 38px; line-height: 38px; margin-top: 16px;
  color: var(--phos); text-align: center; width: 100%;
  text-shadow: 0 0 12px rgba(110,231,168,.55);   /* phosphor blooms, metal does not */
}

.keypad {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; width: 100%; margin-top: 6px;
}
.keypad button {
  height: 60px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--mono); font-size: 23px; font-weight: 600;
  color: var(--ink);
  background: linear-gradient(180deg, var(--steel-1), var(--steel-2));
  border: 1px solid var(--line);
  border-top-color: var(--line-lit);
  box-shadow: inset 0 1px 0 var(--lit), 0 4px 10px rgba(0,0,0,.5);
  transition: transform .07s, box-shadow .07s, background .12s;
}
.keypad button:hover { background: linear-gradient(180deg, #22303e, var(--steel-2)); }
.keypad button:active {
  transform: translateY(2px);
  /* Pressed keys lose their lit edge and gain occlusion — that inversion is
     the whole reason a physical button reads as pressed. */
  box-shadow: inset 0 3px 7px rgba(0,0,0,.65);
  background: var(--steel-3);
}
.keypad button:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.keypad .fn   { font-size: 14px; color: var(--ink-3); letter-spacing: 1px; }
.keypad .hash { color: var(--amber); text-shadow: 0 0 10px rgba(224,169,74,.5); }

/* ---- the passphrase ---- */
.phrasebox { width: 100%; margin-top: 14px; }
.phrasebox label {
  display: block; font-size: 10.5px; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px;
}
.phrasebox input {
  width: 100%; padding: 13px; border-radius: 10px; color: var(--ink);
  font-size: 16px;                        /* under 16px and iOS zooms on focus */
  font-family: inherit;
  background: #070d14;
  border: 1px solid var(--line);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.7);   /* the field is a recess */
}
.phrasebox input:focus { outline: 2px solid var(--sky); outline-offset: 1px; }

.go {
  width: 100%; margin-top: 11px; padding: 13px; border: 0; border-radius: 10px;
  background: linear-gradient(180deg, #4fc9ff, #0c8ecf);
  color: #04121f; font: 600 16px/1 inherit; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 5px 16px rgba(56,189,248,.32);
}
.go:active { transform: translateY(1px); }

.doormsg {
  width: 100%; min-height: 22px; margin-top: 14px; font-size: 14px;
  color: var(--ink-2); text-align: center;
}
.doormsg.bad { color: var(--bad); }

.swap {
  margin-top: 14px; background: none; border: 0; cursor: pointer;
  color: var(--ink-3); font: inherit; font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px;
}
.swap:hover { color: var(--ink-2); }

/* ---- the background setting ---- */
.fieldset {
  margin-top: 26px; display: flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-3);
}
.fieldpick { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.fieldpick button {
  background: var(--steel-3); border: 0; cursor: pointer; color: var(--ink-3);
  font: inherit; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  padding: 7px 12px; border-right: 1px solid var(--line);
}
.fieldpick button:last-child { border-right: 0; }
.fieldpick button.on { background: var(--steel-1); color: var(--amber); text-shadow: 0 0 9px rgba(224,169,74,.55); }
.fieldpick button:disabled { opacity: .35; cursor: not-allowed; }

/* ============================ the lobby ============================ */

.wrap { max-width: 980px; margin: 0 auto; padding: 32px 20px 72px; }

.mark { display: flex; align-items: baseline; gap: 10px; }
.mark b { font-size: 20px; letter-spacing: .02em; font-weight: 650; }
.mark span { color: var(--ink-3); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }

.bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 26px;
}
.bar .sp { flex: 1; }
.bar .who { color: var(--ink-3); font-size: 13px; }
.bar a.out {
  color: var(--ink-2); font-size: 13px; text-decoration: none;
  border: 1px solid var(--line); border-top-color: var(--line-lit);
  padding: 7px 13px; border-radius: 9px;
  background: linear-gradient(180deg, var(--steel-1), var(--steel-2));
  box-shadow: inset 0 1px 0 var(--lit);
}
.bar a.out:hover { color: var(--ink); border-color: var(--sky); }

.grid { display: grid; gap: 15px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.proj {
  display: block; padding: 19px 19px 17px; border-radius: var(--radius);
  text-decoration: none; color: inherit;
  background: linear-gradient(180deg, rgba(28,39,51,.92), rgba(12,20,28,.92));
  border: 1px solid var(--line); border-top-color: var(--line-lit);
  box-shadow: inset 0 1px 0 var(--lit), 0 10px 28px rgba(0,0,0,.5);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.proj:hover {
  border-color: var(--sky); transform: translateY(-2px);
  box-shadow: inset 0 1px 0 var(--lit), 0 16px 34px rgba(0,0,0,.6), 0 0 22px rgba(56,189,248,.14);
}
.proj h2 { margin: 0 0 6px; font-size: 16.5px; font-weight: 620; }
.proj p { margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }
.proj .foot { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.proj .tag { border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; letter-spacing: .04em; }
.proj.missing { opacity: .45; pointer-events: none; }
.proj.missing .foot { color: var(--amber); }

.note { margin-top: 34px; color: var(--ink-3); font-size: 13px; line-height: 1.75; max-width: 68ch; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================ the rail ============================
   The whole estate at once, grouped by business line. It slides rather than
   appears: on a phone it IS the screen, so it has to be able to get out of
   the way, and the slide is what tells you where it went. */

.lobby-body { min-height: 100dvh; }

.rail {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
  width: 300px; max-width: 86vw;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(20,29,39,.97), rgba(8,13,19,.98));
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 40px rgba(0,0,0,.55);
  transform: translateX(-101%);          /* 101%, so the shadow clears too */
  transition: transform 260ms cubic-bezier(.4, .0, .2, 1);
  padding-top: env(safe-area-inset-top);
}
body.rail-open .rail { transform: translateX(0); }

.rail-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px; border-bottom: 1px solid var(--line);
}
.rail-head .mark { flex: 1; flex-direction: column; align-items: flex-start; gap: 0; }
.rail-head .mark b { font-size: 16px; }
.rail-head .mark span { font-size: 10px; }
.rail-close {
  background: none; border: 0; color: var(--ink-3); cursor: pointer;
  font-size: 26px; line-height: 1; padding: 0 4px;
}
.rail-close:hover { color: var(--ink); }

.rail-scroll { flex: 1; overflow-y: auto; padding: 6px 0 12px; -webkit-overflow-scrolling: touch; }

.rail-group { padding: 12px 16px 4px; }
.rail-group h2 {
  margin: 0; font-size: 11px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--amber); display: flex; align-items: center; gap: 8px;
  text-shadow: 0 0 10px rgba(224,169,74,.35);
}
.rail-n {
  font-size: 10px; letter-spacing: 0; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 7px;
}
.rail-blurb { margin: 5px 0 9px; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }

.rail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; margin: 0 -9px; border-radius: 8px;
  text-decoration: none; color: inherit;
}
.rail-item:hover { background: rgba(56,189,248,.10); }
.rail-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none; background: #2b3a4c;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.8);
}
.rail-dot.on { background: var(--ok); box-shadow: 0 0 9px var(--ok); }
.rail-t { min-width: 0; flex: 1; }
.rail-t b {
  display: block; font-size: 13.5px; font-weight: 560;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail-t span { display: block; font-size: 11px; color: var(--ink-3); }
.rail-item.off { opacity: .42; cursor: default; }

.rail-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}

.scrim {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(3,6,10,.66); backdrop-filter: blur(2px);
}

/* The button. Three bars that become an X, so it always says what it will do. */
.railbtn {
  width: 38px; height: 38px; flex: none; cursor: pointer;
  display: grid; align-content: center; gap: 4px; padding: 0 9px;
  border-radius: 9px; border: 1px solid var(--line); border-top-color: var(--line-lit);
  background: linear-gradient(180deg, var(--steel-1), var(--steel-2));
  box-shadow: inset 0 1px 0 var(--lit);
}
.railbtn span {
  display: block; height: 2px; border-radius: 2px; background: var(--ink-2);
  transition: transform 200ms, opacity 160ms;
}
.railbtn:hover span { background: var(--ink); }
body.rail-open .railbtn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.rail-open .railbtn span:nth-child(2) { opacity: 0; }
body.rail-open .railbtn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* On a wide screen the rail sits beside the page rather than over it. */
@media (min-width: 900px) {
  body.rail-open .wrap { margin-left: 300px; transition: margin-left 260ms cubic-bezier(.4,.0,.2,1); }
  .wrap { transition: margin-left 260ms cubic-bezier(.4,.0,.2,1); }
}

/* group headings on the page itself */
.ghead {
  margin: 30px 0 13px; font-size: 12px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--amber); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  text-shadow: 0 0 10px rgba(224,169,74,.3);
}
.ghead span {
  font-size: 12px; letter-spacing: 0; text-transform: none;
  color: var(--ink-3); text-shadow: none; font-weight: 400;
}
.proj h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 620; }
.pnote {
  margin: -6px 0 12px !important; font-size: 12px; color: var(--amber);
  border-left: 2px solid rgba(224,169,74,.45); padding-left: 9px;
}

/* ---- the door's second step ------------------------------------------------
   Same plate as the keypad, without the reader: at this point the card has
   already been presented and the only question left is the phone. */
.second { display: grid; gap: 12px; text-align: left; max-width: 380px; }
.second h2 { margin: 0; font-size: 20px; letter-spacing: .01em; }
.second p { margin: 0; color: #9db0c6; font-size: 14px; line-height: 1.5; }
.second .either { margin: 2px 0; }
.second .key { font: 600 17px/1.5 ui-monospace, Menlo, monospace; letter-spacing: .06em; color: #7fe3d4;
  background: #06121a; border: 1px solid #14384a; border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.second .otpauth { display: block; text-align: center; background: #12405f; border: 1px solid #1f6d9e;
  border-radius: 10px; padding: 11px; color: #cfeaff; text-decoration: none; font-weight: 600; }
.second .codein { font: 600 26px/1 ui-monospace, Menlo, monospace; letter-spacing: .28em; text-align: center;
  background: #06121a; border: 1px solid #14384a; border-radius: 12px; padding: 14px 10px; color: #e8f4ff; width: 100%; }
.second .codein::placeholder { color: #2c4a5e; }
.second .go { background: #12405f; border: 1px solid #1f6d9e; color: #cfeaff; border-radius: 10px;
  padding: 12px; font-weight: 600; cursor: pointer; }
.second .swap { text-align: center; color: #6b8299; font-size: 13px; }
