/* =====================================================================
   boot.css — CHAMBERS mind-palace power-on sequence (site-wide, once per
   session). markup contract: <div id="kboot" class="kboot" aria-hidden="true"></div>
   gate: `html.kb-run` — set by the inline <head> script before first paint,
         so the cover exists from frame 1 and the page never flashes through.
   driver: /boot.js
   ===================================================================== */
.kboot {
  /* the skin's palette, declared here so the cover never depends on the page */
  --cb-black: #04040a;
  --cb-pink: #ff2ec4;
  --cb-cyan: #22d3ee;
  --cb-gold: #e4c045;
  --cb-dim: #8ba7b8;
  --cb-mono: 'ProFont for Powerline', ProFont, monaco, ui-monospace, monospace;
  --cb-comic: 'Comic Sans MS', Verdana, sans-serif;
  display: none;
}

html.kb-run { overflow: hidden; }
html.kb-run .kboot {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: clamp(8px, 1.1vw, 16px);
  position: fixed; inset: 0; z-index: 200;
  padding: clamp(12px, 1.8vw, 34px);
  font-family: var(--cb-mono);
  color: var(--cb-cyan);
  background:
    radial-gradient(1000px 620px at 50% 42%, rgba(34, 211, 238, .10), transparent 64%),
    radial-gradient(760px 520px at 88% 92%, rgba(255, 46, 196, .09), transparent 60%),
    radial-gradient(700px 460px at 6% 6%, rgba(228, 192, 69, .05), transparent 60%),
    var(--cb-black);
  clip-path: inset(0 0 0 0);
  transition: clip-path .62s cubic-bezier(.72, 0, .2, 1), opacity .22s linear .54s;
}
/* grain + vignette, in the same spirit as the site's 404 box */
.kboot::before, .kboot::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.kboot::before {
  opacity: .055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.kboot::after { background: radial-gradient(124% 92% at 50% 50%, transparent 50%, rgba(0, 0, 0, .62)); }
.kboot > * { position: relative; z-index: 1; }

/* ---------- exit: the chamber door irises shut behind you ---------- */
.kboot.kb-up { clip-path: inset(49.9% 0 49.9% 0); opacity: .9; }
.kboot .kb-seam { position: absolute; left: 0; right: 0; top: 50%; height: 2px; z-index: 3; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--cb-pink) 18%, var(--cb-gold) 50%, var(--cb-pink) 82%, transparent); }
.kboot.kb-up .kb-seam { opacity: 1; box-shadow: 0 0 26px 3px rgba(255, 46, 196, .55); }

/* ---------- staggered reveal of every chrome element ---------- */
.kb-el { opacity: 0; transform: translateY(6px); }
.kb-on .kb-el { animation: kb-in .5s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms) both; }
@keyframes kb-in { to { opacity: 1; transform: none } }

/* ---------- top bar ---------- */
.kb-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding-bottom: clamp(8px, 1vw, 14px); border-bottom: 1px dashed rgba(34, 211, 238, .38); }
.kb-brand { font: 700 clamp(19px, 2.1vw, 30px)/1 var(--cb-comic); letter-spacing: .02em;
  color: var(--cb-pink); animation: kb-rb 3s infinite; text-shadow: 0 0 14px rgba(255, 46, 196, .55); }
.kb-brand small { font: 500 clamp(8px, .72vw, 11px)/1 var(--cb-mono); letter-spacing: .22em; color: var(--cb-dim);
  margin-left: 10px; vertical-align: middle; text-shadow: none; animation: none; }
@keyframes kb-rb { 0% { color: #f0f } 33% { color: #0ff } 66% { color: #ff0 } 100% { color: #f0f } }
.kb-mid { display: inline-flex; align-items: center; gap: 8px; font-size: clamp(8px, .74vw, 11px);
  letter-spacing: .2em; text-transform: uppercase; color: var(--cb-dim); white-space: nowrap; }
.kb-clock { justify-self: end; font-size: clamp(9px, .8vw, 12px); letter-spacing: .1em;
  font-variant-numeric: tabular-nums; color: var(--cb-dim); }

.kb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cb-gold); box-shadow: 0 0 10px var(--cb-gold);
  animation: kb-pulse 1.5s ease-in-out infinite; flex: none; }
.kb-on .kb-dot { background: var(--cb-cyan); box-shadow: 0 0 10px var(--cb-cyan); }
@keyframes kb-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .28 } }

/* ---------- stage: the corridor of chambers ---------- */
.kb-stage { position: relative; min-height: 0; overflow: hidden;
  border: 2px solid rgba(34, 211, 238, .45);
  background: radial-gradient(70% 70% at 50% 46%, rgba(6, 10, 18, .92), rgba(0, 0, 0, .55));
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .8), 0 0 18px rgba(255, 46, 196, .18); }
.kb-cv { position: absolute; inset: 0; width: 100%; height: 100%; }

/* room plate — names the chamber the camera is passing through */
.kb-plate { position: absolute; left: 50%; transform: translateX(-50%); top: clamp(8px, 1.2vw, 16px);
  padding: .25rem .8rem; text-align: center; white-space: nowrap;
  border: 1px dashed rgba(228, 192, 69, .6); background: rgba(0, 0, 0, .55);
  font-size: clamp(9px, .86vw, 13px); letter-spacing: .18em; color: var(--cb-gold); }
