/* Sections load like a terminal: a prompt, a typed command, then the section
   prints in. Hidden only while js/cli.js is running (html.cli). */

.cmd {
  grid-column: 1 / -1;
  margin: 0 0 clamp(28px, 4vw, 52px);
  font: 500 14px/1.5 var(--mono);
  color: var(--white);
  overflow-wrap: anywhere;
}
.cmd__ps { color: var(--ink-3); }
.cmd__dollar { transition: color 0.25s ease; }
.cmd__caret {
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.22em;
  background: var(--white);
  animation: cli-blink 1.05s steps(1) infinite;
}
.block.is-typing .cmd__caret { animation: none; }
@keyframes cli-blink { 50% { opacity: 0; } }

/* You are here: the section being read keeps its cursor, and it and the $
   turn red. Every other finished prompt drops its cursor. */
.block.is-done:not(.is-current) .cmd__caret { display: none; }
.block.is-current .cmd__dollar { color: var(--here); font-weight: 700; }
.block.is-current .cmd__caret { background: var(--here); }

/* Waiting for its command: the section is there, but not printed yet. */
.cli .block[data-cmd]:not(.is-done) > :not(.cmd) { opacity: 0; }

/* Printed: the title, then each piece of the body, revealed top to bottom in
   hard steps, like lines arriving on a terminal. */
.cli .block.is-done:not(.is-instant) > .block__title,
.cli .block.is-done:not(.is-instant) > .block__body > * {
  animation: cli-print 0.46s steps(7, end) backwards;
  animation-delay: calc(var(--k, 0) * 85ms);
}
/* Ping replies come back more slowly, one by one. */
.cli .block.is-done:not(.is-instant) > .ping > * { animation-delay: calc(var(--k, 0) * 150ms); }
@keyframes cli-print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }

/* ---------- The status line ----------
   Along the bottom, once the hero is gone: where you are, and the keys that
   move you (js/keys.js). Only with a mouse and keyboard on a wide screen. */

.keys {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 45;
  height: 32px;
  padding: 0 var(--edge);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--black);
  font: 400 12px/1 var(--mono);
  color: var(--ink-3);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
}
.keys::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--edge);
  right: var(--edge);
  height: 2px;
  background: radial-gradient(circle, var(--dot) 1px, transparent 1.4px) 0 0 / 13px 2px repeat-x;
}
.keys.is-on { transform: none; visibility: visible; transition: transform 0.3s ease; }
.keys[hidden] { display: none; }
.keys__here { color: var(--ink-2); }
.keys__map { display: flex; align-items: center; gap: 22px; }
.keys kbd {
  display: inline-block;
  min-width: 19px;
  margin-right: 7px;
  padding: 3px 5px 2px;
  font: 500 11px/1 var(--mono);
  text-align: center;
  color: var(--white);
  border: 1px solid var(--ink-3);
}
.keys kbd + kbd { margin-left: -3px; }
.keys__off {
  padding: 4px 0;
  font: inherit;
  color: var(--ink-3);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 0.3em;
}
.keys__off:hover { color: var(--white); }
.has-keys body { padding-bottom: 32px; }
.intro .keys { display: none; }

@media (max-width: 680px) {
  .cmd { font-size: 13px; }
  .cmd__user { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cmd__caret { animation: none; }
  .block:not(.is-current) .cmd__caret { display: none; }
  .keys { transition: none; }
}
