/* A small macOS-style terminal, a little Easter egg on the home board (js/mini-terminal.js). Everything in it is scripted. */
.mini-terminal {
  --mt-bg: #1f2025;
  --mt-bar: #2b2c33;
  --mt-text: #d5d8de;
  --mt-dim: #7d818c;
  --mt-green: #86d19a;
  --mt-blue: #8bbfe6;
  --mt-amber: #e6bb7e;
  position: absolute;
  left: 3020px; /* the right edge of the board, well outside the first screen: found by dragging */
  top: 1010px;
  z-index: 2;
  width: 330px;
  user-select: none;
  -webkit-user-select: none;
}

.mini-terminal__window {
  overflow: hidden;
  border-radius: 12px;
  background: var(--mt-bg);
  box-shadow: 0 14px 34px rgba(28, 27, 25, 0.22), 0 2px 6px rgba(28, 27, 25, 0.14);
}

.mini-terminal__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  background: var(--mt-bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-terminal__dots {
  display: flex;
  gap: 6px;
}

.mini-terminal__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5f57;
}

.mini-terminal__dots i:nth-child(2) {
  background: #febc2e;
}

.mini-terminal__dots i:nth-child(3) {
  background: #28c840;
}

.mini-terminal__title {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.64rem;
  letter-spacing: 0.01em;
  color: var(--mt-dim);
}

.mini-terminal__replay {
  justify-self: end;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mt-dim);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.6rem;
  line-height: 1.2;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.mini-terminal__replay:hover,
.mini-terminal__replay:focus-visible {
  opacity: 1;
  color: var(--mt-text);
  background: rgba(255, 255, 255, 0.08);
}

.mini-terminal__replay:focus-visible {
  outline: 2px solid rgba(139, 191, 230, 0.7);
  outline-offset: 1px;
}

/* the screen: the room is reserved from the start, so nothing moves while it plays */
.mini-terminal__screen {
  box-sizing: border-box;
  padding: 11px 14px 12px;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--mt-text);
  white-space: nowrap;
}

.mt-line,
.mt-gap {
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.mt-gap {
  height: 7px;
}

.mt-line {
  min-height: 1.6em;
}

.mt-line.is-on,
.mt-gap.is-on {
  opacity: 1;
  transform: none;
}

.mt-user { color: var(--mt-green); }
.mt-dim { color: var(--mt-dim); }
.mt-text { color: var(--mt-text); }
.mt-cmd { color: var(--mt-amber); }
.mt-sub { color: var(--mt-text); }
.mt-name { color: var(--mt-blue); }
.mt-ok { color: var(--mt-green); }
.mt-num { color: var(--mt-amber); }
.mt-done { color: #fff; }

.mt-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.15em;
  background: var(--mt-text);
  animation: mt-blink 1.05s steps(1) infinite;
}

@keyframes mt-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* the full text for screen readers; the animated copy above is hidden from them */
.mini-terminal__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mini-terminal__caption {
  margin: 7px 0 0 2px;
  font-size: 0.58rem;
  letter-spacing: 0.01em;
  color: var(--muted, #6f6b64);
  opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
  .mt-line,
  .mt-gap {
    transition: none;
    transform: none;
  }

  .mt-cursor {
    animation: none;
  }
}

/* phones and tablets get the simpler home page without it */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  body.home .mini-terminal {
    display: none;
  }
}