.kb-plate b { color: #fff; font-weight: 700; }

/* boot log, typed line by line at the bottom-left of the stage */
.kb-log { position: absolute; left: clamp(10px, 1.2vw, 18px); bottom: clamp(9px, 1.1vw, 16px);
  max-width: min(72%, 560px); font-size: clamp(8.5px, .74vw, 11.5px); line-height: 1.7; color: var(--cb-dim); }
.kb-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-l i { color: var(--cb-pink); font-style: normal; margin-right: .5em; }
.kb-l b { color: var(--cb-cyan); font-weight: 400; }
.kb-l.g b, .kb-l.g { color: var(--cb-gold); }
.kb-caret { display: inline-block; width: .55em; height: .95em; margin-left: .25em; vertical-align: -.12em;
  background: var(--cb-cyan); animation: kb-blink .9s steps(1) infinite; }
@keyframes kb-blink { 50% { opacity: 0 } }

/* corner brackets — gold once the palace is open */
.kb-ticks i { position: absolute; width: 12px; height: 12px; border: 1px solid rgba(34, 211, 238, .5);
  transition: border-color .4s ease; }
.kb-ticks i:nth-child(1) { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.kb-ticks i:nth-child(2) { top: 7px; right: 7px; border-left: 0; border-bottom: 0; }
.kb-ticks i:nth-child(3) { bottom: 7px; left: 7px; border-right: 0; border-top: 0; }
.kb-ticks i:nth-child(4) { bottom: 7px; right: 7px; border-left: 0; border-top: 0; }
.kb-on .kb-ticks i { border-color: var(--cb-gold); }

/* light pass sweeping down the corridor while it streams in */
.kb-scan { position: absolute; left: 0; right: 0; top: -30%; height: 24%; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(34, 211, 238, .05) 60%, rgba(255, 46, 196, .07) 88%, transparent); }
.kb-busy .kb-scan { opacity: 1; animation: kb-sweep 2.6s cubic-bezier(.4, 0, .6, 1) infinite; }
@keyframes kb-sweep { 0% { top: -30% } 100% { top: 108% } }

/* completion: the whole corridor blows out, once */
.kb-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(60% 60% at 50% 50%, rgba(255, 255, 255, .85), rgba(255, 46, 196, .25) 45%, transparent 72%); }
.kb-live .kb-flash { animation: kb-blow .7s ease-out both; }
@keyframes kb-blow { 0% { opacity: 0 } 22% { opacity: .95 } 100% { opacity: 0 } }

/* ---------- stat strip ---------- */
.kb-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, .8vw, 12px); }
.kb-cell { border: 1px solid rgba(34, 211, 238, .3); background: rgba(0, 0, 51, .5);
  padding: clamp(5px, .7vw, 10px) clamp(6px, .8vw, 12px); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kb-k { font-size: clamp(7.5px, .66vw, 10px); letter-spacing: .18em; text-transform: uppercase; color: var(--cb-dim); }
.kb-v { font-size: clamp(10px, .92vw, 14px); letter-spacing: .06em; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-v.g { color: var(--cb-gold); }
.kb-v.c { color: var(--cb-cyan); }
.kb-v.idle { color: var(--cb-dim) }

/* ---------- foot ---------- */
.kb-foot { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center;
  gap: clamp(8px, 1.4vw, 22px); padding-top: clamp(7px, .9vw, 13px);
  border-top: 1px dashed rgba(34, 211, 238, .38); }
.kb-status { display: inline-flex; align-items: center; gap: 8px; font-size: clamp(9px, .8vw, 12px);
  letter-spacing: .12em; color: #fff; white-space: nowrap; }
.kb-status b { color: var(--cb-pink); font-weight: 700; letter-spacing: .14em; }
.kb-note { color: var(--cb-dim); letter-spacing: .04em; }
.kb-meter { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.kb-track { position: relative; height: 4px; background: rgba(34, 211, 238, .16); overflow: visible; }
.kb-track i { position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: linear-gradient(90deg, var(--cb-cyan), var(--cb-pink)); }
.kb-track u { position: absolute; top: -3px; width: 3px; height: 10px; left: 0; background: #fff;
  box-shadow: 0 0 10px 1px rgba(255, 255, 255, .8); }
.kb-pct { font-size: clamp(9px, .8vw, 12px); color: var(--cb-gold); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.kb-skip { font-size: clamp(8px, .72vw, 11px); color: var(--cb-dim); letter-spacing: .1em; white-space: nowrap;
  transition: opacity .4s ease; }
/* once the palace is open the hint is done — kill the entry animation so opacity wins */
.kb-live .kb-skip { animation: none; opacity: 0; }
.kb-skip kbd { border: 1px solid rgba(34, 211, 238, .45); padding: 1px 6px; color: var(--cb-cyan); font: inherit; }

/* ---------- phones: keep the corridor, drop the fine print ---------- */
@media (max-width: 640px) {
  .kb-mid, .kb-clock { display: none; }
  .kb-top { grid-template-columns: 1fr; }
  .kb-log { max-width: 92%; font-size: 8.5px; line-height: 1.55; }
  .kb-l { white-space: normal; }              /* wrap rather than clip the long uplink line */
  .kb-plate { font-size: 9px; letter-spacing: .12em; }
  .kb-strip { grid-template-columns: repeat(2, 1fr); }
  .kb-foot { grid-template-columns: 1fr auto; }
  .kb-status .kb-note { display: none; }
}
