/* ============================================================
   Hidden terminal (js/terminal.js). Drops down from the top of
   the screen like an old game console, in frosted glass.
   ============================================================ */

.terminal {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 400; /* above nav (100) and the detail drawer (300) */
  width: min(880px, calc(100% - 2rem));
  height: min(58vh, 500px);
  display: flex;
  flex-direction: column;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: rgba(16, 16, 18, 0.9);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.75), inset 0 -1px 0 rgba(116, 128, 194, 0.25);
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #a1a1a6;
  transform: translate(-50%, -105%);
  visibility: hidden;
  transition: transform 0.45s var(--ease-smooth), visibility 0s linear 0.45s;
}

.terminal.is-open {
  transform: translate(-50%, 0);
  visibility: visible;
  transition: transform 0.45s var(--ease-smooth), visibility 0s;
}

.terminal-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  color: #86868b;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1.1rem 0.2rem;
  white-space: pre-wrap;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.terminal-line {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
  padding: 0.2rem 1.1rem 0.9rem;
  margin: 0;
}

.terminal-prompt,
.t-prompt {
  color: #4da3ff;
  white-space: nowrap;
}

.terminal-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  font: inherit;
  color: #f5f5f7;
  caret-color: #4da3ff;
}

.t-line { min-height: 1.6em; }
.t-echo { color: #f5f5f7; margin-top: 0.35rem; }
.t-strong { color: #f5f5f7; }
.t-dim { color: #86868b; }
.t-error { color: #d99a9a; }
.t-key { color: #4da3ff; }
.t-key-wide { display: inline-block; min-width: 14ch; }

.terminal-output a {
  color: #f5f5f7;
  text-decoration: underline;
  text-decoration-color: rgba(116, 128, 194, 0.6);
  text-underline-offset: 3px;
}
.terminal-output a:hover { color: #4da3ff; }

@media (prefers-reduced-motion: reduce) {
  .terminal,
  .terminal.is-open { transition: none; }
}
